> On May 11, 2017, at 5:05 PM, Adrian Prantl via cfe-commits > <cfe-commits@lists.llvm.org> wrote: > >> >> On May 11, 2017, at 4:43 PM, Richard Smith <rich...@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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits