Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Dec 2017 11:39:05 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r326975 - in stable/11/contrib/llvm/tools/clang: include/clang/Sema lib/Sema
Message-ID:  <201712191139.vBJBd5FU075266@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Dec 19 11:39:05 2017
New Revision: 326975
URL: https://svnweb.freebsd.org/changeset/base/326975

Log:
  MFC r326776:
  
  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

Modified:
  stable/11/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h
  stable/11/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h
==============================================================================
--- stable/11/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h	Tue Dec 19 10:06:55 2017	(r326974)
+++ stable/11/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h	Tue Dec 19 11:39:05 2017	(r326975)
@@ -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: stable/11/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp
==============================================================================
--- stable/11/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp	Tue Dec 19 10:06:55 2017	(r326974)
+++ stable/11/contrib/llvm/tools/clang/lib/Sema/SemaLambda.cpp	Tue Dec 19 11:39:05 2017	(r326975)
@@ -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'";



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712191139.vBJBd5FU075266>