[clang] 16e61df - [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#125023)

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


Author: Kazu Hirata
Date: 2025-01-30T17:58:23-08:00
New Revision: 16e61df8a135ec6dfe90277ac47a0dd6f461b346

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

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

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

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 3cad9827fdab69..f7b8b192a206c3 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -19966,7 +19966,7 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
       continue;
 
     DeclOrVector& Entry = Iter->second;
-    if (EnumConstantDecl *D = Entry.dyn_cast<EnumConstantDecl*>()) {
+    if (EnumConstantDecl *D = dyn_cast<EnumConstantDecl *>(Entry)) {
       // Ensure constants are 
diff erent.
       if (D == ECD)
         continue;


        


More information about the cfe-commits mailing list