[all-commits] [llvm/llvm-project] 1978a4: [clang] Migrate away from PointerUnion::dyn_cast (...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Fri Sep 25 08:11:10 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1978a469493fec319cd61e2eac42abade837fafc
      https://github.com/llvm/llvm-project/commit/1978a469493fec319cd61e2eac42abade837fafc
  Author: Kazu Hirata <kazu at google.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/CodeGen/CGBlocks.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp

  Log Message:
  -----------
  [clang] Migrate away from PointerUnion::dyn_cast (NFC) (#226390)

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 on
ExprWithCleanups::CleanupObject because it is always nonnull.
Specifically, ExprWithCleanups::getObjects() is populated from a slice
of Sema::ExprCleanupObjects, which only receives nonnull pointers in
the following places:

- Sema::BuildCompoundLiteralExpr
- Sema::ActOnBlockStmtExpr
- Sema::BuildBlockForLambdaConversion

Assisted-by: Antigravity



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list