svn commit: r326776 - in head/contrib/llvm/tools/clang: include/clang/Sema lib/Sema
Dimitry Andric
dim at FreeBSD.org
Mon Dec 11 20:04:41 UTC 2017
Author: dim
Date: Mon Dec 11 20:04:40 2017
New Revision: 326776
URL: https://svnweb.freebsd.org/changeset/base/326776
Log:
Pull in r320396 from upstream clang trunk (by Malcolm Parsons):
[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
This fixes a segfault when building recent audio/zynaddsubfx port
versions.
Reported by: hps
MFC after: 3 days
Modified:
head/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h
head/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
Modified: head/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h Mon Dec 11 20:01:28 2017 (r326775)
+++ head/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h Mon Dec 11 20:04:40 2017 (r326776)
@@ -560,6 +560,7 @@ class CapturingScopeInfo : public FunctionScopeInfo {
void markUsed(bool IsODRUse) { (IsODRUse ? ODRUsed : NonODRUsed) = true; }
VarDecl *getVariable() const {
+ assert(isVariableCapture());
return VarAndNestedAndThis.getPointer();
}
Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp Mon Dec 11 20:01:28 2017 (r326775)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp Mon Dec 11 20:04:40 2017 (r326776)
@@ -1469,6 +1469,9 @@ void Sema::DiagnoseUnusedLambdaCapture(const LambdaSco
if (CaptureHasSideEffects(From))
return;
+ if (From.isVLATypeCapture())
+ return;
+
auto diag = Diag(From.getLocation(), diag::warn_unused_lambda_capture);
if (From.isThisCapture())
diag << "'this'";
More information about the svn-src-all
mailing list