diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-05-07 22:33:13 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-05-07 22:33:13 +0000 |
commit | b3fc9df481906703f545c945f098064fc9d3b2ee (patch) | |
tree | f415188b0d31ec5969418c1227f40dd98ddbe5cc /clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | |
parent | 2e977c083ca4e0a25cc3c4c4e9ce44963674ca92 (diff) | |
download | bcm5719-llvm-b3fc9df481906703f545c945f098064fc9d3b2ee.tar.gz bcm5719-llvm-b3fc9df481906703f545c945f098064fc9d3b2ee.zip |
[analyzer] Fix a crash when doing RVO from within blocks.
When looking for the location context of the call site, unwrap block invocation
contexts because they are attached to the current AnalysisDeclContext
while what we need is the previous AnalysisDeclContext.
Differential Revision: https://reviews.llvm.org/D61545
llvm-svn: 360202
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp index aaab01f98c2..62699fb3186 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp @@ -196,6 +196,12 @@ std::pair<ProgramStateRef, SVal> ExprEngine::prepareForObjectConstruction( // able to find construction context at all. break; } + if (isa<BlockInvocationContext>(CallerLCtx)) { + // Unwrap block invocation contexts. They're mostly part of + // the current stack frame. + CallerLCtx = CallerLCtx->getParent(); + assert(!isa<BlockInvocationContext>(CallerLCtx)); + } return prepareForObjectConstruction( cast<Expr>(SFC->getCallSite()), State, CallerLCtx, RTC->getConstructionContext(), CallOpts); |