Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / key-function-vtable.cpp
blob3e0a47595f762eb4b001b8d7d0e9418949b667c4
1 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple arm-apple-darwin %s -emit-llvm -o - | FileCheck %s
4 // Simple key function test
5 struct testa { virtual void a(); };
6 void testa::a() {}
8 // Simple key function test
9 struct testb { virtual void a() {} };
10 testb *testbvar = new testb;
12 // Key function with out-of-line inline definition
13 struct testc { virtual void a(); };
14 inline void testc::a() {}
16 // Functions with inline specifier are not key functions (PR5705)
17 struct testd { inline virtual void a(); };
18 void testd::a() {}
20 // Functions with inline specifier are not key functions (PR5705)
21 struct teste { inline virtual void a(); };
22 teste *testevar = new teste;
24 // Key functions with namespace (PR5711)
25 namespace {
26 struct testf { virtual void a(); };
28 void testf::a() {}
30 // Key functions with namespace (PR5711)
31 namespace {
32 struct testg { virtual void a(); };
34 void testg::a() {}
35 testg *testgvar = new testg;
37 struct X0 { virtual ~X0(); };
38 struct X1 : X0 {
39 virtual void f();
42 inline void X1::f() { }
44 void use_X1() { X1 x1; }
46 // CHECK-DAG: @_ZTV2X1 = linkonce_odr unnamed_addr constant
47 // CHECK-DAG: @_ZTV5testa ={{.*}} unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null
48 // CHECK-DAG: @_ZTV5testc = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null
49 // CHECK-DAG: @_ZTV5testb = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null
50 // CHECK-DAG: @_ZTV5teste = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null
51 // CHECK-DAG: @_ZTVN12_GLOBAL__N_15testgE = internal unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null