[clang] d1ed1de - [clang] Migrate away from PointerUnion::dyn_cast (NFC) (#232179)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 15 00:59:34 PDT 2026


Author: Kazu Hirata
Date: 2026-10-15T00:59:27-07:00
New Revision: d1ed1de8a741841da1769c21af7856d8b864d1f0

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

LOG: [clang] Migrate away from PointerUnion::dyn_cast (NFC) (#232179)

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.
Note that loadAPINotes() returns false only after storing a nonnull
APINotesReader * in Readers[*Dir].

Assisted-by: Antigravity

Added: 
    

Modified: 
    clang/lib/APINotes/APINotesManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/APINotes/APINotesManager.cpp b/clang/lib/APINotes/APINotesManager.cpp
index 2cc801d5415b84..5c1bb41d804e99 100644
--- a/clang/lib/APINotes/APINotesManager.cpp
+++ b/clang/lib/APINotes/APINotesManager.cpp
@@ -444,7 +444,7 @@ APINotesManager::findAPINotes(SourceLocation Loc) {
       if (auto APINotesFile = FileMgr.getOptionalFileRef(APINotesPath)) {
         if (!loadAPINotes(*Dir, *APINotesFile)) {
           ++NumHeaderAPINotes;
-          if (auto Reader = Readers[*Dir].dyn_cast<APINotesReader *>())
+          if (auto Reader = dyn_cast<APINotesReader *>(Readers[*Dir]))
             Results.push_back(Reader);
           break;
         }


        


More information about the cfe-commits mailing list