[all-commits] [llvm/llvm-project] 4e1a60: [Sema][Serialization] Emit unused local typedefs i...

Steven Wu via All-commits all-commits at lists.llvm.org
Wed Jul 15 11:58:12 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4e1a6091623a4d3b28132b6b4940a264511f5d0e
      https://github.com/llvm/llvm-project/commit/4e1a6091623a4d3b28132b6b4940a264511f5d0e
  Author: Steven Wu <stevenwu at apple.com>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/include/clang/Sema/ExternalSemaSource.h
    M clang/include/clang/Sema/MultiplexExternalSemaSource.h
    M clang/include/clang/Sema/Sema.h
    M clang/include/clang/Serialization/ASTReader.h
    M clang/lib/Sema/MultiplexExternalSemaSource.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    A clang/test/PCH/unused-local-typedef-determinism.cpp
    A clang/test/SemaCXX/warn-unused-local-typedef-deterministic-order.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h

  Log Message:
  -----------
  [Sema][Serialization] Emit unused local typedefs in a deterministic order (#209639)

Sema::UnusedLocalTypedefNameCandidates is populated while iterating a
Scope's
DeclsInScope, which is a SmallPtrSet whose iteration order depends on
pointer
values and is therefore not stable across runs. The candidates are
serialized
into the AST file -- both to assign declaration IDs and to write the
UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES record -- and are also used to emit
the
deferred -Wunused-local-typedef warnings, so neither the emitted PCH/AST
file
nor the diagnostics were reproducible. With deterministic compilation
caching
this surfaces as a "cache poisoned" error, because two builds of the
same PCH
produce different bytes.

Sort the candidates by source location at the point they are consumed,
via
Sema::getSortedUnusedLocalTypedefNameCandidates(), so that both the
diagnostics
and the serialized declarations are deterministic.



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