From owner-svn-src-head@freebsd.org Mon Dec 11 20:04:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACF0FE9CC6F; Mon, 11 Dec 2017 20:04:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 580607663E; Mon, 11 Dec 2017 20:04:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBBK4ep7026673; Mon, 11 Dec 2017 20:04:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBBK4e0a026671; Mon, 11 Dec 2017 20:04:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712112004.vBBK4e0a026671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 11 Dec 2017 20:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326776 - in head/contrib/llvm/tools/clang: include/clang/Sema lib/Sema X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm/tools/clang: include/clang/Sema lib/Sema X-SVN-Commit-Revision: 326776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 20:04:41 -0000 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'";