[cfe-dev] printing name of owning anonymous structure in RecursiveASTVisitor::VisitFieldDecl?
Peeter Joot
peeter.joot at gmail.com
Tue Dec 11 12:20:11 PST 2012
Thanks Yang,
That works nicely.
However, any idea why this test attempt doesn't correctly identify the
anonymous nature of the type:
string s ;
if ( r->isAnonymousStructOrUnion() )
{
const Type * RT = r->getTypeForDecl() ;
QualType QT = RT->getCanonicalTypeInternal() ;
s = QT.getAsString() ;
}
else
{
s = r->getName().str() ;
}
I can work around this by using the following instead:
string s = r->getName().str() ;
if ( "" == s )
// else removed.
but it seems like an odd thing to do (try to format the object as a string
to test an attribute).
Peeter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121211/c88b7631/attachment.html>
More information about the cfe-dev
mailing list