summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/HTMLRewrite.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-14 03:57:19 +0000
committerChris Lattner <sabre@nondot.org>2010-04-14 03:57:19 +0000
commit0384e6350139e10071da2525b80788e469eff515 (patch)
tree55c0072f3394e55c0696bd01410f0f6c9cc07705 /clang/lib/Rewrite/HTMLRewrite.cpp
parentdad4062b4dd78a3c1fb6b6da08bcda4a77b4ff48 (diff)
downloadbcm5719-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/Rewrite/HTMLRewrite.cpp')
-rw-r--r--clang/lib/Rewrite/HTMLRewrite.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp
index 7b78070a27f..5fe064990e9 100644
--- a/clang/lib/Rewrite/HTMLRewrite.cpp
+++ b/clang/lib/Rewrite/HTMLRewrite.cpp
@@ -533,6 +533,7 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) {
std::string Expansion = EscapeText(TmpPP.getSpelling(Tok));
unsigned LineLen = Expansion.size();
+ Token PrevPrevTok;
Token PrevTok = Tok;
// Okay, eat this token, getting the next one.
TmpPP.Lex(Tok);
@@ -553,13 +554,14 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) {
// If the tokens were already space separated, or if they must be to avoid
// them being implicitly pasted, add a space between them.
if (Tok.hasLeadingSpace() ||
- ConcatInfo.AvoidConcat(PrevTok, Tok))
+ ConcatInfo.AvoidConcat(PrevPrevTok, PrevTok, Tok))
Expansion += ' ';
// Escape any special characters in the token text.
Expansion += EscapeText(TmpPP.getSpelling(Tok));
LineLen += Expansion.size();
+ PrevPrevTok = PrevTok;
PrevTok = Tok;
TmpPP.Lex(Tok);
}
OpenPOWER on IntegriCloud