summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXComment.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-08-01 00:21:12 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-08-01 00:21:12 +0000
commit7c0456f91bee931f70bc3caa44102ebb2f8f610b (patch)
tree92aca9210b6421c98ca95c9493dd39b43d817fca /clang/tools/libclang/CXComment.cpp
parent88d76cfd7ad87600c302ca61a2d9e610b5523c6e (diff)
downloadbcm5719-llvm-7c0456f91bee931f70bc3caa44102ebb2f8f610b.tar.gz
bcm5719-llvm-7c0456f91bee931f70bc3caa44102ebb2f8f610b.zip
Comment to HTML conversion: escape HTML special characters in command arguments
llvm-svn: 161094
Diffstat (limited to 'clang/tools/libclang/CXComment.cpp')
-rw-r--r--clang/tools/libclang/CXComment.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/clang/tools/libclang/CXComment.cpp b/clang/tools/libclang/CXComment.cpp
index 9bdab619422..0d971c390a3 100644
--- a/clang/tools/libclang/CXComment.cpp
+++ b/clang/tools/libclang/CXComment.cpp
@@ -450,21 +450,29 @@ void CommentASTToHTMLConverter::visitInlineCommandComment(
switch (C->getRenderKind()) {
case InlineCommandComment::RenderNormal:
- for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
- Result << C->getArgText(i) << " ";
+ for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i) {
+ appendToResultWithHTMLEscaping(C->getArgText(i));
+ Result << " ";
+ }
return;
case InlineCommandComment::RenderBold:
assert(C->getNumArgs() == 1);
- Result << "<b>" << Arg0 << "</b>";
+ Result << "<b>";
+ appendToResultWithHTMLEscaping(Arg0);
+ Result << "</b>";
return;
case InlineCommandComment::RenderMonospaced:
assert(C->getNumArgs() == 1);
- Result << "<tt>" << Arg0 << "</tt>";
+ Result << "<tt>";
+ appendToResultWithHTMLEscaping(Arg0);
+ Result<< "</tt>";
return;
case InlineCommandComment::RenderEmphasized:
assert(C->getNumArgs() == 1);
- Result << "<em>" << Arg0 << "</em>";
+ Result << "<em>";
+ appendToResultWithHTMLEscaping(Arg0);
+ Result << "</em>";
return;
}
}
@@ -537,7 +545,8 @@ void CommentASTToHTMLConverter::visitParamCommandComment(
} else
Result << "<dt class=\"param-name-index-invalid\">";
- Result << C->getParamName() << "</dt>";
+ appendToResultWithHTMLEscaping(C->getParamName());
+ Result << "</dt>";
if (C->isParamIndexValid()) {
Result << "<dd class=\"param-descr-index-"
@@ -562,7 +571,8 @@ void CommentASTToHTMLConverter::visitTParamCommandComment(
} else
Result << "<dt class=\"tparam-name-index-invalid\">";
- Result << C->getParamName() << "</dt>";
+ appendToResultWithHTMLEscaping(C->getParamName());
+ Result << "</dt>";
if (C->isPositionValid()) {
if (C->getDepth() == 1)
OpenPOWER on IntegriCloud