Fix emission of vtables
It is (again) necessary to call DefineUsedVTables() to enable (at least) the emission of implicitly defined destructors overriding the virtual destructor in a base class, see the added test.
This commit is contained in:
parent
ed72130ee6
commit
b721467e15
@ -642,6 +642,8 @@ namespace cling {
|
||||
Transaction* prevConsumerT = m_Consumer->getTransaction();
|
||||
m_Consumer->setTransaction(T);
|
||||
Transaction* nestedT = beginTransaction(T->getCompilationOpts());
|
||||
// Process used vtables and generate implicit bodies.
|
||||
getCI()->getSema().DefineUsedVTables();
|
||||
// Pull all template instantiations in that came from the consumers.
|
||||
getCI()->getSema().PerformPendingInstantiations();
|
||||
#ifdef _WIN32
|
||||
|
40
test/CodeGeneration/VTableDestructor.C
Normal file
40
test/CodeGeneration/VTableDestructor.C
Normal file
@ -0,0 +1,40 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
//
|
||||
// This file is dual-licensed: you can choose to license it under the University
|
||||
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
|
||||
|
||||
// Test that the interpreter properly generates implicitly defined destructors
|
||||
// overriding the virtual destructor in the base class.
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
.rawInput
|
||||
extern "C" int printf(const char*,...);
|
||||
|
||||
class A {
|
||||
public:
|
||||
virtual ~A() {
|
||||
printf("A::~A()\n");
|
||||
}
|
||||
};
|
||||
|
||||
class B : public A {
|
||||
public:
|
||||
B() {
|
||||
printf("B::B()\n");
|
||||
}
|
||||
};
|
||||
.rawInput
|
||||
|
||||
// CHECK-NOT: error
|
||||
// CHECK-NOT: Symbols not found
|
||||
|
||||
// CHECK: B::B()
|
||||
A *b = new B;
|
||||
// CHECK: A::~A()
|
||||
delete b;
|
Loading…
x
Reference in New Issue
Block a user