Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 4 additions & 12 deletions interpreter/cling/lib/Interpreter/DeclCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,24 +263,16 @@ namespace cling {
Transaction::DelayCallInfo DCI(DeclGroupRef(TD),
Transaction::kCCIHandleTagDeclDefinition);
m_CurTransaction->append(DCI);
if (TD->isInvalidDecl()) {
m_CurTransaction->setIssuedDiags(Transaction::kErrors);
return;
}
if (m_Consumer
&& (!comesFromASTReader(DeclGroupRef(TD))
|| !shouldIgnore(TD)))
m_Consumer->HandleTagDeclDefinition(TD);
}

void DeclCollector::HandleInvalidTagDeclDefinition(clang::TagDecl *TD){
assertHasTransaction(m_CurTransaction);
Transaction::DelayCallInfo DCI(DeclGroupRef(TD),
Transaction::kCCIHandleTagDeclDefinition);
m_CurTransaction->append(DCI);
m_CurTransaction->setIssuedDiags(Transaction::kErrors);
if (m_Consumer
&& (!comesFromASTReader(DeclGroupRef(TD))
|| !shouldIgnore(TD)))
m_Consumer->HandleInvalidTagDeclDefinition(TD);
}

void DeclCollector::HandleVTable(CXXRecordDecl* RD) {
assertHasTransaction(m_CurTransaction);
Transaction::DelayCallInfo DCI(DeclGroupRef(RD),
Expand Down
1 change: 0 additions & 1 deletion interpreter/cling/lib/Interpreter/DeclCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ namespace cling {
bool HandleTopLevelDecl(clang::DeclGroupRef DGR) final;
void HandleInterestingDecl(clang::DeclGroupRef DGR) final;
void HandleTagDeclDefinition(clang::TagDecl* TD) final;
void HandleInvalidTagDeclDefinition(clang::TagDecl* TD) final;
void HandleVTable(clang::CXXRecordDecl* RD) final;
void CompleteTentativeDefinition(clang::VarDecl* VD) final;
void HandleTranslationUnit(clang::ASTContext& Ctx) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ class ASTConsumer {
/// can be defined in declspecs).
virtual void HandleTagDeclDefinition(TagDecl *D) {}

/// HandleInvalidTagDeclDefinition - This callback is invoked each time a TagDecl
/// (e.g. struct, union, enum, class) end up invalid after attempting completion.
/// This allows the client to record (and possibly remove from the AST) the
/// decl.
virtual void HandleInvalidTagDeclDefinition(TagDecl *D) {}

/// This callback is invoked the first time each TagDecl is required to
/// be complete.
virtual void HandleTagDeclRequiredDefinition(const TagDecl *D) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class MultiplexConsumer : public SemaConsumer {
void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override;
void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override;
void HandleImplicitImportDecl(ImportDecl *D) override;
void HandleInvalidTagDeclDefinition(TagDecl *D) override;
void CompleteTentativeDefinition(VarDecl *D) override;
void AssignInheritanceModel(CXXRecordDecl *RD) override;
void HandleVTable(CXXRecordDecl *RD) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@ void MultiplexConsumer::HandleImplicitImportDecl(ImportDecl *D) {
Consumer->HandleImplicitImportDecl(D);
}

void MultiplexConsumer::HandleInvalidTagDeclDefinition(TagDecl *D) {
for (auto &Consumer : Consumers)
Consumer->HandleInvalidTagDeclDefinition(D);
}

void MultiplexConsumer::CompleteTentativeDefinition(VarDecl *D) {
for (auto &Consumer : Consumers)
Consumer->CompleteTentativeDefinition(D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2235,21 +2235,13 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
// Exit the scope of this instantiation.
SavedContext.pop();

if (Instantiation->isInvalidDecl()) {
Consumer.HandleInvalidTagDeclDefinition(Instantiation);
} else {
Consumer.HandleTagDeclDefinition(Instantiation);

// Always emit the vtable for an explicit instantiation definition
// of a polymorphic class template specialization. Otherwise, eagerly
// instantiate only constexpr virtual functions in preparation for their use
// in constant evaluation.
if (TSK == TSK_ExplicitInstantiationDefinition)
MarkVTableUsed(PointOfInstantiation, Instantiation, true);
else if (MightHaveConstexprVirtualFunctions)
Copy link
Member

Choose a reason for hiding this comment

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

This seems to have been lost?

Copy link
Member

Choose a reason for hiding this comment

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

ping @vgvassilev this still needs to be addressed!

Copy link
Member

Choose a reason for hiding this comment

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

...and I don't know how to make sure it will be addressed (rather than just forgotten). Maybe open an issue, @vgvassilev ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, indeed that was missing. It is readded in #8135

Luckily, being patch-free that would have been 'transiently' fixed with the next upgrade.

MarkVirtualMembersReferenced(PointOfInstantiation, Instantiation,
/*ConstexprOnly*/ true);
}
Consumer.HandleTagDeclDefinition(Instantiation);

// Always emit the vtable for an explicit instantiation definition
// of a polymorphic class template specialization.
if (!Instantiation->isInvalidDecl() &&
TSK == TSK_ExplicitInstantiationDefinition)
MarkVTableUsed(PointOfInstantiation, Instantiation, true);

return Instantiation->isInvalidDecl();
}
Expand Down