aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorShraiysh Vaishay <shraiysh@gmail.com>2023-04-15 21:16:16 -0500
committerShraiysh Vaishay <shraiysh@gmail.com>2023-04-17 13:40:51 -0500
commit7021182d6b43de9488ab70de626192ce70b3a4a6 (patch)
tree193d14c63ce01bf680f9919b5cbb4b11a944de8b /llvm/lib/IR/DIBuilder.cpp
parent63395cb0b69dee69ec5d5d0d552482c607861178 (diff)
downloadllvm-7021182d6b43de9488ab70de626192ce70b3a4a6.zip
llvm-7021182d6b43de9488ab70de626192ce70b3a4a6.tar.gz
llvm-7021182d6b43de9488ab70de626192ce70b3a4a6.tar.bz2
[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.
This patch replaces the uses of PointerUnion.is function by llvm::isa, PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by llvm::dyn_cast_if_present. This is according to the FIXME in the definition of the class PointerUnion. This patch does not remove them as they are being used in other subprojects. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D148449
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index b958443..1428ceb 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -582,14 +582,14 @@ DIBuilder::createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty,
VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, Ty, Size,
AlignInBits, 0, DINode::FlagZero, Subscripts, 0, nullptr, nullptr, "",
nullptr,
- DL.is<DIExpression *>() ? (Metadata *)DL.get<DIExpression *>()
- : (Metadata *)DL.get<DIVariable *>(),
- AS.is<DIExpression *>() ? (Metadata *)AS.get<DIExpression *>()
- : (Metadata *)AS.get<DIVariable *>(),
- AL.is<DIExpression *>() ? (Metadata *)AL.get<DIExpression *>()
- : (Metadata *)AL.get<DIVariable *>(),
- RK.is<DIExpression *>() ? (Metadata *)RK.get<DIExpression *>()
- : (Metadata *)RK.get<DIVariable *>());
+ isa<DIExpression *>(DL) ? (Metadata *)cast<DIExpression *>(DL)
+ : (Metadata *)cast<DIVariable *>(DL),
+ isa<DIExpression *>(AS) ? (Metadata *)cast<DIExpression *>(AS)
+ : (Metadata *)cast<DIVariable *>(AS),
+ isa<DIExpression *>(AL) ? (Metadata *)cast<DIExpression *>(AL)
+ : (Metadata *)cast<DIVariable *>(AL),
+ isa<DIExpression *>(RK) ? (Metadata *)cast<DIExpression *>(RK)
+ : (Metadata *)cast<DIVariable *>(RK));
trackIfUnresolved(R);
return R;
}
@@ -714,8 +714,8 @@ DIGenericSubrange *DIBuilder::getOrCreateGenericSubrange(
DIGenericSubrange::BoundType CountNode, DIGenericSubrange::BoundType LB,
DIGenericSubrange::BoundType UB, DIGenericSubrange::BoundType Stride) {
auto ConvToMetadata = [&](DIGenericSubrange::BoundType Bound) -> Metadata * {
- return Bound.is<DIExpression *>() ? (Metadata *)Bound.get<DIExpression *>()
- : (Metadata *)Bound.get<DIVariable *>();
+ return isa<DIExpression *>(Bound) ? (Metadata *)cast<DIExpression *>(Bound)
+ : (Metadata *)cast<DIVariable *>(Bound);
};
return DIGenericSubrange::get(VMContext, ConvToMetadata(CountNode),
ConvToMetadata(LB), ConvToMetadata(UB),