[PATCH] Anonymous namespaces are missing import DW_TAG_imported_module.

Katya Romanova Katya_Romanova at playstation.sony.com
Wed May 13 10:56:10 PDT 2015


Hi David,
Sorry for the delay answering your question about AST.

> > One question, if you're up for it - there is actually an implicit UsingDirectiveDecl in the AST

> 


..

> > It's possible we could figure out why that decl is being skipped normally? & avoid skipping it/filter it out later for non-ps4 while leaving it in for ps4, rather than synthesizing the extra 

> 

> >  imported module from scratch in the debug info code gen?

> 

> >  I took a glance & didn't immediately see why we weren't already visiting this implicit decl - I guess something is filtering out implicit decls somewhere?

> 


Implicit UsingDirectiveDecl is generated by Sema::ActOnStartNamespaceDef() when it’s given an anonymous namespace.
The UsingDirectedDecl is added to the Parent (top level) which is why you see it in AST dump.

Above function is called from ParseNamespace(), which is called by ParseDeclaration(). ParseDeclaration() returns DeclGroup.
The problem is that group is populated with a SingleDecl that ParseNamespace returns ([anonymous] NamespaceDecl).

ParseDeclaration doesn’t know anything about the UsingNamespaceDecl that ParseNamespace implicitly generated
and added to the parent.. This implicit declaration is not added to the DeclGroup and thus you don’t generate
debug node for it.

If we want ParseNamespace to generate both NamespaceDecl AND an implicit UsingNamespaceDecl
then the following piece of code:

  case tok::kw_namespace:
    ProhibitAttributes(attrs);
    SingleDecl = ParseNamespace(Context, DeclEnd);
    break;

should return not the SingleDecl (converted to DeclGroup), but a DeclGroup containing both NamespaceDecl AND UsingNamespaceDecl.

I think that this fix (conditional for PS4 only) will be more complicated and more invasive solution than FE solution that I implemented before.

I saw that you already accepted my latest FE patch. Please confirm that you didn't change your mind about how this bug should get fixed after your saw this explanation about AST.

If everything is OK, I will rebase and commit my latest FE patch.
Thanks for reviewing!


http://reviews.llvm.org/D7895

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list