Added driver option "-cxx-inheritance-view" for viewing the C++ hierarchy of a class in GraphViz.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58051 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 6d3f0b3..47d422d 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -90,7 +90,8 @@
   DumpTokens,                   // Dump out preprocessed tokens.
   DumpRawTokens,                // Dump out raw tokens.
   RunAnalysis,                  // Run one or more source code analyses. 
-  GeneratePCH                   // Generate precompiled header.
+  GeneratePCH,                  // Generate precompiled header.
+  InheritanceView               // View C++ inheritance for a specified class.
 };
 
 static llvm::cl::opt<ProgActions> 
@@ -176,7 +177,16 @@
 
 
 //===----------------------------------------------------------------------===//
-// Analyzer Options
+// C++ Visualization.
+//===----------------------------------------------------------------------===//
+
+static llvm::cl::opt<std::string>
+InheritanceViewCls("cxx-inheritance-view",
+                   llvm::cl::value_desc("class name"),
+                   llvm::cl::desc("View C++ inhertance for a specified class"));
+
+//===----------------------------------------------------------------------===//
+// Analyzer Options.
 //===----------------------------------------------------------------------===//
 
 static llvm::cl::opt<bool>
@@ -1143,6 +1153,9 @@
     case EmitHTML:
       return CreateHTMLPrinter(OutputFile, Diag, PP, PPF);
 
+    case InheritanceView:
+      return CreateInheritanceViewer(InheritanceViewCls);
+      
     case TestSerialization:
       return CreateSerializationTest(Diag, FileMgr);
       
@@ -1428,6 +1441,8 @@
   // Are we invoking one or more source analyses?
   if (!AnalysisList.empty() && ProgAction == ParseSyntaxOnly)
     ProgAction = RunAnalysis;  
+  else if (!InheritanceViewCls.empty())  // C++ visualization?
+    ProgAction = InheritanceView;
     
   llvm::OwningPtr<SourceManager> SourceMgr;