[clang] 286f842 - [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#123158)

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


Author: Kazu Hirata
Date: 2025-01-16T08:45:03-08:00
New Revision: 286f8423c5e26df0743e47931d840b6226ae6a8c

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

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

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

Added: 
    

Modified: 
    clang/lib/Sema/SemaFunctionEffects.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaFunctionEffects.cpp b/clang/lib/Sema/SemaFunctionEffects.cpp
index 0d56a74b066e8e..31980abd23fd1e 100644
--- a/clang/lib/Sema/SemaFunctionEffects.cpp
+++ b/clang/lib/Sema/SemaFunctionEffects.cpp
@@ -567,7 +567,7 @@ class Analyzer {
     while (!VerificationQueue.empty()) {
       const Decl *D = VerificationQueue.back();
       if (FuncAnalysisPtr AP = DeclAnalysis.lookup(D)) {
-        if (auto *Pending = AP.dyn_cast<PendingFunctionAnalysis *>()) {
+        if (auto *Pending = dyn_cast<PendingFunctionAnalysis *>(AP)) {
           // All children have been traversed; finish analysis.
           finishPendingAnalysis(D, Pending);
         }


        


More information about the cfe-commits mailing list