[PATCH] D140055: [ODRHash] Detect mismatches in anonymous `RecordDecl`.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 14:01:17 PST 2022


vsapsai created this revision.
vsapsai added reviewers: bruno, jansvoboda11, ChuanqiXu.
Herald added a subscriber: ributzka.
Herald added a project: All.
vsapsai requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140055

Files:
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/test/Modules/compare-record.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140055.482987.patch
Type: text/x-patch
Size: 4738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221214/fa5765d4/attachment.bin>


More information about the cfe-commits mailing list