[clang] 35f9d2a - [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (#122778)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 20:53:16 PST 2025


Author: Kazu Hirata
Date: 2025-01-13T20:53:13-08:00
New Revision: 35f9d2ac49eb3344f528c5b0c3b75330ade93982

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

LOG: [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (#122778)

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

Added: 
    

Modified: 
    clang/lib/CodeGen/CGCall.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 0fde4d8ee296bd..e0cf6ca69f0df2 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -4507,7 +4507,7 @@ void CodeGenFunction::EmitCallArgs(
   // First, if a prototype was provided, use those argument types.
   bool IsVariadic = false;
   if (Prototype.P) {
-    const auto *MD = Prototype.P.dyn_cast<const ObjCMethodDecl *>();
+    const auto *MD = dyn_cast<const ObjCMethodDecl *>(Prototype.P);
     if (MD) {
       IsVariadic = MD->isVariadic();
       ExplicitCC = getCallingConventionForDecl(


        


More information about the cfe-commits mailing list