From fe208f5606bc4a82b573ac32db2897616d3abc24 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 29 Aug 2018 17:50:47 +0000 Subject: Vendor import of clang release_70 branch r340910: https://llvm.org/svn/llvm-project/cfe/branches/release_70@340910 --- lib/CodeGen/CGExpr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index f168dd02ead1..93a1859de720 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2408,6 +2408,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { // A DeclRefExpr for a reference initialized by a constant expression can // appear without being odr-used. Directly emit the constant initializer. const Expr *Init = VD->getAnyInitializer(VD); + const auto *BD = dyn_cast_or_null(CurCodeDecl); if (Init && !isa(VD) && VD->getType()->isReferenceType() && VD->isUsableInConstantExpressions(getContext()) && VD->checkInitIsICE() && @@ -2417,7 +2418,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { (LocalDeclMap.count(VD->getCanonicalDecl()) || CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) || LambdaCaptureFields.lookup(VD->getCanonicalDecl()) || - isa(CurCodeDecl)))) { + (BD && BD->capturesVariable(VD))))) { llvm::Constant *Val = ConstantEmitter(*this).emitAbstract(E->getLocation(), *VD->evaluateValue(), -- cgit v1.3