[clang] ba5b146 - [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#125022)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 30 17:58:13 PST 2025


Author: Kazu Hirata
Date: 2025-01-30T17:58:10-08:00
New Revision: ba5b14655a3fb7adad3f9db0161c8742a035f744

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

LOG: [AST] Migrate away from PointerUnion::dyn_cast (NFC) (#125022)

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

Added: 
    

Modified: 
    clang/lib/AST/TextNodeDumper.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index a57cba959748222..bbb31a1e8d3f5c9 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -958,9 +958,9 @@ void TextNodeDumper::dumpAccessSpecifier(AccessSpecifier AS) {
 
 void TextNodeDumper::dumpCleanupObject(
     const ExprWithCleanups::CleanupObject &C) {
-  if (auto *BD = C.dyn_cast<BlockDecl *>())
+  if (auto *BD = dyn_cast<BlockDecl *>(C))
     dumpDeclRef(BD, "cleanup");
-  else if (auto *CLE = C.dyn_cast<CompoundLiteralExpr *>())
+  else if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(C))
     AddChild([=] {
       OS << "cleanup ";
       {


        


More information about the cfe-commits mailing list