[clang] 2ef497e - [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#124675)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 10:56:29 PST 2025


Author: Kazu Hirata
Date: 2025-01-28T10:56:26-08:00
New Revision: 2ef497e5b02650c59aa71676b7d891a138519685

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

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

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

Added: 
    

Modified: 
    clang/lib/Sema/TreeTransform.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index f04adf7fdf8ad2..15d199e7f63fec 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -14903,7 +14903,7 @@ TreeTransform<Derived>::TransformExprRequirement(concepts::ExprRequirement *Req)
     TransRetReq.emplace(TPL);
   }
   assert(TransRetReq && "All code paths leading here must set TransRetReq");
-  if (Expr *E = TransExpr.dyn_cast<Expr *>())
+  if (Expr *E = dyn_cast<Expr *>(TransExpr))
     return getDerived().RebuildExprRequirement(E, Req->isSimple(),
                                                Req->getNoexceptLoc(),
                                                std::move(*TransRetReq));


        


More information about the cfe-commits mailing list