[clang] [clang] Fix nondeterminism in MemberPointerType (PR #137910)

Maksim Ivanov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 30 07:37:48 PDT 2025


emaxx-google wrote:

> It is not clear to me why this is a specifically a problem when called from `Profile(...)` can you elaborate a bit more in the summary.

I've added a bit more details - it's basically the fact that the "get most recent" operation triggered the load of new nodes from the PCM file. If all this happens while a hash for another node is calculated in `Profile()`, it means we're modifying the hash map while doing another operation with it.

At least that's the current theory, based on debugging the "deviating" executions of the compiler and seeing the `getMostRecentNonInjectedDecl()` call and the deserialization all during the `FoldingSet::NodeEquals()` function call.

> Does `getMostRecentCXXRecordDecl(...)` require a comment that documents this behavior so that future users do not fall into the same issue?

Sure, I've added a comment.

https://github.com/llvm/llvm-project/pull/137910


More information about the cfe-commits mailing list