diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-01 17:52:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-01 17:52:26 +0000 |
commit | 51a735c23d3ff57c980a99f242c9729692d19f07 (patch) | |
tree | bf70c66d1dd160e497ea411d5b66145545b27453 /lib/Analysis/BugReporter.cpp | |
parent | c3f83ad7adaff2623986aa1c3e57833babd03d50 (diff) |
BugReporter: for extensive PathDiagnostic generation, add control-flow from the
start of the function/method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index c8f54c0410..f4a7ff1aee 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -148,6 +148,14 @@ public: return getParentMap().getParent(S); } + const CFG& getCFG() { + return *BR.getCFG(); + } + + const Decl& getCodeDecl() { + return BR.getStateManager().getCodeDecl(); + } + ExplodedGraph<GRState>& getGraph() { return *ReportGraph; } NodeMapClosure& getNodeMapClosure() { return NMC; } ASTContext& getContext() { return BR.getContext(); } @@ -830,6 +838,14 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD, // Block edges. if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) { const CFGBlock &Blk = *BE->getSrc(); + + // Add a special edge for the entrance into the function/method. + if (&Blk == &PDB.getCFG().getEntry()) { + FullSourceLoc L = FullSourceLoc(PDB.getCodeDecl().getLocation(), SMgr); + GenExtAddEdge(PD, PDB, L.getSpellingLoc(), PrevLoc); + continue; + } + if (const Stmt *Term = Blk.getTerminator()) { const Stmt *Cond = Blk.getTerminatorCondition(); @@ -859,7 +875,7 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD, if (const Stmt* S = BE->getFirstStmt()) { if (!IsControlFlowExpr(S) && !IsNestedDeclStmt(S, PDB.getParentMap())) { if (PrevLoc.isValid()) { - // Are we jumping with the same enclosing statement? + // Are we jumping within the same enclosing statement? if (PDB.getEnclosingStmtLocation(S) == PDB.getEnclosingStmtLocation(PrevLoc)) continue; |