diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-14 03:57:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-14 03:57:19 +0000 |
commit | 0384e6350139e10071da2525b80788e469eff515 (patch) | |
tree | 55c0072f3394e55c0696bd01410f0f6c9cc07705 /clang/lib/Frontend/PrintPreprocessedOutput.cpp | |
parent | dad4062b4dd78a3c1fb6b6da08bcda4a77b4ff48 (diff) | |
download | bcm5719-llvm-0384e6350139e10071da2525b80788e469eff515.tar.gz bcm5719-llvm-0384e6350139e10071da2525b80788e469eff515.zip |
make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."
when avoiding paste. Patch by David Peixotto!
llvm-svn: 101218
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index a64f6e7c0c6..b4718e9ad49 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -125,8 +125,9 @@ public: } bool MoveToLine(unsigned LineNo); - bool AvoidConcat(const Token &PrevTok, const Token &Tok) { - return ConcatInfo.AvoidConcat(PrevTok, Tok); + bool AvoidConcat(const Token &PrevPrevTok, const Token &PrevTok, + const Token &Tok) { + return ConcatInfo.AvoidConcat(PrevPrevTok, PrevTok, Tok); } void WriteLineInfo(unsigned LineNo, const char *Extra=0, unsigned ExtraLen=0); @@ -396,6 +397,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, PrintPPOutputPPCallbacks *Callbacks, llvm::raw_ostream &OS) { char Buffer[256]; + Token PrevPrevTok; Token PrevTok; while (1) { @@ -407,7 +409,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, // useful to look at and no concatenation could happen anyway. (Callbacks->hasEmittedTokensOnThisLine() && // Don't print "-" next to "-", it would form "--". - Callbacks->AvoidConcat(PrevTok, Tok))) { + Callbacks->AvoidConcat(PrevPrevTok, PrevTok, Tok))) { OS << ' '; } @@ -438,6 +440,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, if (Tok.is(tok::eof)) break; + PrevPrevTok = PrevTok; PrevTok = Tok; PP.Lex(Tok); } |