[clang] [ByteCode] Migrate away from PointerUnion::dyn_cast (NFC) (PR #123445)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 17 20:58:24 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/123445
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 D to be nonnull.
>From c87b28836e95b3b407cbf2a2d2120e9af0d7d98d Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 17 Jan 2025 09:01:37 -0800
Subject: [PATCH] [ByteCode] Migrate away from PointerUnion::dyn_cast (NFC)
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 D to be nonnull.
---
clang/lib/AST/ByteCode/Program.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp
index c98a3506b0a90b..7d8862d606ba3c 100644
--- a/clang/lib/AST/ByteCode/Program.cpp
+++ b/clang/lib/AST/ByteCode/Program.cpp
@@ -155,7 +155,7 @@ unsigned Program::getOrCreateDummy(const DeclTy &D) {
QualType QT;
bool IsWeak = false;
- if (const auto *E = D.dyn_cast<const Expr *>()) {
+ if (const auto *E = dyn_cast<const Expr *>(D)) {
QT = E->getType();
} else {
const ValueDecl *VD = cast<ValueDecl>(cast<const Decl *>(D));
More information about the cfe-commits
mailing list