[LLVMbugs] [Bug 4443] macro expansion Expr has wrong source range
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Jun 25 09:25:31 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4443
Chris Lattner <clattner at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #1 from Chris Lattner <clattner at apple.com> 2009-06-25 11:25:26 ---
Clang tracks this information, but doesn't print it in the dump output. The )
token that gets expanded through the macro will have a sourcelocation that is a
macroloc. On that location you can us SM.getInstantiationRange(Loc) which
returns a pair. The first element of the pair should be the FOO token, the
second element of the range should be the ) of the foo instantiation. You can
see that the diagnostic printer uses this in cases like this:
extern struct x y;
#define FOO(X) X
void bar() {
1 + FOO(y);
}
t.c:8:5: error: invalid operands to binary expression ('int' and 'struct x')
1 + FOO(y);
~ ^ ~~~~~~
In the ast we just have the 1, +, and y tokens. The y token has an
instantiation range that covers the whole foo invocation (4 tokens).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list