diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-02-08 22:30:31 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-02-08 22:30:31 +0000 |
commit | 4a04d445af4d29440371800409babc98708d98aa (patch) | |
tree | 66c9725f3eff51f2e673ed22b375441af3667e6f /lib/Lex | |
parent | 6d4f73498cf014b002e72368f1c80b6b0a0785f0 (diff) |
Simplify logic for avoiding concatenation after numeric constants.
I threw in a couple of test cases for UD-suffixes -- already working, but
it wasn't immediately obvious to me.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/TokenConcatenation.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Lex/TokenConcatenation.cpp b/lib/Lex/TokenConcatenation.cpp index 30dc8f19d9..0a66bba91f 100644 --- a/lib/Lex/TokenConcatenation.cpp +++ b/lib/Lex/TokenConcatenation.cpp @@ -12,9 +12,9 @@ //===----------------------------------------------------------------------===// #include "clang/Lex/TokenConcatenation.h" +#include "clang/Basic/CharInfo.h" #include "clang/Lex/Preprocessor.h" #include "llvm/Support/ErrorHandling.h" -#include <cctype> using namespace clang; @@ -240,13 +240,12 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, return IsIdentifierStringPrefix(PrevTok); case tok::numeric_constant: - return isalnum(FirstChar) || Tok.is(tok::numeric_constant) || - FirstChar == '+' || FirstChar == '-' || FirstChar == '.' || - (PP.getLangOpts().CPlusPlus11 && FirstChar == '_'); + return isPreprocessingNumberBody(FirstChar) || + FirstChar == '+' || FirstChar == '-'; case tok::period: // ..., .*, .1234 return (FirstChar == '.' && PrevPrevTok.is(tok::period)) || - isdigit(FirstChar) || - (PP.getLangOpts().CPlusPlus && FirstChar == '*'); + isDigit(FirstChar) || + (PP.getLangOpts().CPlusPlus && FirstChar == '*'); case tok::amp: // && return FirstChar == '&'; case tok::plus: // ++ |