aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:50:08 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-21 10:50:08 +0000
commitc0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (patch)
tree508d4388db78f87d35bf26a0400b4b03bc4c1f13 /test/CodeGenCXX
parent4a37f65f1c1373c9956d118a012943de2f61edb0 (diff)
Notes
Diffstat (limited to 'test/CodeGenCXX')
-rw-r--r--test/CodeGenCXX/attr.cpp8
-rw-r--r--test/CodeGenCXX/cxx-apple-kext.cpp36
-rw-r--r--test/CodeGenCXX/deferred-global-init.cpp2
-rw-r--r--test/CodeGenCXX/global-dtor-no-atexit.cpp14
-rw-r--r--test/CodeGenCXX/global-init.cpp2
-rw-r--r--test/CodeGenCXX/mangle.cpp15
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp4
7 files changed, 77 insertions, 4 deletions
diff --git a/test/CodeGenCXX/attr.cpp b/test/CodeGenCXX/attr.cpp
index 4c781c62b29f..d689a4fdf493 100644
--- a/test/CodeGenCXX/attr.cpp
+++ b/test/CodeGenCXX/attr.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// CHECK: @test2 = alias i32 ()* @_Z5test1v
+
// CHECK: define i32 @_Z3foov() nounwind align 1024
int foo() __attribute__((aligned(1024)));
int foo() { }
@@ -18,3 +20,9 @@ void C::bar2() { }
// CHECK: define void @_ZN1C4bar3Ev(%class.C* %this) nounwind align 1024
void C::bar3() { }
+
+// PR6635
+// CHECK: define i32 @_Z5test1v()
+int test1() { return 10; }
+// CHECK at top of file
+extern "C" int test2() __attribute__((alias("_Z5test1v")));
diff --git a/test/CodeGenCXX/cxx-apple-kext.cpp b/test/CodeGenCXX/cxx-apple-kext.cpp
new file mode 100644
index 000000000000..8d67b53657af
--- /dev/null
+++ b/test/CodeGenCXX/cxx-apple-kext.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 %s -flto -S -o - |\
+// RUN: FileCheck --check-prefix=CHECK-NO-KEXT %s
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 %s -fapple-kext -flto -S -o - |\
+// RUN: FileCheck --check-prefix=CHECK-KEXT %s
+
+// CHECK-NO-KEXT: @_ZTI3foo = {{.*}} @_ZTVN10__cxxabiv117
+// CHECK-NO-KEXT-NOT: _GLOBAL__D_a
+// CHECK-NO-KEXT: @is_hosted = global
+// CHECK-NO-KEXT: call i32 @__cxa_atexit({{.*}} @_ZN3fooD1Ev
+// CHECK-NO-KEXT: declare i32 @__cxa_atexit
+
+// CHECK-KEXT: @_ZTV3foo =
+// CHECK-KEXT-NOT: @_ZTVN10__cxxabiv117
+// CHECK-KEXT-NOT: call i32 @__cxa_atexit({{.*}} @_ZN3fooD1Ev
+// CHECK-KEXT-NOT: declare i32 @__cxa_atexit
+// CHECK-KEXT: @is_freestanding = global
+// CHECK-KEXT: _GLOBAL__D_a
+// CHECK-KEXT: call void @_ZN3fooD1Ev(%class.foo* @a)
+
+class foo {
+public:
+ foo();
+ virtual ~foo();
+};
+
+foo a;
+foo::~foo() {}
+
+#if !(__STDC_HOSTED__ == 1)
+int is_freestanding = 1;
+#else
+int is_hosted = 1;
+#endif
+
+extern "C" void f1() {
+}
diff --git a/test/CodeGenCXX/deferred-global-init.cpp b/test/CodeGenCXX/deferred-global-init.cpp
index 802042dd8b90..24c8c675b006 100644
--- a/test/CodeGenCXX/deferred-global-init.cpp
+++ b/test/CodeGenCXX/deferred-global-init.cpp
@@ -11,6 +11,6 @@ void* bar() { return a; }
// CHECK: load i8** @foo
// CHECK: ret void
-// CHECK: define internal void @__cxx_global_initialization
+// CHECK: define internal void @_GLOBAL__I_a
// CHECK: call void @__cxx_global_var_init()
// CHECK: ret void
diff --git a/test/CodeGenCXX/global-dtor-no-atexit.cpp b/test/CodeGenCXX/global-dtor-no-atexit.cpp
new file mode 100644
index 000000000000..81e219989800
--- /dev/null
+++ b/test/CodeGenCXX/global-dtor-no-atexit.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple x86_64 %s -fno-use-cxa-atexit -emit-llvm -o - | FileCheck %s
+
+// CHECK: define internal void @_GLOBAL__D_a()
+// CHECK: call void @_ZN1AD1Ev(%class.A* @b)
+// CHECK: call void @_ZN1AD1Ev(%class.A* @a)
+// CHECK: }
+
+class A {
+public:
+ A();
+ ~A();
+};
+
+A a, b;
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp
index b60e056d708f..7cbd55940b43 100644
--- a/test/CodeGenCXX/global-init.cpp
+++ b/test/CodeGenCXX/global-init.cpp
@@ -28,4 +28,4 @@ C c;
// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1DD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @d, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
D d;
-// CHECK: define internal void @__cxx_global_initialization() {
+// CHECK: define internal void @_GLOBAL__I_a() {
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index 8dee41beb482..ec9c08c0ccaa 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -453,3 +453,18 @@ namespace test8 {
class B { static int value; };
template class A<B::value>;
}
+// CHECK: declare void @_ZN5test91fIiNS_3barEEEvRKNT0_3baz1XE
+namespace test9 {
+ template<class T>
+ struct foo {
+ typedef T X;
+ };
+ struct bar {
+ typedef foo<int> baz;
+ };
+ template <class zaz, class zed>
+ void f(const typename zed::baz::X&);
+ void g() {
+ f<int, bar>( 0);
+ }
+}
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index f11ae345cc7b..bc3d54b8e4a7 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -887,8 +887,8 @@ class E : virtual C { };
// CHECK-NEXT: -- (Test21::E, 8) vtable address --
// CHECK-NEXT: 15 | [unused] void Test21::F::f()
//
-// CHECK: Virtual base offset offsets for 'Test21::F'.
-// CHECK-NEXT: Test21::A | -32
+// CHECK: Virtual base offset offsets for 'Test21::F' (5 entries).
+// CHECK-NEXT: Test21::A | -32
// CHECK-NEXT: Test21::B | -40
// CHECK-NEXT: Test21::C | -48
// CHECK-NEXT: Test21::D | -56