Skip to content

Commit f7ae62f

Browse files
committed
Reimplement HandleInvalidTagDeclDefinition without clang support.
See https://reviews.llvm.org/D92248
1 parent 8a6b437 commit f7ae62f

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

interpreter/cling/lib/Interpreter/DeclCollector.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,16 @@ namespace cling {
263263
Transaction::DelayCallInfo DCI(DeclGroupRef(TD),
264264
Transaction::kCCIHandleTagDeclDefinition);
265265
m_CurTransaction->append(DCI);
266+
if (TD->isInvalidDecl()) {
267+
m_CurTransaction->setIssuedDiags(Transaction::kErrors);
268+
return;
269+
}
266270
if (m_Consumer
267271
&& (!comesFromASTReader(DeclGroupRef(TD))
268272
|| !shouldIgnore(TD)))
269273
m_Consumer->HandleTagDeclDefinition(TD);
270274
}
271275

272-
void DeclCollector::HandleInvalidTagDeclDefinition(clang::TagDecl *TD){
273-
assertHasTransaction(m_CurTransaction);
274-
Transaction::DelayCallInfo DCI(DeclGroupRef(TD),
275-
Transaction::kCCIHandleTagDeclDefinition);
276-
m_CurTransaction->append(DCI);
277-
m_CurTransaction->setIssuedDiags(Transaction::kErrors);
278-
if (m_Consumer
279-
&& (!comesFromASTReader(DeclGroupRef(TD))
280-
|| !shouldIgnore(TD)))
281-
m_Consumer->HandleInvalidTagDeclDefinition(TD);
282-
}
283-
284276
void DeclCollector::HandleVTable(CXXRecordDecl* RD) {
285277
assertHasTransaction(m_CurTransaction);
286278
Transaction::DelayCallInfo DCI(DeclGroupRef(RD),

interpreter/cling/lib/Interpreter/DeclCollector.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ namespace cling {
9696
bool HandleTopLevelDecl(clang::DeclGroupRef DGR) final;
9797
void HandleInterestingDecl(clang::DeclGroupRef DGR) final;
9898
void HandleTagDeclDefinition(clang::TagDecl* TD) final;
99-
void HandleInvalidTagDeclDefinition(clang::TagDecl* TD) final;
10099
void HandleVTable(clang::CXXRecordDecl* RD) final;
101100
void CompleteTentativeDefinition(clang::VarDecl* VD) final;
102101
void HandleTranslationUnit(clang::ASTContext& Ctx) final;

interpreter/llvm/src/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,19 +2235,13 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
22352235
// Exit the scope of this instantiation.
22362236
SavedContext.pop();
22372237

2238-
if (!Instantiation->isInvalidDecl()) {
2239-
Consumer.HandleTagDeclDefinition(Instantiation);
2240-
2241-
// Always emit the vtable for an explicit instantiation definition
2242-
// of a polymorphic class template specialization. Otherwise, eagerly
2243-
// instantiate only constexpr virtual functions in preparation for their use
2244-
// in constant evaluation.
2245-
if (TSK == TSK_ExplicitInstantiationDefinition)
2246-
MarkVTableUsed(PointOfInstantiation, Instantiation, true);
2247-
else if (MightHaveConstexprVirtualFunctions)
2248-
MarkVirtualMembersReferenced(PointOfInstantiation, Instantiation,
2249-
/*ConstexprOnly*/ true);
2250-
}
2238+
Consumer.HandleTagDeclDefinition(Instantiation);
2239+
2240+
// Always emit the vtable for an explicit instantiation definition
2241+
// of a polymorphic class template specialization.
2242+
if (!Instantiation->isInvalidDecl() &&
2243+
TSK == TSK_ExplicitInstantiationDefinition)
2244+
MarkVTableUsed(PointOfInstantiation, Instantiation, true);
22512245

22522246
return Instantiation->isInvalidDecl();
22532247
}

0 commit comments

Comments
 (0)