Author: Kazu Hirata
Date: 2025-02-04T09:09:01-08:00
New Revision: 63c59dda436fef7ceb4e3a21a95d306435e42720

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

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

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 *Found to be nonnull.  Note that if *Found were
null, cast<VarDecl>(TransformedDecl) would trigger an assertion error.

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplateInstantiate.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index dc3bfa97eff399b..44bca0d667f764c 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2438,7 +2438,7 @@ 
TemplateInstantiator::TransformFunctionParmPackRefExpr(DeclRefExpr *E,
   assert(Found && "no instantiation for parameter pack");
 
   Decl *TransformedDecl;
-  if (DeclArgumentPack *Pack = Found->dyn_cast<DeclArgumentPack *>()) {
+  if (DeclArgumentPack *Pack = dyn_cast<DeclArgumentPack *>(*Found)) {
     // If this is a reference to a function parameter pack which we can
     // substitute but can't yet expand, build a FunctionParmPackExpr for it.
     if (getSema().ArgumentPackSubstitutionIndex == -1) {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to