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

Steven Wu via All-commits all-commits at lists.llvm.org
Fri Jul 31 00:29:53 PDT 2026


  Branch: refs/heads/release/23.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e1225eb1f77152b8fb24367e5eebe047db01e15
      https://github.com/llvm/llvm-project/commit/1e1225eb1f77152b8fb24367e5eebe047db01e15
  Author: Steven Wu <stevenwu at apple.com>
  Date:   2026-07-31 (Fri, 31 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