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
2 changes: 2 additions & 0 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7198,6 +7198,8 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {

bool ModulesCodegen =
!D->isDependentType() &&
D->getTemplateSpecializationKind() !=
TSK_ExplicitInstantiationDeclaration &&
(Writer->getLangOpts().ModulesDebugInfo || D->isInNamedModule());
Record->push_back(ModulesCodegen);
if (ModulesCodegen)
Expand Down
34 changes: 34 additions & 0 deletions clang/test/Modules/vtable-in-explicit-instantiation.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t

// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cc -triple %itanium_abi_triple -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/a.cc
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-reduced-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cc -triple %itanium_abi_triple -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/a.cc

//--- a.cppm
export module a;
class base {
public:
~base() = default;
virtual void foo();
};

template <class T>
class a : public base {
public:
virtual void foo() override;
};

extern template class a<int>;

//--- a.cc
module a;

template <class T>
void a<T>::foo() {}

template class a<int>;
// CHECK: _ZTVW1a1aIiE
Loading