[LLVMdev] Correct way to test if a declaration is within the scope of a namespace (anonymous or not)

Antonio Martínez Álvarez amartinez76 at gmail.com
Tue Nov 27 11:39:55 PST 2012


Hi all,

I'm trying to test if a declaration is within the scope of a namespace 
(anonymous or not).
Actually I'm using this code  to test this (it's just a hack I know). 
What is the correct way to do this?


if (ND->getQualifiedNameAsString().find("::") != std::string::npos)  {

ND is defined in a namespace
}

  ND is a DeclaratorDeck*


Many thanks in advance.

Best regards.



More information about the llvm-dev mailing list