[cfe-dev] Getting the location of the identifier in TagDecl and RecordDecl
Lukhnos Liu
lukhnos at lukhnos.org
Fri May 25 12:00:37 PDT 2012
Hi,
How can one get the location of the identifier of a TagDecl or RecordDecl?
For example, if I have "enum Foo { ... }" and have a TagDecl *T. T->getLocStart() returns the beginning location of the token "enum". I tried to use Lexer::findLocationAfterToken with that location and tok::kw_enum but that gives me an invalid location. Preprocessor::getLocForEndOfToken() with that start location returns the location right after the token "enum", but not the start of "Foo". The reason I'm not using getName() or type information is that I want to replace "Foo" with some other things, hence the need for source locations.
Thanks!
Lukhnos
More information about the cfe-dev
mailing list