aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/DocumentXML.h
diff options
context:
space:
mode:
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))
+ << "\"";
}
//---------------------------------------------------------