Skip to content

Commit

Permalink
[NFC] Remove unneeded nullptr checks after cast<> (#74674)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mikerice1969 authored Dec 8, 2023
1 parent 7003e25 commit 0808be4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6439,7 +6439,7 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
VD, E->getManglingNumber(), Out);

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

LangAS AddrSpace =
VD ? GetGlobalVarAddressSpace(VD) : MaterializedType.getAddressSpace();
LangAS AddrSpace = GetGlobalVarAddressSpace(VD);

std::optional<ConstantEmitter> emitter;
llvm::Constant *InitialValue = nullptr;
Expand Down

0 comments on commit 0808be4

Please sign in to comment.