[clang] 113e1fd - [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (#124076)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 23 08:45:29 PST 2025
Author: Kazu Hirata
Date: 2025-01-23T08:45:26-08:00
New Revision: 113e1fdc8c7f9085d5a48ca16b270cf53e9f189d
URL: https://github.com/llvm/llvm-project/commit/113e1fdc8c7f9085d5a48ca16b270cf53e9f189d
DIFF: https://github.com/llvm/llvm-project/commit/113e1fdc8c7f9085d5a48ca16b270cf53e9f189d.diff
LOG: [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (#124076)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect Pos to be nonnull.
Added:
Modified:
clang/lib/CodeGen/CGOpenMPRuntime.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index ddcb04d53661d0..5ae3fe694d0e6e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4079,7 +4079,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
Size = llvm::ConstantInt::get(CGF.SizeTy, 0);
}
LValue Base;
- if (unsigned *P = Pos.dyn_cast<unsigned *>()) {
+ if (unsigned *P = dyn_cast<unsigned *>(Pos)) {
Base = CGF.MakeAddrLValue(
CGF.Builder.CreateConstGEP(DependenciesArray, *P), KmpDependInfoTy);
} else {
@@ -4109,7 +4109,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
CGF.EmitStoreOfScalar(
llvm::ConstantInt::get(LLVMFlagsTy, static_cast<unsigned int>(DepKind)),
FlagsLVal);
- if (unsigned *P = Pos.dyn_cast<unsigned *>()) {
+ if (unsigned *P = dyn_cast<unsigned *>(Pos)) {
++(*P);
} else {
LValue &PosLVal = *cast<LValue *>(Pos);
More information about the cfe-commits
mailing list