diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-02-07 02:26:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-02-07 02:26:17 +0000 |
commit | 5de4fdb8de700f95b0b863a9e5a4a508de17a034 (patch) | |
tree | e371acdaae6bee287d6b5266780bf82494bd3a73 | |
parent | b9201d2d138dca631cdc43f8e57d9e9e6248c25c (diff) |
Tweak BugReporter extensive diagnostics to not add edges between function calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149959 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/StaticAnalyzer/Core/BugReporter.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 5101827d71..299fad1478 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -927,6 +927,12 @@ public: 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 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD, 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 @@ static void GenerateExtensivePathDiagnostic(PathDiagnostic& PD, break; } + + } while (0); if (!NextNode) |