diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-05-30 21:30:17 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-05-30 21:30:17 +0000 |
commit | ca0ecb61e18b88a1f45b30b0bbba22384837c381 (patch) | |
tree | dd49c7fb1f2f05af4b795ead29f2d7708f931d47 /clang/lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | 503276be05be067a707bc7004ef3596a620072f2 (diff) | |
download | bcm5719-llvm-ca0ecb61e18b88a1f45b30b0bbba22384837c381.tar.gz bcm5719-llvm-ca0ecb61e18b88a1f45b30b0bbba22384837c381.zip |
Revert "[analyzer; alternate edges] don't add an edge incoming from the start of a function"
...and make this work correctly in the current codebase.
After living on this for a while, it turns out to look very strange for
inlined functions that have only a single statement, and somewhat strange
for inlined functions in general (since they are still conceptually in the
middle of the path, and there is a function-entry path note).
It's worth noting that this only affects inlined functions; in the new
arrow generation algorithm, the top-level function still starts at the
first real statement in the function body, not the enclosing CompoundStmt.
This reverts r182078 / dbfa950abe0e55b173286a306ee620eff5f72ea.
llvm-svn: 182963
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index fe830183fbb..2fb1a26cc2a 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1557,7 +1557,7 @@ static void addEdgeToPath(PathPieces &path, if (NewLocL.isInvalid() || NewLocL.isMacroID()) return; - if (!PrevLoc.isValid()) { + if (!PrevLoc.isValid() || !PrevLoc.asLocation().isValid()) { PrevLoc = NewLoc; return; } @@ -1608,6 +1608,13 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, // call exit before this point. This means that the path // terminated within the call itself. if (Optional<CallEnter> CE = P.getAs<CallEnter>()) { + // Add an edge to the start of the function. + const StackFrameContext *CalleeLC = CE->getCalleeContext(); + const Decl *D = CalleeLC->getDecl(); + addEdgeToPath(PD.getActivePath(), PrevLoc, + PathDiagnosticLocation::createBegin(D, SM), + CalleeLC); + // Did we visit an entire call? bool VisitedEntireCall = PD.isWithinCall(); PD.popActivePath(); |