summaryrefslogtreecommitdiffstats
path: root/lib/Lex/TokenConcatenation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/TokenConcatenation.cpp')
-rw-r--r--lib/Lex/TokenConcatenation.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Lex/TokenConcatenation.cpp b/lib/Lex/TokenConcatenation.cpp
index 51d2e23..fc6db21 100644
--- a/lib/Lex/TokenConcatenation.cpp
+++ b/lib/Lex/TokenConcatenation.cpp
@@ -124,7 +124,8 @@ static char GetFirstChar(Preprocessor &PP, const Token &Tok) {
/// but the resulting output won't have incorrect concatenations going on.
/// Examples include "..", which we print with a space between, because we
/// don't want to track enough to tell "x.." from "...".
-bool TokenConcatenation::AvoidConcat(const Token &PrevTok,
+bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok,
+ const Token &PrevTok,
const Token &Tok) const {
// First, check to see if the tokens were directly adjacent in the original
// source. If they were, it must be okay to stick them together: if there
@@ -192,7 +193,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) ||
+ return (FirstChar == '.' && PrevPrevTok.is(tok::period)) ||
+ isdigit(FirstChar) ||
(PP.getLangOptions().CPlusPlus && FirstChar == '*');
case tok::amp: // &&
return FirstChar == '&';
OpenPOWER on IntegriCloud