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

Kazu Hirata via All-commits all-commits at lists.llvm.org
Wed Sep 23 09:05:51 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f58d0420f36f3f374e3ae35f679874e0b4ff4de
      https://github.com/llvm/llvm-project/commit/0f58d0420f36f3f374e3ae35f679874e0b4ff4de
  Author: Kazu Hirata <kazu at google.com>
  Date:   2026-09-23 (Wed, 23 Sep 2026)

  Changed paths:
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/lib/Sema/SemaTemplateVariadic.cpp
    M clang/lib/Sema/TreeTransform.h

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

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
UnexpandedParameterPack::first because it is always nonnull.
Specifically, UnexpandedParameterPack is constructed only in the
following places, all of which store a nonnull pointer in first, and
first is never modified afterward:

- CollectUnexpandedParameterPacksVisitor::addUnexpanded in
  SemaTemplateVariadic.cpp
- TransformLambdaExpr in TreeTransform.h
- TransformSizeOfPackExpr in TreeTransform.h

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