aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-23 23:36:29 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-23 23:36:29 +0000
commit7cae2f64a7aeccedf02289dcd76b21db45b2c49a (patch)
tree4eae44c1e417be7f3e782030ba950cfb74732194 /Driver/clang.cpp
parente22d911dcff7a9c18b583817b7319c07600fd3ee (diff)
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
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 6d3f0b3843..47d422dcbc 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -90,7 +90,8 @@ enum ProgActions {
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 @@ NoCaretDiagnostics("fno-caret-diagnostics",
//===----------------------------------------------------------------------===//
-// 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 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile,
case EmitHTML:
return CreateHTMLPrinter(OutputFile, Diag, PP, PPF);
+ case InheritanceView:
+ return CreateInheritanceViewer(InheritanceViewCls);
+
case TestSerialization:
return CreateSerializationTest(Diag, FileMgr);
@@ -1428,6 +1441,8 @@ int main(int argc, char **argv) {
// 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;