[PATCH] D12614: [OpenMP] Offloading descriptor registration and device codegen.

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 17:08:24 PDT 2015

rjmccall added a comment.

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.


More information about the cfe-commits mailing list