[cfe-commits] r68217 - /cfe/trunk/lib/Analysis/BugReporter.cpp
Ted Kremenek
kremenek at apple.com
Wed Apr 1 10:52:28 PDT 2009
Author: kremenek
Date: Wed Apr 1 12:52:26 2009
New Revision: 68217
URL: http://llvm.org/viewvc/llvm-project?rev=68217&view=rev
Log:
BugReporter: for extensive PathDiagnostic generation, add control-flow from the
start of the function/method.
Modified:
cfe/trunk/lib/Analysis/BugReporter.cpp
Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=68217&r1=68216&r2=68217&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Wed Apr 1 12:52:26 2009
@@ -148,6 +148,14 @@
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 @@
// 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 @@
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;
More information about the cfe-commits
mailing list