[clang] [ByteCode] Migrate away from PointerUnion::dyn_cast (NFC) (PR #123445)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 17 20:58:59 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/123445.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/Program.cpp (+1-1)
``````````diff
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));
``````````
</details>
https://github.com/llvm/llvm-project/pull/123445
More information about the cfe-commits
mailing list