[clang] f5736ae - [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#123284)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 17 08:46:55 PST 2025


Author: Kazu Hirata
Date: 2025-01-17T08:46:52-08:00
New Revision: f5736aee112177b8b4620ab55bb65152a652dd34

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

LOG: [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#123284)

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 Stored to be nonnull.

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplateInstantiate.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index fb0f38df62a744..839c4e8a28220b 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -4661,7 +4661,7 @@ void LocalInstantiationScope::InstantiatedLocal(const Decl *D, Decl *Inst) {
     }
 #endif
     Stored = Inst;
-  } else if (DeclArgumentPack *Pack = Stored.dyn_cast<DeclArgumentPack *>()) {
+  } else if (DeclArgumentPack *Pack = dyn_cast<DeclArgumentPack *>(Stored)) {
     Pack->push_back(cast<VarDecl>(Inst));
   } else {
     assert(cast<Decl *>(Stored) == Inst && "Already instantiated this local");


        


More information about the cfe-commits mailing list