forked from OSchip/llvm-project
Add codegen for __builtin_abort. Convert to FileCheck.
llvm-svn: 83427
This commit is contained in:
parent
c6d171ec77
commit
da6822f584
|
@ -331,7 +331,7 @@ BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:")
|
|||
|
||||
BUILTIN(__builtin_expect, "iii" , "nc")
|
||||
BUILTIN(__builtin_prefetch, "vvC*.", "nc")
|
||||
BUILTIN(__builtin_abort, "v", "nr")
|
||||
BUILTIN(__builtin_abort, "v", "Fnr")
|
||||
BUILTIN(__builtin_trap, "v", "nr")
|
||||
BUILTIN(__builtin_unreachable, "v", "nr")
|
||||
|
||||
|
|
|
@ -1,69 +1,77 @@
|
|||
// RUN: clang-cc -emit-llvm -triple i386-linux-gnu -o %t %s &&
|
||||
// RUN: grep 't1.*noreturn' %t &&
|
||||
// RUN: grep 't2.*nounwind' %t &&
|
||||
// RUN: grep 'weak.*t3' %t &&
|
||||
// RUN: grep 'hidden.*t4' %t &&
|
||||
// RUN: grep 't5.*weak' %t &&
|
||||
// RUN: grep 't6.*protected' %t &&
|
||||
// RUN: grep 't7.*noreturn' %t &&
|
||||
// RUN: grep 't7.*nounwind' %t &&
|
||||
// RUN: grep 't9.*alias.*weak.*t8' %t &&
|
||||
// RUN: grep '@t10().*section "SECT"' %t &&
|
||||
// RUN: grep '@t11().*section "SECT"' %t &&
|
||||
// RUN: grep '@t12 =.*section "SECT"' %t &&
|
||||
// RUN: grep '@t13 =.*section "SECT"' %t &&
|
||||
// RUN: grep '@t14.x =.*section "SECT"' %t &&
|
||||
// RUN: grep 'declare extern_weak i32 @t15()' %t &&
|
||||
// RUN: grep '@t16 = extern_weak global i32' %t &&
|
||||
|
||||
void t1() __attribute__((noreturn));
|
||||
void t1() { while (1) {} }
|
||||
|
||||
void t2() __attribute__((nothrow));
|
||||
void t2() {}
|
||||
|
||||
void t3() __attribute__((weak));
|
||||
void t3() {}
|
||||
|
||||
void t4() __attribute__((visibility("hidden")));
|
||||
void t4() {}
|
||||
// RUN: FileCheck --input-file=%t %s
|
||||
|
||||
// CHECK: @t5 = weak global i32 2
|
||||
int t5 __attribute__((weak)) = 2;
|
||||
|
||||
int t6 __attribute__((visibility("protected")));
|
||||
|
||||
void t7() __attribute__((noreturn, nothrow));
|
||||
void t7() { while (1) {} }
|
||||
|
||||
void __t8() {}
|
||||
void t9() __attribute__((weak, alias("__t8")));
|
||||
|
||||
void t10(void) __attribute__((section("SECT")));
|
||||
void t10(void) {}
|
||||
void __attribute__((section("SECT"))) t11(void) {}
|
||||
|
||||
int t12 __attribute__((section("SECT")));
|
||||
// CHECK: @t13 = global %0 zeroinitializer, section "SECT"
|
||||
struct s0 { int x; };
|
||||
struct s0 t13 __attribute__((section("SECT"))) = { 0 };
|
||||
|
||||
// CHECK: @t14.x = internal global i32 0, section "SECT"
|
||||
void t14(void) {
|
||||
static int x __attribute__((section("SECT"))) = 0;
|
||||
}
|
||||
|
||||
int __attribute__((weak_import)) t15(void);
|
||||
// CHECK: @t18 = global i32 1, align 4
|
||||
extern int t18 __attribute__((weak_import));
|
||||
int t18 = 1;
|
||||
|
||||
// CHECK: @t16 = extern_weak global i32
|
||||
extern int t16 __attribute__((weak_import));
|
||||
|
||||
// CHECK: @t6 = common protected global i32 0
|
||||
int t6 __attribute__((visibility("protected")));
|
||||
|
||||
// CHECK: @t12 = global i32 0, section "SECT"
|
||||
int t12 __attribute__((section("SECT")));
|
||||
|
||||
// CHECK: @t9 = alias weak bitcast (void ()* @__t8 to void (...)*)
|
||||
void __t8() {}
|
||||
void t9() __attribute__((weak, alias("__t8")));
|
||||
|
||||
// CHECK: declare extern_weak i32 @t15()
|
||||
int __attribute__((weak_import)) t15(void);
|
||||
int t17() {
|
||||
return t15() + t16;
|
||||
}
|
||||
|
||||
// RUN: grep '@t18 = global i[0-9]* 1, align .*' %t &&
|
||||
extern int t18 __attribute__((weak_import));
|
||||
int t18 = 1;
|
||||
// CHECK: define void @t1() noreturn nounwind {
|
||||
void t1() __attribute__((noreturn));
|
||||
void t1() { while (1) {} }
|
||||
|
||||
// RUN: grep 'define i[0-9]* @t19()' %t &&
|
||||
// CHECK: define void @t2() nounwind {
|
||||
void t2() __attribute__((nothrow));
|
||||
void t2() {}
|
||||
|
||||
// CHECK: define weak void @t3() nounwind {
|
||||
void t3() __attribute__((weak));
|
||||
void t3() {}
|
||||
|
||||
// CHECK: define hidden void @t4() nounwind {
|
||||
void t4() __attribute__((visibility("hidden")));
|
||||
void t4() {}
|
||||
|
||||
// CHECK: define void @t7() noreturn nounwind {
|
||||
void t7() __attribute__((noreturn, nothrow));
|
||||
void t7() { while (1) {} }
|
||||
|
||||
// CHECK: define void @t10() nounwind section "SECT" {
|
||||
void t10(void) __attribute__((section("SECT")));
|
||||
void t10(void) {}
|
||||
// CHECK: define void @t11() nounwind section "SECT" {
|
||||
void __attribute__((section("SECT"))) t11(void) {}
|
||||
|
||||
// CHECK: define i32 @t19() nounwind {
|
||||
extern int t19(void) __attribute__((weak_import));
|
||||
int t19(void) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
// RUN: true
|
||||
// CHECK:define void @t20() nounwind {
|
||||
// CHECK-NEXT:entry:
|
||||
// CHECK-NEXT: call void @abort()
|
||||
// CHECK-NEXT: unreachable
|
||||
void t20(void) {
|
||||
__builtin_abort();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue