[clang] 80e0cba - [ByteCode] Migrate away from PointerUnion::dyn_cast (NFC) (#123445)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 18 09:43:20 PST 2025


Author: Kazu Hirata
Date: 2025-01-18T09:43:17-08:00
New Revision: 80e0cbafba56d428571f4e05e5dfe305b85b809a

URL: https://github.com/llvm/llvm-project/commit/80e0cbafba56d428571f4e05e5dfe305b85b809a
DIFF: https://github.com/llvm/llvm-project/commit/80e0cbafba56d428571f4e05e5dfe305b85b809a.diff

LOG: [ByteCode] Migrate away from PointerUnion::dyn_cast (NFC) (#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.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Program.cpp

Removed: 
    


################################################################################
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