Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Set the described template if not set #570

Open
wants to merge 1 commit into
base: ctu-clang7
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2710,6 +2710,9 @@ ExpectedDecl ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
getCanonicalForwardRedeclChain(D2CXX);
for (auto *R : Redecls) {
auto *RI = cast<CXXRecordDecl>(R);
// Existing Decl in the chain might not have the described
// template set, so we set it now.
RI->setDescribedClassTemplate(ToDescribed);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case that DescribedClassTemplate is not set must indicate that it is currently under import. Normally it should be set by a pending (or later) import call. So it should be possible to ignore here that case (if there is no described class template, omit the next 2 lines). The current solution is probably not correct because the RI can have a different DescribedClassTemplate that ToDescribed. (But anyway there should be a pending import call for it that should reset it to the correct value.)

RI->setTypeForDecl(nullptr);
// Below we create a new injected type and assign that to the
// canonical decl, subsequent declarations in the chain will reuse
Expand Down