Trying to match integerLiteral(-1) will silently fail, because clang only represents positive integer literals.
- Update the documentation to explain how to match negative integers.
- Add a unit test.
Differential D35196
[ASTMatchers][NFC] integerLiteral(): Mention negative integers in documentation. courbet on Jul 10 2017, 4:53 AM. Authored by
Details Trying to match integerLiteral(-1) will silently fail, because clang only represents positive integer literals.
Diff Detail Event Timeline
Comment Actions
Comment Actions LGTM, thank you!
|
I'm not keen on this explanation -- the reason you cannot match a negative integer is because the source languages treat the integer literal as positive and you apply the unary negation operator to the integer literal. Basically, from the lexer's perspective, the integer literal does not have a - sign; that is an expression.