summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/HTMLRewrite.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-17 23:03:14 +0000
committerChris Lattner <sabre@nondot.org>2008-04-17 23:03:14 +0000
commit54349c5f4d6daa37ff0f2293505b81aea6825e32 (patch)
tree5fec324d28d743c58dc08c8d15519dcb5d5ce4da /clang/lib/Rewrite/HTMLRewrite.cpp
parent75c895dbc4dcc6083815a1cc6a412b69513b31fa (diff)
downloadbcm5719-llvm-54349c5f4d6daa37ff0f2293505b81aea6825e32.tar.gz
bcm5719-llvm-54349c5f4d6daa37ff0f2293505b81aea6825e32.zip
Fix a problem noticed by Nuno, where we wouldn't escape characters in
macro expansions. llvm-svn: 49877
Diffstat (limited to 'clang/lib/Rewrite/HTMLRewrite.cpp')
-rw-r--r--clang/lib/Rewrite/HTMLRewrite.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp
index ced8e5e9382..ddf6cbeba20 100644
--- a/clang/lib/Rewrite/HTMLRewrite.cpp
+++ b/clang/lib/Rewrite/HTMLRewrite.cpp
@@ -451,11 +451,12 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID,
}
LineLen -= Expansion.size();
- Expansion += ' ' + PP->getSpelling(Tok);
+ // Escape any special characters in the token text.
+ Expansion += ' ' + EscapeText(PP->getSpelling(Tok));
LineLen += Expansion.size();
PP->Lex(Tok);
}
-
+
// Insert the information about the expansion inside the macro span.
Expansion = "<span class='expansion'>" + Expansion + "</span>";
RB.InsertTextBefore(TokOffs+TokLen, Expansion.c_str(), Expansion.size());
OpenPOWER on IntegriCloud