]> granicus.if.org Git - clang/commitdiff
Remove redundant check for whether a DeclRefExpr that names a capture
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 11 Jun 2019 17:50:37 +0000 (17:50 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 11 Jun 2019 17:50:37 +0000 (17:50 +0000)
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

index c1c9af0ddd29edd7476a54d394679a27be7de8f3..d5ce4870f18fbb92f6123b3d21e37006c3a32fc5 100644 (file)
@@ -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<BlockDecl>(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(),