From f35142413974e9dfe2c5f202084db4bd1c2073e9 Mon Sep 17 00:00:00 2001 From: John McCall Date: Wed, 24 Nov 2010 11:21:45 +0000 Subject: Add -cc1 -ast-dump-xml, an excessively detailed XML dump of the internals of the ASTs. Only available in assertions builds. No stability guarantee. This is intended solely as a debugging tool. I'm not sure if the goals are sufficiently aligned with the XML printer to allow a common implementation. Currently just falls back on the StmtDumper to display statements, which means it doesn't produce valid XML in those cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120088 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/FrontendActions.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/Frontend/FrontendActions.cpp') diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index d18baaa7e1..0ffc06a477 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -59,6 +59,17 @@ ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI, return CreateASTDumper(); } +ASTConsumer *ASTDumpXMLAction::CreateASTConsumer(CompilerInstance &CI, + llvm::StringRef InFile) { + llvm::raw_ostream *OS; + if (CI.getFrontendOpts().OutputFile.empty()) + OS = &llvm::outs(); + else + OS = CI.createDefaultOutputFile(false, InFile); + if (!OS) return 0; + return CreateASTDumperXML(*OS); +} + ASTConsumer *ASTViewAction::CreateASTConsumer(CompilerInstance &CI, llvm::StringRef InFile) { return CreateASTViewer(); -- cgit v1.2.3-18-g5258