AST XML dump, from Olaf Krzikalla!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72224 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 95a704b..f2f0523 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -194,6 +194,7 @@
EmitLLVMOnly, // Generate LLVM IR, but do not
EmitHTML, // Translate input source into HTML.
ASTPrint, // Parse ASTs and print them.
+ ASTPrintXML, // Parse ASTs and print them in XML.
ASTDump, // Parse ASTs and dump them.
ASTDumpFull, // Parse ASTs and dump them, including the
// contents of a PCH file.
@@ -236,6 +237,8 @@
"Output input source as HTML"),
clEnumValN(ASTPrint, "ast-print",
"Build ASTs and then pretty-print them"),
+ clEnumValN(ASTPrintXML, "ast-print-xml",
+ "Build ASTs and then print them in XML format"),
clEnumValN(ASTDump, "ast-dump",
"Build ASTs and then debug dump them"),
clEnumValN(ASTDumpFull, "ast-dump-full",
@@ -1755,6 +1758,11 @@
Consumer.reset(CreateASTPrinter(OS.get()));
break;
+ case ASTPrintXML:
+ OS.reset(ComputeOutFile(InFile, "xml", false, OutPath));
+ Consumer.reset(CreateASTPrinterXML(OS.get()));
+ break;
+
case ASTDump:
Consumer.reset(CreateASTDumper(false));
break;