Commit e4c7732
[Clang][Modules] Add added implicit members to record upon deserialization
Previously, we were only called RD->addedMember(MD) to notify RD that MD
(an implicit member) was added, but MD is never actually added as
a child of RD. (Interestingly, MD still thinks RD is its parent.)
We end up with a broken AST that Clang itself seems to be robust to, but
causes issues for users of libclang like Swift's ClangImporter.
This patch tries to maintain a well-formed AST by replacing calls to
RD->addedMember(MD) with RD->addHiddenDecl(MD) for member function decls
(addHiddenDecl() internally calls addedMember() to keep member metadata
up to date). Most of the code is there to check that RD doesn't already
contain the same decl as MD, which may be declared in and deserialized
from another module. We fall back to the original behavior of calling
addedMember() for non-function members: it's unclear what scenario leads
to that (if any), nor how we should best handle that.
Note that we call addHiddenDecl() instead of addDecl() because the
latter can sometimes lead to an assertion failure.
rdar://1619314081 parent 3c74707 commit e4c7732
1 file changed
+64
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10671 | 10671 | | |
10672 | 10672 | | |
10673 | 10673 | | |
| 10674 | + | |
| 10675 | + | |
| 10676 | + | |
| 10677 | + | |
| 10678 | + | |
| 10679 | + | |
| 10680 | + | |
| 10681 | + | |
| 10682 | + | |
| 10683 | + | |
| 10684 | + | |
| 10685 | + | |
| 10686 | + | |
| 10687 | + | |
| 10688 | + | |
| 10689 | + | |
| 10690 | + | |
| 10691 | + | |
| 10692 | + | |
| 10693 | + | |
| 10694 | + | |
| 10695 | + | |
| 10696 | + | |
| 10697 | + | |
| 10698 | + | |
| 10699 | + | |
| 10700 | + | |
| 10701 | + | |
| 10702 | + | |
| 10703 | + | |
| 10704 | + | |
| 10705 | + | |
| 10706 | + | |
| 10707 | + | |
| 10708 | + | |
| 10709 | + | |
| 10710 | + | |
| 10711 | + | |
| 10712 | + | |
| 10713 | + | |
| 10714 | + | |
| 10715 | + | |
| 10716 | + | |
| 10717 | + | |
| 10718 | + | |
| 10719 | + | |
| 10720 | + | |
| 10721 | + | |
| 10722 | + | |
| 10723 | + | |
| 10724 | + | |
| 10725 | + | |
| 10726 | + | |
| 10727 | + | |
| 10728 | + | |
| 10729 | + | |
| 10730 | + | |
| 10731 | + | |
| 10732 | + | |
| 10733 | + | |
| 10734 | + | |
| 10735 | + | |
| 10736 | + | |
| 10737 | + | |
10674 | 10738 | | |
10675 | 10739 | | |
10676 | 10740 | | |
| |||
0 commit comments