diff options
-rw-r--r-- | include/clang/Frontend/DocumentXML.h | 15 | ||||
-rw-r--r-- | lib/Frontend/DeclXML.cpp | 3 | ||||
-rw-r--r-- | test/Coverage/ast-printing.cpp | 2 |
3 files changed, 16 insertions, 4 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)) + << "\""; } //--------------------------------------------------------- diff --git a/lib/Frontend/DeclXML.cpp b/lib/Frontend/DeclXML.cpp index 3ae25f9b7d..97a7f55583 100644 --- a/lib/Frontend/DeclXML.cpp +++ b/lib/Frontend/DeclXML.cpp @@ -49,7 +49,8 @@ class DocumentXML::DeclPrinter : public DeclVisitor<DocumentXML::DeclPrinter> { addSubNodes(cast<RecordDecl>(RD)); if (RD->isDefinition()) { - Doc.addAttribute("num_bases", RD->getNumBases()); + // FIXME: This breaks XML generation + //Doc.addAttribute("num_bases", RD->getNumBases()); for (CXXRecordDecl::base_class_iterator base = RD->bases_begin(), diff --git a/test/Coverage/ast-printing.cpp b/test/Coverage/ast-printing.cpp index 1a75fb4c63..0de5642289 100644 --- a/test/Coverage/ast-printing.cpp +++ b/test/Coverage/ast-printing.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only %s // RUN: %clang_cc1 -ast-print %s // RUN: %clang_cc1 -ast-dump %s -// FIXME: %clang_cc1 -ast-print-xml -o %t %s +// RUN: %clang_cc1 -ast-print-xml -o %t %s // RUN: %clang_cc1 -print-decl-contexts %s // RUN: %clang_cc1 -fdump-record-layouts %s |