aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/DocumentXML.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-05-12 23:27:11 +0000
committerChris Lattner <sabre@nondot.org>2010-05-12 23:27:11 +0000
commitedd8df9cd260a74cfeea3c921a78d5f33c659573 (patch)
tree4de0d5468c65e9e235d603853e5c6c04dba1a6fb /include/clang/Frontend/DocumentXML.h
parentface9818b52a6d47e4aa055a4bfcd435aed6010f (diff)
"this patch properly addresses escaping < and > which might appear
(e.g. for C++ operators) in the xml dump. I also re-enabled the unit test for ast-print-xml (or so I think) at least, make test didn't fail..." patch by Sebastien Binet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103671 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/DocumentXML.h')
-rw-r--r--include/clang/Frontend/DocumentXML.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/clang/Frontend/DocumentXML.h b/include/clang/Frontend/DocumentXML.h
index 5227c12c2c..73d892105f 100644
--- a/include/clang/Frontend/DocumentXML.h
+++ b/include/clang/Frontend/DocumentXML.h
@@ -146,12 +146,23 @@ inline void DocumentXML::initialize(ASTContext &Context) {
//---------------------------------------------------------
template<class T>
inline void DocumentXML::addAttribute(const char* pName, const T& value) {
- Out << ' ' << pName << "=\"" << value << "\"";
+ std::string repr;
+ {
+ llvm::raw_string_ostream buf(repr);
+ buf << value;
+ buf.flush();
+ }
+
+ Out << ' ' << pName << "=\""
+ << DocumentXML::escapeString(repr.c_str(), repr.size())
+ << "\"";
}
//---------------------------------------------------------
inline void DocumentXML::addPtrAttribute(const char* pName, const char* text) {
- Out << ' ' << pName << "=\"" << text << "\"";
+ Out << ' ' << pName << "=\""
+ << DocumentXML::escapeString(text, strlen(text))
+ << "\"";
}
//---------------------------------------------------------