[clang] dea4e61 - [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (#123157)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 16 08:44:40 PST 2025


Author: Kazu Hirata
Date: 2025-01-16T08:44:37-08:00
New Revision: dea4e613a05cd7d7438a365beb81998b36185ed9

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

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

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/ConstantInitBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/ConstantInitBuilder.cpp b/clang/lib/CodeGen/ConstantInitBuilder.cpp
index ddbf3ef743370b..ce1fe137c1919b 100644
--- a/clang/lib/CodeGen/ConstantInitBuilder.cpp
+++ b/clang/lib/CodeGen/ConstantInitBuilder.cpp
@@ -29,7 +29,7 @@ llvm::Type *ConstantInitFuture::getType() const {
 
 void ConstantInitFuture::abandon() {
   assert(Data && "abandoning null future");
-  if (auto builder = Data.dyn_cast<ConstantInitBuilderBase*>()) {
+  if (auto *builder = dyn_cast<ConstantInitBuilderBase *>(Data)) {
     builder->abandon(0);
   }
   Data = nullptr;


        


More information about the cfe-commits mailing list