[all-commits] [llvm/llvm-project] ebe084: [Modules] Fix the inconsistency of which `Decl` sh...
Volodymyr Sapsai via All-commits
all-commits at lists.llvm.org
Thu Apr 17 17:09:47 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ebe084f927f14be707d3ca64dab0faaf6c0eee9d
https://github.com/llvm/llvm-project/commit/ebe084f927f14be707d3ca64dab0faaf6c0eee9d
Author: Volodymyr Sapsai <vsapsai at apple.com>
Date: 2025-04-17 (Thu, 17 Apr 2025)
Changed paths:
M clang/lib/Serialization/ASTWriter.cpp
A clang/test/Modules/non-modular-decl-use.c
Log Message:
-----------
[Modules] Fix the inconsistency of which `Decl` should be serialized for an identifier. (#135887)
Fixes the assertion failure
> Assertion failed: (DeclIDs.contains(D) && "Declaration not emitted!"),
function getDeclID, file ASTWriter.cpp, line 6873.
We prepare to serialize a `Decl` by adding it to `DeclIDs` in
`ASTWriter::GetDeclRef`. But the checks before this call aren't the same
as when we are actually serializing a `Decl` in
`ASTIdentifierTableTrait::EmitData` and
`ASTWriter::WriteIdentifierTable`. That's how we can end up serializing
a `Decl` not present in `DeclIDs` and hitting the assertion. With the
assertions disabled clang crashes when trying to use a deserialized null
`Decl`.
Fix by making the code checks before `ASTWriter::GetDeclRef` call
similar to those we have before the serialization.
rdar://139319683
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