diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-03-07 22:58:01 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-03-07 22:58:01 +0000 |
| commit | 2bdd77696e552f9188328e8645ce1319c83a42ed (patch) | |
| tree | b0016085d9e475d7b0a8dabad06dde237243e418 /clang/Driver | |
| parent | 4e97e94809b8e9205e5aa38a772b3ac5aedacbea (diff) | |
| download | bcm5719-llvm-2bdd77696e552f9188328e8645ce1319c83a42ed.tar.gz bcm5719-llvm-2bdd77696e552f9188328e8645ce1319c83a42ed.zip | |
Added --trim-path-graph to the driver to trim paths from the ExplodedGraph
that are not related to error nodes.
Fixed bug where we did not detect some NULL dereferences.
Added "ExplodedGraph::Trim" to trim all nodes that cannot transitively reach
a set of provided nodes.
Fixed subtle bug in ExplodedNodeImpl where we could create predecessor
iterators that included the mangled "sink" bit. The better fix is to integrate
this bit into the void* for the wrapped State, not the NodeGroups representing
a node's predecessors and successors.
llvm-svn: 48036
Diffstat (limited to 'clang/Driver')
| -rw-r--r-- | clang/Driver/ASTConsumers.cpp | 13 | ||||
| -rw-r--r-- | clang/Driver/ASTConsumers.h | 2 | ||||
| -rw-r--r-- | clang/Driver/clang.cpp | 7 |
3 files changed, 14 insertions, 8 deletions
diff --git a/clang/Driver/ASTConsumers.cpp b/clang/Driver/ASTConsumers.cpp index f8fbdc91730..a24cd0478e0 100644 --- a/clang/Driver/ASTConsumers.cpp +++ b/clang/Driver/ASTConsumers.cpp @@ -593,10 +593,11 @@ namespace { Diagnostic &Diags; ASTContext* Ctx; bool Visualize; + bool TrimGraph; public: GRSimpleValsVisitor(Diagnostic &diags, const std::string& fname, - bool visualize) - : CFGVisitor(fname), Diags(diags), Visualize(visualize) {} + bool visualize, bool trim) + : CFGVisitor(fname), Diags(diags), Visualize(visualize), TrimGraph(trim){} virtual void Initialize(ASTContext &Context) { Ctx = &Context; } virtual void VisitCFG(CFG& C, FunctionDecl&); @@ -606,9 +607,9 @@ namespace { ASTConsumer* clang::CreateGRSimpleVals(Diagnostic &Diags, const std::string& FunctionName, - bool Visualize) { + bool Visualize, bool TrimGraph) { - return new GRSimpleValsVisitor(Diags, FunctionName, Visualize); + return new GRSimpleValsVisitor(Diags, FunctionName, Visualize, TrimGraph); } void GRSimpleValsVisitor::VisitCFG(CFG& C, FunctionDecl& FD) { @@ -626,13 +627,13 @@ void GRSimpleValsVisitor::VisitCFG(CFG& C, FunctionDecl& FD) { llvm::Timer T("GRSimpleVals"); T.startTimer(); - unsigned size = RunGRSimpleVals(C, FD, *Ctx, Diags, Visualize); + unsigned size = RunGRSimpleVals(C, FD, *Ctx, Diags, false, false); T.stopTimer(); llvm::cerr << size << ' ' << T.getWallTime() << '\n'; } else { llvm::cerr << '\n'; - RunGRSimpleVals(C, FD, *Ctx, Diags, Visualize); + RunGRSimpleVals(C, FD, *Ctx, Diags, Visualize, TrimGraph); } } diff --git a/clang/Driver/ASTConsumers.h b/clang/Driver/ASTConsumers.h index 3d2f9495fa0..63f769f06a3 100644 --- a/clang/Driver/ASTConsumers.h +++ b/clang/Driver/ASTConsumers.h @@ -44,7 +44,7 @@ ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags); ASTConsumer *CreateGRSimpleVals(Diagnostic &Diags, const std::string& Function, - bool Visualize = false); + bool Visualize = false, bool TrimGraph = false); ASTConsumer* CreateCFRefChecker(Diagnostic &Diags, const std::string& FunctionName); diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp index 216e669ccca..68070759129 100644 --- a/clang/Driver/clang.cpp +++ b/clang/Driver/clang.cpp @@ -461,6 +461,11 @@ static llvm::cl::opt<std::string> AnalyzeSpecificFunction("analyze-function", llvm::cl::desc("Run analysis on specific function.")); +static llvm::cl::opt<bool> +TrimGraph("trim-path-graph", + llvm::cl::desc("Only show error-related paths in the analysis graph.")); + + //===----------------------------------------------------------------------===// // Target Triple Processing. //===----------------------------------------------------------------------===// @@ -1039,7 +1044,7 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile, return CreateGRSimpleVals(Diag, AnalyzeSpecificFunction); case AnalysisGRSimpleValsView: - return CreateGRSimpleVals(Diag, AnalyzeSpecificFunction, true); + return CreateGRSimpleVals(Diag, AnalyzeSpecificFunction, true, TrimGraph); case CheckerCFRef: return CreateCFRefChecker(Diag, AnalyzeSpecificFunction); |

