diff options
author | Piotr Padlewski <prazek@google.com> | 2015-08-19 20:09:09 +0000 |
---|---|---|
committer | Piotr Padlewski <prazek@google.com> | 2015-08-19 20:09:09 +0000 |
commit | 1d02f681a94d7e898b16f8a79083a65f397c9d9d (patch) | |
tree | 23ee8a53b72632be45d255d30c58b7e796e7bad4 /clang/test/CodeGenCXX/vtable-available-externally.cpp | |
parent | a431f152dffa62b01b45d74119c7b04857bc25d8 (diff) | |
download | bcm5719-llvm-1d02f681a94d7e898b16f8a79083a65f397c9d9d.tar.gz bcm5719-llvm-1d02f681a94d7e898b16f8a79083a65f397c9d9d.zip |
Generating available_externally vtables bugfix
Bugfix revealed in r245264.
http://reviews.llvm.org/D12128
llvm-svn: 245489
Diffstat (limited to 'clang/test/CodeGenCXX/vtable-available-externally.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/vtable-available-externally.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/vtable-available-externally.cpp b/clang/test/CodeGenCXX/vtable-available-externally.cpp index ab090936cbd..4527efca96f 100644 --- a/clang/test/CodeGenCXX/vtable-available-externally.cpp +++ b/clang/test/CodeGenCXX/vtable-available-externally.cpp @@ -7,6 +7,10 @@ // RUN: FileCheck --check-prefix=CHECK-TEST9 %s < %t.opt // RUN: FileCheck --check-prefix=CHECK-TEST10 %s < %t.opt // RUN: FileCheck --check-prefix=CHECK-TEST11 %s < %t.opt +// RUN: FileCheck --check-prefix=CHECK-TEST12 %s < %t.opt +// RUN: FileCheck --check-prefix=CHECK-TEST13 %s < %t.opt +// RUN: FileCheck --check-prefix=CHECK-TEST14 %s < %t.opt +// RUN: FileCheck --check-prefix=CHECK-TEST15 %s < %t.opt #include <typeinfo> @@ -289,3 +293,76 @@ void g() { g(d); } } // Test 11 + +namespace Test12 { + +// CHECK-TEST12: @_ZTVN6Test121AE = external unnamed_addr constant +struct A { + virtual void foo(); + virtual ~A() {} +}; +// CHECK-TEST12: @_ZTVN6Test121BE = external unnamed_addr constant +struct B : A { + void foo(); +}; + +void g() { + A a; + a.foo(); + B b; + b.foo(); +} +} + +namespace Test13 { + +// CHECK-TEST13-DAG: @_ZTVN6Test131AE = available_externally unnamed_addr constant +// CHECK-TEST13-DAG: @_ZTVN6Test131BE = external unnamed_addr constant +struct A { + virtual ~A(); +}; +struct B : A { + virtual void f(); + void operator delete(void *); + ~B() {} +}; + +void g() { + A *b = new B; +} +} + +namespace Test14 { + +// CHECK-TEST14: @_ZTVN6Test141AE = available_externally unnamed_addr constant +struct A { + virtual void f(); + void operator delete(void *); + ~A(); +}; + +void g() { + A *b = new A; + delete b; +} +} + +namespace Test15 { +// In this test D's vtable has two slots for function f(), but uses only one, +// so the second slot is set to null. +// CHECK-TEST15: @_ZTVN6Test151DE = available_externally unnamed_addr constant +struct A { virtual void f() {} }; +struct B : virtual A {}; +struct C : virtual A {}; +struct D : B, C { + virtual void g(); + void f(); +}; + +void test() { + D * d = new D; + d->f(); +} +} + + |