[clang] 3a3a1e4 - [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (#123013)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 07:55:56 PST 2025


Author: Kazu Hirata
Date: 2025-01-15T07:55:52-08:00
New Revision: 3a3a1e4627a37bdf5915b60fe375443bb280f23b

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

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

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

Added: 
    

Modified: 
    clang/lib/CodeGen/CGOpenMPRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 244e3066f8fe41..ddcb04d53661d0 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7768,7 +7768,7 @@ class MappableExprsHandler {
              &Data : RecordLayout) {
       if (Data.isNull())
         continue;
-      if (const auto *Base = Data.dyn_cast<const CXXRecordDecl *>())
+      if (const auto *Base = dyn_cast<const CXXRecordDecl *>(Data))
         getPlainLayout(Base, Layout, /*AsBase=*/true);
       else
         Layout.push_back(cast<const FieldDecl *>(Data));


        


More information about the cfe-commits mailing list