Hi,

Given:

#define W(A) while(A)

void myfunc()
{
        W(1) {
        }
}

I would like retrieve a string for the "1" parameter of the while-macro.

Usually I would use:

        Lexer::getSourceText(CharSourceRange::getCharRange(sr), sm, 
LangOptions(), 0);

(with 'sr' being a SourceRange and sm a SourceManager object).

to retrieve part of the original source-code. This works fine for e.g.
int a = 1; but fails for #defines.

I tried getLocStart, getLocation, tried using Lexer::getLocForEndOfToken
and sm.getSpellingLoc but everything ends up with an empty string ("").

Any suggestions?


regards
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to