Added CFG infrastructure (CFG.cpp and CFG.h) for clang ASTs.

Added builder code to translate ASTs to CFGs.  This currently supports
if, return, and non-control flow statements.

Added pretty-printer to debug CFGs.

Added a "-dump-cfg" option to the clang driver to dump CFGs for code
sent through the frontend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41252 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 2ee8a93..d284434 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -52,6 +52,7 @@
   ParseASTDump,                 // Parse ASTs and dump them.
   ParseASTCheck,                // Parse ASTs and check diagnostics.
   ParseAST,                     // Parse ASTs.
+  ParseCFGDump,                 // Parse ASTS. Build CFGs. Print CFGs.
   ParsePrintCallbacks,          // Parse and print each callback.
   ParseSyntaxOnly,              // Parse and perform semantic analysis.
   ParseNoop,                    // Parse with noop callbacks.
@@ -84,6 +85,8 @@
                         "Run parser, build ASTs, then dump them"),
              clEnumValN(ParseASTCheck, "parse-ast-check",
                         "Run parser, build ASTs, then check diagnostics"),
+             clEnumValN(ParseCFGDump, "dump-cfg",
+                        "Run parser, build ASTs, then build and print CFGs."),
              clEnumValN(EmitLLVM, "emit-llvm",
                         "Build ASTs then convert to LLVM, emit .ll file"),
              clEnumValEnd));
@@ -825,6 +828,9 @@
   case ParseASTDump:
     DumpASTs(PP, MainFileID, Stats);
     break;
+  case ParseCFGDump:
+    DumpCFGs(PP, MainFileID, Stats);
+    break;
   case EmitLLVM:
     EmitLLVMFromASTs(PP, MainFileID, Stats);
     break;