summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorMalcolm Parsons <malcolm.parsons@gmail.com>2017-12-11 18:00:36 +0000
committerMalcolm Parsons <malcolm.parsons@gmail.com>2017-12-11 18:00:36 +0000
commitd900a0c4e2ac0db549985b959d06b24cf81ca438 (patch)
treef0e19d451a3f34e47f893ed4b57e330298bf8dd2 /clang/lib
parentdbe6c45fcd692e8511a4c72f8d93ca875f446f40 (diff)
downloadbcm5719-llvm-d900a0c4e2ac0db549985b959d06b24cf81ca438.tar.gz
bcm5719-llvm-d900a0c4e2ac0db549985b959d06b24cf81ca438.zip
[Sema] Fix crash in unused-lambda-capture warning for VLAs
Summary: Clang was crashing when diagnosing an unused-lambda-capture for a VLA because From.getVariable() is null for the capture of a VLA bound. Warning about the VLA bound capture is not helpful, so only warn for the VLA itself. Fixes: PR35555 Reviewers: aaron.ballman, dim, rsmith Reviewed By: aaron.ballman, dim Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41016 llvm-svn: 320396
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaLambda.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 5254fea28f9..cbfc330ca60 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -1481,6 +1481,9 @@ void Sema::DiagnoseUnusedLambdaCapture(const LambdaScopeInfo::Capture &From) {
if (CaptureHasSideEffects(From))
return;
+ if (From.isVLATypeCapture())
+ return;
+
auto diag = Diag(From.getLocation(), diag::warn_unused_lambda_capture);
if (From.isThisCapture())
diag << "'this'";
OpenPOWER on IntegriCloud