r302840 - Module Debug Info: Emit namespaced C++ forward decls in the correct module.

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 09:38:08 PDT 2017


> On May 11, 2017, at 5:05 PM, Adrian Prantl via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> 
>> 
>> On May 11, 2017, at 4:43 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>> 
>> I don't think that's quite right; the AST doesn't merge NamespaceDecls. It looks like the issue is that we're mapping to the semantic DeclContext (which will be the canonical declaration of the namespace and could be from a different module) rather than the lexical DeclContext (the enclosing one, in the same module)... and then getOrCreateNameSpace is again mapping to the canonical declaration before calling getDeclContextDescriptor.
> 
> Thanks for pointing this out! It looks like I can simplify the code a lot if I can pass the lexical DeclContext to getOrCreateNamespace and then delegate the uniquing of the DINamespaces to DIBuilder (or rather MDNode), which will work now that DINamespaces don't carry line and file any more.
> 
> I see that there is Decl::getLexicalContext(), so this should be doable.

Done in r302915. Looking much cleaner now. Thanks!

-- adrian



More information about the cfe-commits mailing list