Skip to content

Commit 36bd1c9

Browse files
committed
Remove redundant check for whether a DeclRefExpr that names a capture
constitutes an odr-use. We now track this accurately on the DeclRefExpr. llvm-svn: 363088
1 parent 1bbad59 commit 36bd1c9

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,16 +2463,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
24632463
// A DeclRefExpr for a reference initialized by a constant expression can
24642464
// appear without being odr-used. Directly emit the constant initializer.
24652465
VD->getAnyInitializer(VD);
2466-
const auto *BD = dyn_cast_or_null<BlockDecl>(CurCodeDecl);
2467-
if (E->isNonOdrUse() == NOUR_Constant && VD->getType()->isReferenceType() &&
2468-
// Do not emit if it is private OpenMP variable.
2469-
// FIXME: This should be handled in odr-use marking, not here.
2470-
!(E->refersToEnclosingVariableOrCapture() &&
2471-
((CapturedStmtInfo &&
2472-
(LocalDeclMap.count(VD->getCanonicalDecl()) ||
2473-
CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) ||
2474-
LambdaCaptureFields.lookup(VD->getCanonicalDecl()) ||
2475-
(BD && BD->capturesVariable(VD))))) {
2466+
if (E->isNonOdrUse() == NOUR_Constant && VD->getType()->isReferenceType()) {
24762467
llvm::Constant *Val =
24772468
ConstantEmitter(*this).emitAbstract(E->getLocation(),
24782469
*VD->evaluateValue(),

0 commit comments

Comments
 (0)