xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/cxx11-vtable-key-function.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 | FileCheck %s
2*f4a2713aSLionel Sambuc // PR13424
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc namespace Test1 {
5*f4a2713aSLionel Sambuc struct X {
6*f4a2713aSLionel Sambuc   virtual ~X(); // Key function.
7*f4a2713aSLionel Sambuc   virtual void f(); // Not a key function.
8*f4a2713aSLionel Sambuc };
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc X::~X() = default;
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc // Verify that the vtable is emitted.
13*f4a2713aSLionel Sambuc // CHECK: @_ZTVN5Test11XE = unnamed_addr constant
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc namespace Test2 {
17*f4a2713aSLionel Sambuc struct X {
18*f4a2713aSLionel Sambuc   virtual ~X() = default; // Not a key function.
19*f4a2713aSLionel Sambuc   virtual void f(); // Key function.
20*f4a2713aSLionel Sambuc };
21*f4a2713aSLionel Sambuc 
f()22*f4a2713aSLionel Sambuc void X::f() {}
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc // Verify that the vtable is emitted.
25*f4a2713aSLionel Sambuc // CHECK: @_ZTVN5Test21XE = unnamed_addr constant
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc namespace Test3 {
29*f4a2713aSLionel Sambuc struct X {
30*f4a2713aSLionel Sambuc   virtual ~X() = delete; // Not a key function.
31*f4a2713aSLionel Sambuc   virtual void f(); // Key function.
32*f4a2713aSLionel Sambuc };
33*f4a2713aSLionel Sambuc 
f()34*f4a2713aSLionel Sambuc void X::f() {}
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc // Verify that the vtable is emitted.
37*f4a2713aSLionel Sambuc // CHECK: @_ZTVN5Test31XE = unnamed_addr constant
38*f4a2713aSLionel Sambuc }
39