summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-02-16 09:31:36 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-02-16 09:31:36 +0000
commitfd035e6496665b1f1197868e21cb0a4594e8db6e (patch)
tree53010172e19c77ea447bcd89e117cda052ab52e0 /test/CodeGen
parent2fce988e86bc01829142e4362d4eff1af0925147 (diff)
downloadFreeBSD-src-fd035e6496665b1f1197868e21cb0a4594e8db6e.zip
FreeBSD-src-fd035e6496665b1f1197868e21cb0a4594e8db6e.tar.gz
Update clang to r96341.
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/2010-02-09-DbgSelf.m14
-rw-r--r--test/CodeGen/2010-02-15-Dbg-MethodStart.m15
-rw-r--r--test/CodeGen/address-space-field1.c4
-rw-r--r--test/CodeGen/arm-arguments.c61
-rw-r--r--test/CodeGen/attributes.c7
-rw-r--r--test/CodeGen/darwin-string-literals.c4
-rw-r--r--test/CodeGen/debug-info-crash.c21
-rw-r--r--test/CodeGen/enum.c1
-rw-r--r--test/CodeGen/function-attributes.c8
-rw-r--r--test/CodeGen/stdcall-fastcall.c20
-rw-r--r--test/CodeGen/union.c3
11 files changed, 152 insertions, 6 deletions
diff --git a/test/CodeGen/2010-02-09-DbgSelf.m b/test/CodeGen/2010-02-09-DbgSelf.m
new file mode 100644
index 0000000..e09adac
--- /dev/null
+++ b/test/CodeGen/2010-02-09-DbgSelf.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | grep "\"self\", metadata"
+// Test to check that "self" argument is assigned a location.
+
+@interface Foo
+-(void) Bar: (int)x ;
+@end
+
+
+@implementation Foo
+-(void) Bar: (int)x
+{
+}
+@end
+
diff --git a/test/CodeGen/2010-02-15-Dbg-MethodStart.m b/test/CodeGen/2010-02-15-Dbg-MethodStart.m
new file mode 100644
index 0000000..5186b20
--- /dev/null
+++ b/test/CodeGen/2010-02-15-Dbg-MethodStart.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | grep subprogram | grep "i32 9"
+// Test to check that subprogram start location.
+
+@interface Foo
+-(int) barMethod;
+@end
+
+@implementation Foo
+-(int) barMethod {
+ int i = 0;
+ int j = 1;
+ int k = 1;
+ return i + j + k;
+}
+@end
diff --git a/test/CodeGen/address-space-field1.c b/test/CodeGen/address-space-field1.c
index 61d88f9..a81e08e 100644
--- a/test/CodeGen/address-space-field1.c
+++ b/test/CodeGen/address-space-field1.c
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -emit-llvm < %s -o - | FileCheck %s
// CHECK:%struct.S = type { i32, i32 }
// CHECK:define void @test_addrspace(%struct.S addrspace(1)* %p1, %struct.S addrspace(2)* %p2) nounwind
-// CHECK: [[p1addr:%.*]] = alloca %struct.S addrspace(1)* ; <%struct.S addrspace(1)**> [#uses=3]
-// CHECK: [[p2addr:%.*]] = alloca %struct.S addrspace(2)* ; <%struct.S addrspace(2)**> [#uses=3]
+// CHECK: [[p1addr:%.*]] = alloca %struct.S addrspace(1)*
+// CHECK: [[p2addr:%.*]] = alloca %struct.S addrspace(2)*
// CHECK: store %struct.S addrspace(1)* %p1, %struct.S addrspace(1)** [[p1addr]]
// CHECK: store %struct.S addrspace(2)* %p2, %struct.S addrspace(2)** [[p2addr]]
// CHECK: [[t0:%.*]] = load %struct.S addrspace(2)** [[p2addr]] ; <%struct.S addrspace(2)*> [#uses=1]
diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c
index fb61b0f..d313a9b 100644
--- a/test/CodeGen/arm-arguments.c
+++ b/test/CodeGen/arm-arguments.c
@@ -92,3 +92,64 @@ void f15(struct s7 a0) {}
// APCS-GNU: define arm_apcscc void @f16()
// AAPCS: define arm_aapcscc void @f16()
void f16(struct s8 a0) {}
+
+// APCS-GNU: define arm_apcscc i32 @f17()
+// AAPCS: define arm_aapcscc i32 @f17()
+struct s17 { short f0 : 13; char f1 : 4; };
+struct s17 f17(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f18()
+// AAPCS: define arm_aapcscc i32 @f18()
+struct s18 { short f0; char f1 : 4; };
+struct s18 f18(void) {}
+
+// APCS-GNU: define arm_apcscc void @f19(
+// APCS-GNU: struct.s19* noalias sret
+// AAPCS: define arm_aapcscc i32 @f19()
+struct s19 { int f0; struct s8 f1; };
+struct s19 f19(void) {}
+
+// APCS-GNU: define arm_apcscc void @f20(
+// APCS-GNU: struct.s20* noalias sret
+// AAPCS: define arm_aapcscc i32 @f20()
+struct s20 { struct s8 f1; int f0; };
+struct s20 f20(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f21()
+// AAPCS: define arm_aapcscc i32 @f21()
+struct s21 { struct {} f1; int f0 : 4; };
+struct s21 f21(void) {}
+
+// APCS-GNU: define arm_apcscc i16 @f22()
+// APCS-GNU: define arm_apcscc i32 @f23()
+// APCS-GNU: define arm_apcscc i64 @f24()
+// APCS-GNU: define arm_apcscc i128 @f25()
+// APCS-GNU: define arm_apcscc i64 @f26()
+// APCS-GNU: define arm_apcscc i128 @f27()
+// AAPCS: define arm_aapcscc i16 @f22()
+// AAPCS: define arm_aapcscc i32 @f23()
+// AAPCS: define arm_aapcscc void @f24({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f25({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f26({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f27({{.*}} noalias sret
+_Complex char f22(void) {}
+_Complex short f23(void) {}
+_Complex int f24(void) {}
+_Complex long long f25(void) {}
+_Complex float f26(void) {}
+_Complex double f27(void) {}
+
+// APCS-GNU: define arm_apcscc i16 @f28()
+// AAPCS: define arm_aapcscc i16 @f28()
+struct s28 { _Complex char f0; };
+struct s28 f28() {}
+
+// APCS-GNU: define arm_apcscc i32 @f29()
+// AAPCS: define arm_aapcscc i32 @f29()
+struct s29 { _Complex short f0; };
+struct s29 f29() {}
+
+// APCS-GNU: define arm_apcscc void @f30({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret
+struct s30 { _Complex int f0; };
+struct s30 f30() {}
diff --git a/test/CodeGen/attributes.c b/test/CodeGen/attributes.c
index 68bc73d..770ce76 100644
--- a/test/CodeGen/attributes.c
+++ b/test/CodeGen/attributes.c
@@ -74,3 +74,10 @@ int t19(void) {
void t20(void) {
__builtin_abort();
}
+
+void (__attribute__((fastcall)) *fptr)(int);
+void t21(void) {
+ fptr(10);
+}
+// CHECK: [[FPTRVAR:%[a-z0-9]+]] = load void (i32)** @fptr
+// CHECK-NEXT: call x86_fastcallcc void [[FPTRVAR]](i32 10)
diff --git a/test/CodeGen/darwin-string-literals.c b/test/CodeGen/darwin-string-literals.c
index b665321..8734295 100644
--- a/test/CodeGen/darwin-string-literals.c
+++ b/test/CodeGen/darwin-string-literals.c
@@ -2,13 +2,13 @@
// CHECK-LSB: @.str = private constant [8 x i8] c"string0\00"
// CHECK-LSB: @.str1 = private constant [8 x i8] c"string1\00"
-// CHECK-LSB: @.str2 = internal constant [36 x i8] c"h\00e\00l\00l\00o\00 \00\92! \00\03& \00\90! \00w\00o\00r\00l\00d\00\00\00", section "__TEXT,__ustring", align 2
+// CHECK-LSB: @.str2 = internal constant [36 x i8] c"h\00e\00l\00l\00o\00 \00\92! \00\03& \00\90! \00w\00o\00r\00l\00d\00\00\00", align 2
// RUN: %clang_cc1 -triple powerpc-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix MSB %s
// CHECK-MSB: @.str = private constant [8 x i8] c"string0\00"
// CHECK-MSB: @.str1 = private constant [8 x i8] c"string1\00"
-// CHECK-MSB: @.str2 = internal constant [36 x i8] c"\00h\00e\00l\00l\00o\00 !\92\00 &\03\00 !\90\00 \00w\00o\00r\00l\00d\00\00", section "__TEXT,__ustring", align 2
+// CHECK-MSB: @.str2 = internal constant [36 x i8] c"\00h\00e\00l\00l\00o\00 !\92\00 &\03\00 !\90\00 \00w\00o\00r\00l\00d\00\00", align 2
const char *g0 = "string0";
const void *g1 = __builtin___CFStringMakeConstantString("string1");
diff --git a/test/CodeGen/debug-info-crash.c b/test/CodeGen/debug-info-crash.c
new file mode 100644
index 0000000..e0c9dd4
--- /dev/null
+++ b/test/CodeGen/debug-info-crash.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -g -S %s -o -
+
+// rdar://7590323
+typedef struct dispatch_queue_s *dispatch_queue_t;
+__attribute__((visibility("default")))
+extern struct dispatch_queue_s _dispatch_main_q;
+typedef struct dispatch_item_s *dispatch_item_t;
+typedef void (^dispatch_legacy_block_t)(dispatch_item_t);
+dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq,
+ dispatch_legacy_block_t dispatch_block,
+ dispatch_legacy_block_t callback_block) {
+ dispatch_queue_t lq = _dispatch_queue_get_current() ?: (&_dispatch_main_q);
+ dispatch_async(dq, ^{
+ if (callback_block) {
+ dispatch_async(lq, ^{
+ }
+ );
+ }
+ }
+ );
+}
diff --git a/test/CodeGen/enum.c b/test/CodeGen/enum.c
index 771fc6b..eab32c1 100644
--- a/test/CodeGen/enum.c
+++ b/test/CodeGen/enum.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm-bc -o - | opt -std-compile-opts | llvm-dis | grep 'ret i32 6'
+// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -emit-llvm-bc -o - | opt -std-compile-opts | llvm-dis | grep 'ret i32 7'
static enum { foo, bar = 1U } z;
diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c
index 8ddaa28..3a1030a 100644
--- a/test/CodeGen/function-attributes.c
+++ b/test/CodeGen/function-attributes.c
@@ -81,3 +81,11 @@ void f14(int a) {
// CHECK: {
void f15(void) {
}
+
+// PR5254
+// CHECK: define void @f16
+// CHECK: alignstack(16)
+// CHECK: {
+void __attribute__((force_align_arg_pointer)) f16(void) {
+}
+
diff --git a/test/CodeGen/stdcall-fastcall.c b/test/CodeGen/stdcall-fastcall.c
index 838ccfb..bea6df3 100644
--- a/test/CodeGen/stdcall-fastcall.c
+++ b/test/CodeGen/stdcall-fastcall.c
@@ -1,17 +1,33 @@
-// RUN: %clang_cc1 -emit-llvm < %s | grep 'fastcallcc' | count 4
-// RUN: %clang_cc1 -emit-llvm < %s | grep 'stdcallcc' | count 4
+// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
void __attribute__((fastcall)) f1(void);
void __attribute__((stdcall)) f2(void);
void __attribute__((fastcall)) f3(void) {
+// CHECK: define x86_fastcallcc void @f3()
f1();
+// CHECK: call x86_fastcallcc void @f1()
}
void __attribute__((stdcall)) f4(void) {
+// CHECK: define x86_stdcallcc void @f4()
f2();
+// CHECK: call x86_stdcallcc void @f2()
}
+// PR5280
+void (__attribute__((fastcall)) *pf1)(void) = f1;
+void (__attribute__((stdcall)) *pf2)(void) = f2;
+void (__attribute__((fastcall)) *pf3)(void) = f3;
+void (__attribute__((stdcall)) *pf4)(void) = f4;
+
int main(void) {
f3(); f4();
+ // CHECK: call x86_fastcallcc void @f3()
+ // CHECK: call x86_stdcallcc void @f4()
+ pf1(); pf2(); pf3(); pf4();
+ // CHECK: call x86_fastcallcc void %{{.*}}()
+ // CHECK: call x86_stdcallcc void %{{.*}}()
+ // CHECK: call x86_fastcallcc void %{{.*}}()
+ // CHECK: call x86_stdcallcc void %{{.*}}()
return 0;
}
diff --git a/test/CodeGen/union.c b/test/CodeGen/union.c
index b40a405..1883ca6 100644
--- a/test/CodeGen/union.c
+++ b/test/CodeGen/union.c
@@ -39,3 +39,6 @@ int qfunc() {q buf; unsigned char* x = buf.x;}
union RR {_Bool a : 1;} RRU;
int RRF(void) {return RRU.a;}
+// PR6164
+typedef union T0 { unsigned int : 0; } T0;
+T0 t0;
OpenPOWER on IntegriCloud