mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 20:56:05 +00:00

dynamic classes in the translation unit and check whether each one's key function is defined when we got to the end of the TU (and when we got to the end of each module). This is really terrible for modules performance, since it causes unnecessary deserialization of every dynamic class in every compilation. We now use a much simpler (and, in a modules build, vastly more efficient) system: when we see an out-of-line definition of a virtual function, we check whether that function was in fact its class's key function. (If so, we need to emit the vtable.) llvm-svn: 230830
39 lines
788 B
C++
39 lines
788 B
C++
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 | FileCheck %s
|
|
// PR13424
|
|
|
|
namespace Test1 {
|
|
struct X {
|
|
virtual ~X(); // Key function.
|
|
virtual void f(); // Not a key function.
|
|
};
|
|
|
|
X::~X() = default;
|
|
|
|
// Verify that the vtable is emitted.
|
|
// CHECK-DAG: @_ZTVN5Test11XE = unnamed_addr constant
|
|
}
|
|
|
|
namespace Test2 {
|
|
struct X {
|
|
virtual ~X() = default; // Not a key function.
|
|
virtual void f(); // Key function.
|
|
};
|
|
|
|
void X::f() {}
|
|
|
|
// Verify that the vtable is emitted.
|
|
// CHECK-DAG: @_ZTVN5Test21XE = unnamed_addr constant
|
|
}
|
|
|
|
namespace Test3 {
|
|
struct X {
|
|
virtual ~X() = delete; // Not a key function.
|
|
virtual void f(); // Key function.
|
|
};
|
|
|
|
void X::f() {}
|
|
|
|
// Verify that the vtable is emitted.
|
|
// CHECK-DAG: @_ZTVN5Test31XE = unnamed_addr constant
|
|
}
|