summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-04-27 21:27:54 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-04-27 21:27:54 +0000
commitc38498f0469aba6a0fb63d99ad398cdf788c5696 (patch)
treeed7df3fc6de1b03134e8350a770ac565f5824b60 /clang/lib/Analysis
parent5b395243132dc3463c23daea1f215237565ce85f (diff)
downloadbcm5719-llvm-c38498f0469aba6a0fb63d99ad398cdf788c5696.tar.gz
bcm5719-llvm-c38498f0469aba6a0fb63d99ad398cdf788c5696.zip
PR23334: Perform semantic checking of lambda capture initialization in the right context.
Previously we'd try to perform checks on the captures from the middle of parsing the lambda's body, at the point where we detected that a variable needed to be captured. This was wrong in a number of subtle ways. In PR23334, we couldn't correctly handle the list of potential odr-uses resulting from the capture, and our attempt to recover from that resulted in a use-after-free. We now defer building the initialization expression until we leave the lambda body and return to the enclosing context, where the initialization does the right thing. This patch only covers lambda-expressions, but we should apply the same change to blocks and captured statements too. llvm-svn: 235921
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/UninitializedValues.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index 3c7bc4ea297..f2f791957aa 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -36,7 +36,7 @@ using namespace clang;
static bool isTrackedVar(const VarDecl *vd, const DeclContext *dc) {
if (vd->isLocalVarDecl() && !vd->hasGlobalStorage() &&
!vd->isExceptionVariable() && !vd->isInitCapture() &&
- vd->getDeclContext() == dc) {
+ !vd->isImplicit() && vd->getDeclContext() == dc) {
QualType ty = vd->getType();
return ty->isScalarType() || ty->isVectorType() || ty->isRecordType();
}
OpenPOWER on IntegriCloud