From e75ebf573f7f71e65e7bdfa288254237eb563255 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 11 Jun 2019 17:50:37 +0000 Subject: [PATCH] Remove redundant check for whether a DeclRefExpr that names a capture constitutes an odr-use. We now track this accurately on the DeclRefExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363088 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index c1c9af0ddd..d5ce4870f1 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2463,16 +2463,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. VD->getAnyInitializer(VD); - const auto *BD = dyn_cast_or_null(CurCodeDecl); - if (E->isNonOdrUse() == NOUR_Constant && VD->getType()->isReferenceType() && - // Do not emit if it is private OpenMP variable. - // FIXME: This should be handled in odr-use marking, not here. - !(E->refersToEnclosingVariableOrCapture() && - ((CapturedStmtInfo && - (LocalDeclMap.count(VD->getCanonicalDecl()) || - CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) || - LambdaCaptureFields.lookup(VD->getCanonicalDecl()) || - (BD && BD->capturesVariable(VD))))) { + if (E->isNonOdrUse() == NOUR_Constant && VD->getType()->isReferenceType()) { llvm::Constant *Val = ConstantEmitter(*this).emitAbstract(E->getLocation(), *VD->evaluateValue(), -- 2.40.0