mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-19 08:13:57 +00:00
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
This commit is contained in:
parent
06c47d48dc
commit
9ce629675f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326776
|
@ -560,6 +560,7 @@ class CapturingScopeInfo : public FunctionScopeInfo {
|
||||||
void markUsed(bool IsODRUse) { (IsODRUse ? ODRUsed : NonODRUsed) = true; }
|
void markUsed(bool IsODRUse) { (IsODRUse ? ODRUsed : NonODRUsed) = true; }
|
||||||
|
|
||||||
VarDecl *getVariable() const {
|
VarDecl *getVariable() const {
|
||||||
|
assert(isVariableCapture());
|
||||||
return VarAndNestedAndThis.getPointer();
|
return VarAndNestedAndThis.getPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1469,6 +1469,9 @@ void Sema::DiagnoseUnusedLambdaCapture(const LambdaScopeInfo::Capture &From) {
|
||||||
if (CaptureHasSideEffects(From))
|
if (CaptureHasSideEffects(From))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (From.isVLATypeCapture())
|
||||||
|
return;
|
||||||
|
|
||||||
auto diag = Diag(From.getLocation(), diag::warn_unused_lambda_capture);
|
auto diag = Diag(From.getLocation(), diag::warn_unused_lambda_capture);
|
||||||
if (From.isThisCapture())
|
if (From.isThisCapture())
|
||||||
diag << "'this'";
|
diag << "'this'";
|
||||||
|
|
Loading…
Reference in a new issue