diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-06-15 19:48:50 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-06-15 19:48:50 +0000 |
commit | 8849f1190330c493a89b0088557d1a2333465847 (patch) | |
tree | 0fbeb083306436ece007a402e80fd537d7ebcd77 /lib/Lex/TokenConcatenation.cpp | |
parent | 3f3ce82674b44a58a2af7d90feb55acd906dd762 (diff) |
PR4395: Don't detect token concatenation in C mode for
C++-specific tokens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/TokenConcatenation.cpp')
-rw-r--r-- | lib/Lex/TokenConcatenation.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Lex/TokenConcatenation.cpp b/lib/Lex/TokenConcatenation.cpp index ab989cafc1..be13b27457 100644 --- a/lib/Lex/TokenConcatenation.cpp +++ b/lib/Lex/TokenConcatenation.cpp @@ -192,7 +192,8 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevTok, return isalnum(FirstChar) || Tok.is(tok::numeric_constant) || FirstChar == '+' || FirstChar == '-' || FirstChar == '.'; case tok::period: // ..., .*, .1234 - return FirstChar == '.' || isdigit(FirstChar) || FirstChar == '*'; + return FirstChar == '.' || isdigit(FirstChar) || + (PP.getLangOptions().CPlusPlus && FirstChar == '*'); case tok::amp: // && return FirstChar == '&'; case tok::plus: // ++ @@ -210,10 +211,11 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevTok, case tok::percent: // %>, %: return FirstChar == '>' || FirstChar == ':'; case tok::colon: // ::, :> - return FirstChar == ':' ||FirstChar == '>'; + return FirstChar == '>' || + (PP.getLangOptions().CPlusPlus && FirstChar == ':'); case tok::hash: // ##, #@, %:%: return FirstChar == '#' || FirstChar == '@' || FirstChar == '%'; case tok::arrow: // ->* - return FirstChar == '*'; + return PP.getLangOptions().CPlusPlus && FirstChar == '*'; } } |