Added support to clang driver to view ASTs using GraphViz. This
functionality is still preliminary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42152 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index aca94f7..48e1c42 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -52,8 +52,9 @@
EmitLLVM, // Emit a .ll file.
ParseASTPrint, // Parse ASTs and print them.
ParseASTDump, // Parse ASTs and dump them.
+ ParseASTView, // Parse ASTs and view them in Graphviz.
ParseASTCheck, // Parse ASTs and check diagnostics.
- BuildAST, // Parse ASTs.
+ BuildAST, // Parse ASTs.
ParseCFGDump, // Parse ASTS. Build CFGs. Print CFGs.
ParseCFGView, // Parse ASTS. Build CFGs. View CFGs.
AnalysisLiveVariables, // Print results of live-variable analysis.
@@ -89,6 +90,8 @@
"Run parser, build ASTs, then print ASTs"),
clEnumValN(ParseASTDump, "parse-ast-dump",
"Run parser, build ASTs, then dump them"),
+ clEnumValN(ParseASTView, "parse-ast-view",
+ "Run parser, build ASTs, and view them with GraphViz."),
clEnumValN(ParseASTCheck, "parse-ast-check",
"Run parser, build ASTs, then check diagnostics"),
clEnumValN(ParseCFGDump, "dump-cfg",
@@ -857,6 +860,11 @@
ParseAST(PP, MainFileID, *C.get(), Stats);
break;
}
+ case ParseASTView: {
+ std::auto_ptr<ASTConsumer> C(CreateASTViewer());
+ ParseAST(PP, MainFileID, *C.get(), Stats);
+ break;
+ }
case ParseCFGDump:
case ParseCFGView: {
std::auto_ptr<ASTConsumer> C(CreateCFGDumper(ProgAction == ParseCFGView));