Skip to content

Commit 1cea7d4

Browse files
committed
[Clang][CodeGen] Address review comments. NFC.
1 parent ac2bd21 commit 1cea7d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,10 +1883,10 @@ llvm::Constant *ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &D) {
18831883

18841884
// Try to emit the initializer. Note that this can allow some things that
18851885
// are not allowed by tryEmitPrivateForMemory alone.
1886-
if (APValue *value = D.evaluateValue()) {
1887-
if (!value->allowConstexprUnknown())
1888-
return tryEmitPrivateForMemory(*value, destType);
1889-
}
1886+
// Bail out on constexpr-unknown values since they are invalid in CodeGen.
1887+
if (APValue *value = D.evaluateValue();
1888+
value && !value->allowConstexprUnknown())
1889+
return tryEmitPrivateForMemory(*value, destType);
18901890

18911891
return nullptr;
18921892
}

0 commit comments

Comments
 (0)