CGCall.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.

castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately in the setUsedBits call.
This commit is contained in:
Simon Pilgrim 2020-11-24 16:55:26 +00:00
parent 6d56823116
commit eb7ea5aa1a
1 changed files with 2 additions and 2 deletions

View File

@ -3153,7 +3153,7 @@ llvm::Value *CodeGenFunction::EmitCMSEClearRecord(llvm::Value *Src,
const llvm::DataLayout &DataLayout = CGM.getDataLayout();
int Size = DataLayout.getTypeStoreSize(ITy);
SmallVector<uint64_t, 4> Bits(Size);
setUsedBits(CGM, QTy->getAs<RecordType>(), 0, Bits);
setUsedBits(CGM, QTy->castAs<RecordType>(), 0, Bits);
int CharWidth = CGM.getContext().getCharWidth();
uint64_t Mask =
@ -3170,7 +3170,7 @@ llvm::Value *CodeGenFunction::EmitCMSEClearRecord(llvm::Value *Src,
const llvm::DataLayout &DataLayout = CGM.getDataLayout();
int Size = DataLayout.getTypeStoreSize(ATy);
SmallVector<uint64_t, 16> Bits(Size);
setUsedBits(CGM, QTy->getAs<RecordType>(), 0, Bits);
setUsedBits(CGM, QTy->castAs<RecordType>(), 0, Bits);
// Clear each element of the LLVM array.
int CharWidth = CGM.getContext().getCharWidth();