sfantao added a comment. In http://reviews.llvm.org/D12614#278101, @rjmccall wrote:
> In http://reviews.llvm.org/D12614#274349, @sfantao wrote: > > > Hi John, > > > > Thanks for the remark! > > > > In http://reviews.llvm.org/D12614#272354, @rjmccall wrote: > > > > > CurFuncDecl is supposed to be the enclosing user function. Things like > > > outlined functions should be getting stored in CurCodeDecl; that's how > > > it's done for blocks and lambdas. > > > > > > Apologies I was not accurate in my previous post. `CurFuncDecl` is in fact > > the declaration of the enclosing user function. What is not defined in some > > times undefined is `CurGD` and this is what I was trying to use to get the > > right mangled name of the user function, given that it also encodes the > > structor type. So my question is: is there a good/safe way to get the > > mangled name of the user function given the function declaration? I didn't > > find any good way to do that without replicating part of the stuff that > > happens in the mangler. > > > You don't actually want the structor type of the parent, because the nested > declaration is logically the same declaration across all of them. For > example, a lambda used in a constructor is still just a single type; there > aren't implicitly 1-3 different types just because there are 1-3 different > variant entrypoints for the constructor. > > The way this generally works is that you just pick a single canonical > variant. For example, the Itanium ABI says that you mangle local entities > within constructors as if they were defined within the complete-object > variant. If you want to add a method to one of the CXXABI objects to pick a > canonical GD for a declaration, feel free. Thanks for explaining that! I am now relying exclusively on `CurFuncDecl` in the last diff. As for the structor variants, I am now using the complete variant to generate the names of the kernels as you suggested. I didn't add any method to CXXABI as that will require extra logic in ASTContext to make that visible during the code generation. Instead, I hardcoded `Ctor[Dtor]_Complete` in the code generation, similarly to what is done in the name mangler. Let me know if you'd rather have the method in CXXABI. Let me know other comments suggestions you may have. Thanks again! Samuel http://reviews.llvm.org/D12614 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits