[all-commits] [llvm/llvm-project] 0764f6: [clang] Fix nondeterminism in MemberPointerType (#...

Maksim Ivanov via All-commits all-commits at lists.llvm.org
Mon May 5 08:10:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0764f65a7fb06703610b33a86ca79025fa4050a4
      https://github.com/llvm/llvm-project/commit/0764f65a7fb06703610b33a86ca79025fa4050a4
  Author: Maksim Ivanov <emaxx at google.com>
  Date:   2025-05-05 (Mon, 05 May 2025)

  Changed paths:
    M clang/include/clang/AST/Type.h
    M clang/lib/AST/Type.cpp

  Log Message:
  -----------
  [clang] Fix nondeterminism in MemberPointerType (#137910)

This commit fixes the nondeterminism issue in C++ header module enabled builds which were observed after
https://github.com/llvm/llvm-project/pull/132401.

The issue was related to the fact that the hash set operation in MemberPointerType::Profile() was triggering getMostRecentDecl(). As the latter may trigger the loading of new entities from the external AST source, this
was presumably causing reentrant modification of data structure or some other issue that affects
compiler's output in a nondeterministic way (likely depending on specific values hashes/pointers have).

The change should otherwise be a no-op, because whether we take a "most recent" or "any" Decl shouldn't
matter since `getCanonicalDecl()` is called on it anyway inside `MemberPointerType::Profile()`.

We haven't been able to come up with a deterministic regression test for this fix.



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