rsmith added inline comments.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:2513
+      cast<CXXConstructorDecl>(D)->isCopyOrMoveConstructor())
+    F->addParamAttr(1, llvm::Attribute::NoAlias);
+
----------------
rsmith wrote:
> It's not strictly correct to assume that you know the correspondence between 
> `llvm::Function` parameter indices and those of the `clang::FunctionDecl` 
> like this. That's up to the ABI, and for constructors in particular, there 
> may be a VTT parameter to deal with (and `__attribute__((pass_object_size))` 
> can also interfere). You can probably get away with assuming that the `this` 
> parameter has index 0 for now, but even that is likely to break at some point 
> down the line.
The best way to deal with this is to create the attribute in 
`CodeGenModule::ConstructAttributeList`, where you have access to the 
`ClangToLLVMArgMapping`.


https://reviews.llvm.org/D46441



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to