summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/TokenConcatenation.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-08 22:30:31 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-08 22:30:31 +0000
commita08ed5965caf1593f8faf2175b8e074808281331 (patch)
treea5bb1d8c3ea154f674589fc8dfefeab1c7cdc149 /clang/lib/Lex/TokenConcatenation.cpp
parent00d1b59184bbfcfbaffef267426eaf38bcdef4b1 (diff)
downloadbcm5719-llvm-a08ed5965caf1593f8faf2175b8e074808281331.tar.gz
bcm5719-llvm-a08ed5965caf1593f8faf2175b8e074808281331.zip
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. llvm-svn: 174767
Diffstat (limited to 'clang/lib/Lex/TokenConcatenation.cpp')
-rw-r--r--clang/lib/Lex/TokenConcatenation.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Lex/TokenConcatenation.cpp b/clang/lib/Lex/TokenConcatenation.cpp
index 30dc8f19d90..0a66bba91fc 100644
--- a/clang/lib/Lex/TokenConcatenation.cpp
+++ b/clang/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: // ++
OpenPOWER on IntegriCloud