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

Kazu Hirata via All-commits all-commits at lists.llvm.org
Thu Sep 24 10:12:53 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 78ff5215e53a117851dc6e81e793a106f1a79df8
      https://github.com/llvm/llvm-project/commit/78ff5215e53a117851dc6e81e793a106f1a79df8
  Author: Kazu Hirata <kazu at google.com>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M clang/include/clang/AST/DeclContextInternals.h

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

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
DeclListNode::Decls in StoredDeclsList because the operands are always
nonnull:

- StoredDeclsList::getAsDecl and StoredDeclsList::getAsList are called
  only after verifying !isNull() (in StoredDeclsList::getASTContext,
  StoredDeclsList::addOrReplaceDecl, and ASTImporterTest.cpp).
- DeclListNode::Rest is always nonnull because the singly-linked list of
  DeclListNode is terminated by a NamedDecl *, not by nullptr.

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