diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-09-19 21:29:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-09-19 21:29:43 +0000 |
commit | 80de08fc6f7ebfee07b1b2c520c99e31c3243365 (patch) | |
tree | e8ca70240dc740a2b152e46f137cb6e54bc7989a /Driver/clang.cpp | |
parent | d2a4a1af1088fca80e2dc76eb3369db0fbbfdefd (diff) |
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
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r-- | Driver/clang.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index aca94f711d..48e1c42dac 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -52,8 +52,9 @@ enum ProgActions { 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 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore, "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 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID, 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)); |