diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-21 23:28:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-21 23:28:41 +0000 |
commit | e1614bb01cc429658b414a9e00603c66ae96d8f5 (patch) | |
tree | bc8a5bc36655ad7f5b4e752304fda9618af7f83c /lib/Lex/TokenConcatenation.cpp | |
parent | 914d3db20eb3126175f19901fadbbd7b268a3667 (diff) |
apply Eli's patch to fix PR4008, with a testcase. Thanks Eli!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69750 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/TokenConcatenation.cpp')
-rw-r--r-- | lib/Lex/TokenConcatenation.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Lex/TokenConcatenation.cpp b/lib/Lex/TokenConcatenation.cpp index 92edca7be4..15637996b4 100644 --- a/lib/Lex/TokenConcatenation.cpp +++ b/lib/Lex/TokenConcatenation.cpp @@ -126,6 +126,14 @@ static char GetFirstChar(Preprocessor &PP, const Token &Tok) { /// don't want to track enough to tell "x.." from "...". bool TokenConcatenation::AvoidConcat(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 + // were an issue, the tokens would have been lexed differently. + if (PrevTok.getLocation().isFileID() && Tok.getLocation().isFileID() && + PrevTok.getLocation().getFileLocWithOffset(PrevTok.getLength()) == + Tok.getLocation()) + return false; + tok::TokenKind PrevKind = PrevTok.getKind(); if (PrevTok.getIdentifierInfo()) // Language keyword or named operator. PrevKind = tok::identifier; |