Get macro name or its length

Hello

assume following code;

#define MACRO ((void*)0)

int main()
{
    int n;
    int* p;
    if(p == MACRO)
  n = 1;
}

During the AST generation I can get the expression p == MACRO and its
SourceLocation. The Begin and End of the SourceLocation will be
following 80 and 2147487899. Then I can get InstantiationInfo about
macro and begging and end of this info will be the same 85 and 85
according to the SourceManager class.
So my question is the following - is there any way to retrieve the
name of the MACRO? Or its length? How can I get position of the last
symbol of "MACRO" word in source file? I need this in order to rewrite
the condition, since simple Rewriter.RewriteStmt(Stmt*, Stmt*) will
not work in this case.

with best regards,
Andrey Tarasevich

Hello

assume following code;

#define MACRO ((void*)0)

int main()
{
   int n;
   int* p;
   if(p == MACRO)
  n = 1;
}

During the AST generation I can get the expression p == MACRO and its
SourceLocation. The Begin and End of the SourceLocation will be
following 80 and 2147487899. Then I can get InstantiationInfo about
macro and begging and end of this info will be the same 85 and 85
according to the SourceManager class.
So my question is the following - is there any way to retrieve the
name of the MACRO?

Lexer::getSpelling()

Or its length?

Lexer::MeasureTokenLength()

How can I get position of the last
symbol of "MACRO" word in source file?

Preprocessor::getLocForEndOfToken()

  - Doug

Thank you very much! It works perfect.