Given the following code:
void Foo(int); #define Bar(x) Foo(x) void Baz() { Bar(sizeof int); }
The error message which is printed today is this:
error: expected parentheses around type name in sizeof expression
There is no source location printed whatsoever, so fixing a compile break like this becomes extremely hard in a large codebase.
My change improves the error message. But it doesn't output a FixItHint because I wasn't able to figure out how to get the locations for left and right parens. So any tips would be appreciated.
<source>:7:6: error: expected parentheses around type name in sizeof expression Bar(sizeof int); ^
I don't think we should be assuming that getLocForEndOfToken will fail if and only if the token is a macro -- that seems brittle. It would seem better to check whether it actually failed and respond to that directly. Would something like this suggestion work?