[PATCH] D7895: Anonymous namespaces are missing import DW_TAG_imported_module.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 12:33:09 PDT 2015


dblaikie added a comment.

In http://reviews.llvm.org/D7895#226211, @kromanova wrote:

> Hi David,
>
> Sorry for the delay. As per your request, I have changed to patch to generate (hopefully) correct DWARF info for nested anonymous namespace. Currently, clang generates  DW_TAG_imported_module for inner (nested) anonymous NS, but not for outer one. So, the situation was somewhat asymmetric.
>
> I have changed clang not to generate DW_TAG_imported_module tag for all the platforms, except PS4 (where we always want to generate DW_TAG_imported_module tags for anonymous NS).
>
> ParseNamespace now returns DeclGroup containing both NamespaceDecl AND UsingNamespaceDecl (unfortunately, I couldn't think of a better way to plumb UsingNamespaceDecl to the top level, so had to change the return type for ParseNamespace).


This is a somewhat more involved change which we might want to check with Richard or other frontend people if it's the right way to go.

It's possible that the opposite way might make sense - we could make the current situation consistent by ignoring implicit using decls. Then we could add the functionality you need by just manually creating an imported module whenever we see an anonymous namespace. Would that make sense?

(I'd do this as two patches - first make the current world consistent (no imported modules for any anonymous namespaces) then add the special case for anonymous namespaces on PS4 that the get this explicit imported namespace thing - just as a Debug-only thing (though I suppose it could be interesting to know if there are other sources of implicit using directives, as PS4 might want those too - in which case your current approach might be the one to aim for (& even if that's not the case, there's a certain elegance to it, for sure - "PS4 gets DWARF for implicit using directives" rather than special casing anonymous namespaces directl, etc))

> I added a testcase to check that no DW_TAG_imported_module are generated for nested anonymous namespaces for all the platforms except than PS4 (where we expect to generate two DW_TAG_imported_modules, one for inner, another for outer NS).





http://reviews.llvm.org/D7895





More information about the llvm-commits mailing list