This is an archive of the discontinued LLVM Phabricator instance.

[ODRHash] Detect mismatches in anonymous `RecordDecl`.
ClosedPublic

Authored by vsapsai on Dec 14 2022, 2:01 PM.

Details

Summary

Allow completing a redeclaration check for anonymous structs/unions
inside RecordDecl, so we deserialize and compare anonymous entities
from different modules.

Completing the redeclaration chain for RecordDecl in
ASTContext::getASTRecordLayout mimics the behavior in
CXXRecordDecl::dataPtr. Instead of completing the redeclaration chain
every time we request a definition, do that right before we need a
complete definition in ASTContext::getASTRecordLayout.

Such code is required only for anonymous RecordDecl because we
deserialize named decls when we look them up by name. But it doesn't
work for anonymous decls as they don't have a name. That's why need to
force deserialization of anonymous decls in a different way.

rdar://81864186

Diff Detail

Event Timeline

vsapsai created this revision.Dec 14 2022, 2:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2022, 2:01 PM
Herald added a subscriber: ributzka. · View Herald Transcript
vsapsai requested review of this revision.Dec 14 2022, 2:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2022, 2:01 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ChuanqiXu accepted this revision.Dec 25 2022, 6:29 PM

LGTM since it shouldn't be bad to call getMostRecentDecl() multiple times.

This revision is now accepted and ready to land.Dec 25 2022, 6:29 PM
This revision was landed with ongoing or failed builds.Jan 19 2023, 2:00 PM
This revision was automatically updated to reflect the committed changes.