[llvm] c83ec0a - Make dyn_cast results explicitly auto* instead of just auto.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 08:39:30 PDT 2020
Author: Simon Pilgrim
Date: 2020-07-01T16:38:52+01:00
New Revision: c83ec0a633583e5b12e0aeb70627eb35f7cd4847
URL: https://github.com/llvm/llvm-project/commit/c83ec0a633583e5b12e0aeb70627eb35f7cd4847
DIFF: https://github.com/llvm/llvm-project/commit/c83ec0a633583e5b12e0aeb70627eb35f7cd4847.diff
LOG: Make dyn_cast results explicitly auto* instead of just auto.
Noticed by clang-tidy llvm-qualified-auto warning.
Added:
Modified:
llvm/lib/IR/Instructions.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 69a119bc3bf0..b06504742e7d 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -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;
}
More information about the llvm-commits
mailing list