[cfe-commits] r149959 - /cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
Ted Kremenek
kremenek at apple.com
Mon Feb 6 18:26:17 PST 2012
Author: kremenek
Date: Mon Feb 6 20:26:17 2012
New Revision: 149959
URL: http://llvm.org/viewvc/llvm-project?rev=149959&view=rev
Log:
Tweak BugReporter extensive diagnostics to not add edges between function calls.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=149959&r1=149958&r2=149959&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Mon Feb 6 20:26:17 2012
@@ -927,6 +927,12 @@
rawAddEdge(L);
}
+ void flushLocations() {
+ while (!CLocs.empty())
+ popLocation();
+ PrevLoc = PathDiagnosticLocation();
+ }
+
void addEdge(PathDiagnosticLocation NewLoc, bool alwaysAdd = false);
void rawAddEdge(PathDiagnosticLocation NewLoc);
@@ -1132,8 +1138,27 @@
ProgramPoint P = N->getLocation();
do {
+ if (const CallExit *CE = dyn_cast<CallExit>(&P)) {
+ const StackFrameContext *LCtx =
+ CE->getLocationContext()->getCurrentStackFrame();
+ PathDiagnosticLocation Loc(LCtx->getCallSite(),
+ PDB.getSourceManager(),
+ LCtx);
+ EB.addEdge(Loc, true);
+ EB.flushLocations();
+ break;
+ }
+
+ // Was the predecessor in a different stack frame?
+ if (NextNode &&
+ !isa<CallExit>(NextNode->getLocation()) &&
+ NextNode->getLocationContext()->getCurrentStackFrame() !=
+ N->getLocationContext()->getCurrentStackFrame()) {
+ EB.flushLocations();
+ }
+
// Block edges.
- if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
+ if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
const CFGBlock &Blk = *BE->getSrc();
const Stmt *Term = Blk.getTerminator();
@@ -1182,6 +1207,8 @@
break;
}
+
+
} while (0);
if (!NextNode)
More information about the cfe-commits
mailing list