forked from OSchip/llvm-project
![]() #define friendlystruct fs struct A { int X; }; void test2(struct A friendlystruct, int C) { return friendlystruct + (C *40); } were getting diagnosed like this: t.c:7:27: error: invalid operands to binary expression ('struct A' and 'int') return friendlystruct + (C *40); ~~ ^ ~~~~~~~~~~~ The problem is that getCharacterData returns a pointer to the macro expansion, not to the macro instantiation. Instead, use getLogicalLoc to get a pointer to the instatiation location, so we relex the macro id. We now get: t.c:7:27: error: invalid operands to binary expression ('struct A' and 'int') return friendlystruct + (C *40); ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ oooh ahh. :) llvm-svn: 39465 |
||
---|---|---|
clang | ||
llvm | ||
stacker |