Skip to content

Commit 0808be4

Browse files
authored
[NFC] Remove unneeded nullptr checks after cast<> (#74674)
Since VD is assigned from a cast<VarDecl> it cannot be a nullptr or it would have asserted. Remove the subsequent checks to clear up any misunderstanding.
1 parent 7003e25 commit 0808be4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -6439,7 +6439,7 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
64396439
VD, E->getManglingNumber(), Out);
64406440

64416441
APValue *Value = nullptr;
6442-
if (E->getStorageDuration() == SD_Static && VD && VD->evaluateValue()) {
6442+
if (E->getStorageDuration() == SD_Static && VD->evaluateValue()) {
64436443
// If the initializer of the extending declaration is a constant
64446444
// initializer, we should have a cached constant initializer for this
64456445
// temporary. Note that this might have a different value from the value
@@ -6454,8 +6454,7 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
64546454
!EvalResult.hasSideEffects())
64556455
Value = &EvalResult.Val;
64566456

6457-
LangAS AddrSpace =
6458-
VD ? GetGlobalVarAddressSpace(VD) : MaterializedType.getAddressSpace();
6457+
LangAS AddrSpace = GetGlobalVarAddressSpace(VD);
64596458

64606459
std::optional<ConstantEmitter> emitter;
64616460
llvm::Constant *InitialValue = nullptr;

0 commit comments

Comments
 (0)