summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-02-02 02:19:43 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-02-02 02:19:43 +0000
commitfb4acffbd11a213addb32ab13658a5ab36567486 (patch)
treec4bc0dc4d6895cbd72bdd4a1be239b9f404a0bb2 /clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
parent572f6cecf1c835c71f8df0c2e7fbe44b0f11953a (diff)
downloadbcm5719-llvm-fb4acffbd11a213addb32ab13658a5ab36567486.tar.gz
bcm5719-llvm-fb4acffbd11a213addb32ab13658a5ab36567486.zip
[analyzer] Expose return statement from CallExit program point
If the return statement is stored, we might as well allow querying against it. Also fix the bug where the return statement is not stored if there is no return value. This change un-merges two ExplodedNodes during call exit when the state is otherwise identical - the CallExitBegin node itself and the "Bind Return Value"-tagged node. And expose the return statement through getStatement helper function. Differential Revision: https://reviews.llvm.org/D42130 llvm-svn: 324052
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
index 2b041241623..3d4b377627f 100644
--- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
+++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
@@ -742,6 +742,8 @@ const Stmt *PathDiagnosticLocation::getStmt(const ExplodedNode *N) {
return CEE->getCalleeContext()->getCallSite();
if (Optional<PostInitializer> PIPP = P.getAs<PostInitializer>())
return PIPP->getInitializer()->getInit();
+ if (Optional<CallExitBegin> CEB = P.getAs<CallExitBegin>())
+ return CEB->getReturnStmt();
return nullptr;
}
OpenPOWER on IntegriCloud