Make dyn_cast results explicitly auto* instead of just auto.

Noticed by clang-tidy llvm-qualified-auto warning.
This commit is contained in:
Simon Pilgrim 2020-07-01 15:46:43 +01:00
parent 0ae989a1fe
commit c83ec0a633
1 changed files with 7 additions and 7 deletions

View File

@ -53,7 +53,7 @@ Optional<uint64_t>
AllocaInst::getAllocationSizeInBits(const DataLayout &DL) const {
uint64_t Size = DL.getTypeAllocSizeInBits(getAllocatedType());
if (isArrayAllocation()) {
auto C = dyn_cast<ConstantInt>(getArraySize());
auto *C = dyn_cast<ConstantInt>(getArraySize());
if (!C)
return None;
Size *= C->getZExtValue();
@ -1682,29 +1682,29 @@ GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
}
Type *GetElementPtrInst::getTypeAtIndex(Type *Ty, Value *Idx) {
if (auto Struct = dyn_cast<StructType>(Ty)) {
if (auto *Struct = dyn_cast<StructType>(Ty)) {
if (!Struct->indexValid(Idx))
return nullptr;
return Struct->getTypeAtIndex(Idx);
}
if (!Idx->getType()->isIntOrIntVectorTy())
return nullptr;
if (auto Array = dyn_cast<ArrayType>(Ty))
if (auto *Array = dyn_cast<ArrayType>(Ty))
return Array->getElementType();
if (auto Vector = dyn_cast<VectorType>(Ty))
if (auto *Vector = dyn_cast<VectorType>(Ty))
return Vector->getElementType();
return nullptr;
}
Type *GetElementPtrInst::getTypeAtIndex(Type *Ty, uint64_t Idx) {
if (auto Struct = dyn_cast<StructType>(Ty)) {
if (auto *Struct = dyn_cast<StructType>(Ty)) {
if (Idx >= Struct->getNumElements())
return nullptr;
return Struct->getElementType(Idx);
}
if (auto Array = dyn_cast<ArrayType>(Ty))
if (auto *Array = dyn_cast<ArrayType>(Ty))
return Array->getElementType();
if (auto Vector = dyn_cast<VectorType>(Ty))
if (auto *Vector = dyn_cast<VectorType>(Ty))
return Vector->getElementType();
return nullptr;
}