leonardchan marked 5 inline comments as done.
leonardchan added a comment.
@rsmith When you clarify what you mean by `outermost macro expansion`? Say I
have the following:
#define ATTR __attribute__
#define AS(i) address_space(i)
#define AS1 ATTR((address_space(1)))
#define AS2 ATTR((AS(2)))
int cmp(AS1 char *x, AS2 char *y) {
return x < y ? x : y;
}
`AS1 char *` and `AS2 char *` would be diagnosed for an error relating to
mismatched types, but I think `outermost macro expansion` implies either `ATTR`
or `AS` would be the identifier stored as opposed to `AS1` and `AS2`.
Would it be simpler to instead just check:
- the starting `__attribute__` token was the start of a macro expansion
- the ending right parenthesis token was the end of a macro expansion
- both start and end tokens had the same location to indicate this attribute
was used in a macro
After fulfulling these, we can call `Lexer::getSourceText()` to get the
spelling of the macro from this SourceLocation.
Repository:
rC Clang
https://reviews.llvm.org/D51329
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits