[Modules] Do not rewrite existing decls when deserializing class fields
authorIlya Biryukov <ibiryukov@google.com>
Mon, 17 Apr 2023 12:02:48 +0000 (14:02 +0200)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 18 Apr 2023 10:40:39 +0000 (12:40 +0200)
commitccf7191719375cac15da5a3eb406e1efa602b096
tree905f765282fb9bdf7430a998e30149728c764e02
parent294831688ff9b45b115e00dabd3119d6803414ab
[Modules] Do not rewrite existing decls when deserializing class fields

Classes can have implicit members that were added before fields were
deserialized. These members were previously silently removed from
`decls()` when fields were deserialized after them.

This was the root cause of a compilation error exposed in
bc95f27337c7ed77c28e713c855272848f01802a, added a test for it.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D148515
clang/lib/AST/Decl.cpp
clang/test/Modules/pr61065_2.cppm [new file with mode: 0644]