[cfe-dev] query AST for C++ method qualifiers

Jan Bierbaum s3306700 at inf.tu-dresden.de
Sun Sep 12 08:21:33 PDT 2010


Hi!


How can I correctly determine the qualifiers used in the declaration of
a 'CXXMethodDecl'?

I found
'CXXMethodDecl::isStatic()'
'CXXMethodDecl::isVirtual()' and
'FunctionDecl::isVirtualAsWritten()'
to work just fine.

For 'const' and 'volatile' I use 'CXXMethodDecl::getThisType()'
and then check if the type 'isLocalConstQualified()' or
'isLocalVolatileQualified()'. Confusingly I *always* get 'false' from
these two method calls, but according to getThisType's source code
comment it's exactly the method I want to use.

Attached are a small test file, the ASTConsumer code I use for testing
and the output I get. Any idea what might be wrong here?


Regards, Jan.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: consumer.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100912/2f8ca900/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: output
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100912/2f8ca900/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100912/2f8ca900/attachment-0002.ksh>


More information about the cfe-dev mailing list