From owner-svn-src-all@freebsd.org Tue Dec 19 11:39:07 2017 Return-Path: Delivered-To: svn-src-all@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 26779EA1C98; Tue, 19 Dec 2017 11:39:07 +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 E4EC774166; Tue, 19 Dec 2017 11:39:06 +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 vBJBd5dY075268; Tue, 19 Dec 2017 11:39:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJBd5FU075266; Tue, 19 Dec 2017 11:39:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712191139.vBJBd5FU075266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 19 Dec 2017 11:39:05 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11/contrib/llvm/tools/clang: include/clang/Sema lib/Sema X-SVN-Commit-Revision: 326975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2017 11:39:07 -0000 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'";