mirror of
https://github.com/intel/llvm.git
synced 2026-02-06 06:31:50 +08:00
Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g., void func(); becomes void func(void); This is the tenth batch of tests being updated (there are a significant number of other tests left to be updated).
This commit is contained in:
@@ -1 +1 @@
|
||||
void test1() {}
|
||||
void test1(void) {}
|
||||
|
||||
@@ -1 +1 @@
|
||||
void test2() {}
|
||||
void test2(void) {}
|
||||
|
||||
@@ -1 +1 @@
|
||||
void foo() { }
|
||||
void foo(void) { }
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// CHECK: }
|
||||
|
||||
static _Bool f0_0(void *a0) { return (_Bool) a0; }
|
||||
int f0() { return f0_0((void*) 0x2); }
|
||||
int f0(void) { return f0_0((void*) 0x2); }
|
||||
|
||||
_Bool f1(void) {
|
||||
return (_Bool) ({ void (*x)(); x = 0; });
|
||||
return (_Bool) ({ void (*x)(void); x = 0; });
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ float f0(S0 h) {
|
||||
|
||||
// CHECK: define{{.*}} float @f0_call()
|
||||
// CHECK: %call = call float @f0([2 x float] %1)
|
||||
float f0_call() {
|
||||
float f0_call(void) {
|
||||
S0 h = {1.0f, 2.0f};
|
||||
return f0(h);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ double f1(S1 h) {
|
||||
|
||||
// CHECK: define{{.*}} double @f1_call()
|
||||
// CHECK: %call = call double @f1([2 x double] %1
|
||||
double f1_call() {
|
||||
double f1_call(void) {
|
||||
S1 h = {1.0, 2.0};
|
||||
return f1(h);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ double f2(S2 h) {
|
||||
// CHECK: define{{.*}} double @f2_call()
|
||||
// CHECK-AAPCS: %call = call double @f2([2 x double] alignstack(16) %1)
|
||||
// CHECK-DARWIN: %call = call double @f2([2 x double] %1
|
||||
double f2_call() {
|
||||
double f2_call(void) {
|
||||
S2 h = {1.0, 2.0};
|
||||
return f2(h);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ double f3(S3 h) {
|
||||
// CHECK: define{{.*}} double @f3_call()
|
||||
// CHECK-AAPCS: %call = call double @f3([4 x double] alignstack(16) %1)
|
||||
// CHECK-DARWIN: %call = call double @f3([4 x double] %1
|
||||
double f3_call() {
|
||||
double f3_call(void) {
|
||||
S3 h = {1.0, 2.0};
|
||||
return f3(h);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ EXTERNC int empty_arg(struct Empty e, int a) {
|
||||
// CHECK: define{{.*}} void @empty_ret()
|
||||
// CHECK-GNU-C: define{{.*}} void @empty_ret()
|
||||
// CHECK-GNU-CXX: define{{.*}} void @empty_ret()
|
||||
EXTERNC struct Empty empty_ret() {
|
||||
EXTERNC struct Empty empty_ret(void) {
|
||||
struct Empty e;
|
||||
return e;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ EXTERNC int sort_of_empty_arg(struct Empty e, int a) {
|
||||
// CHECK: define{{.*}} void @sort_of_empty_ret()
|
||||
// CHECK-GNU-C: define{{.*}} void @sort_of_empty_ret()
|
||||
// CHECK-GNU-CXX: define{{.*}} void @sort_of_empty_ret()
|
||||
EXTERNC struct SortOfEmpty sort_of_empty_ret() {
|
||||
EXTERNC struct SortOfEmpty sort_of_empty_ret(void) {
|
||||
struct SortOfEmpty e;
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void pass_large(struct large);
|
||||
//
|
||||
// Make sure we generate the appropriate lifetime markers for the temporary
|
||||
// allocas so that the optimizer can re-use stack slots if possible.
|
||||
void example() {
|
||||
void example(void) {
|
||||
struct large l = {0};
|
||||
pass_large(l);
|
||||
pass_large(l);
|
||||
|
||||
@@ -23,7 +23,7 @@ void test_generic_constraints(int var32, long var64) {
|
||||
|
||||
float f;
|
||||
double d;
|
||||
void test_constraint_w() {
|
||||
void test_constraint_w(void) {
|
||||
asm("fadd %s0, %s1, %s1" : "=w"(f) : "w"(f));
|
||||
// CHECK: [[FLT_ARG:%[a-zA-Z_0-9]+]] = load float, float* @f
|
||||
// CHECK: call float asm "fadd ${0:s}, ${1:s}, ${1:s}", "=w,w"(float [[FLT_ARG]])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK
|
||||
|
||||
void test_sve_asm() {
|
||||
void test_sve_asm(void) {
|
||||
asm volatile(
|
||||
"ptrue p0.d\n"
|
||||
"ptrue p15.d\n"
|
||||
|
||||
@@ -3,79 +3,79 @@
|
||||
|
||||
// CHECK: target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
|
||||
|
||||
int check_short() {
|
||||
int check_short(void) {
|
||||
return sizeof(short);
|
||||
// CHECK: ret i32 2
|
||||
}
|
||||
|
||||
int check_int() {
|
||||
int check_int(void) {
|
||||
return sizeof(int);
|
||||
// CHECK: ret i32 4
|
||||
}
|
||||
|
||||
int check_long() {
|
||||
int check_long(void) {
|
||||
// Both 4 and 8 are permitted under the PCS, Linux says 8!
|
||||
return sizeof(long);
|
||||
// CHECK: ret i32 8
|
||||
}
|
||||
|
||||
int check_longlong() {
|
||||
int check_longlong(void) {
|
||||
return sizeof(long long);
|
||||
// CHECK: ret i32 8
|
||||
}
|
||||
|
||||
int check_int128() {
|
||||
int check_int128(void) {
|
||||
return sizeof(__int128);
|
||||
// CHECK: ret i32 16
|
||||
}
|
||||
|
||||
int check_fp16() {
|
||||
int check_fp16(void) {
|
||||
return sizeof(__fp16);
|
||||
// CHECK: ret i32 2
|
||||
}
|
||||
|
||||
int check_float() {
|
||||
int check_float(void) {
|
||||
return sizeof(float);
|
||||
// CHECK: ret i32 4
|
||||
}
|
||||
|
||||
int check_double() {
|
||||
int check_double(void) {
|
||||
return sizeof(double);
|
||||
// CHECK: ret i32 8
|
||||
}
|
||||
|
||||
int check_longdouble() {
|
||||
int check_longdouble(void) {
|
||||
return sizeof(long double);
|
||||
// CHECK: ret i32 16
|
||||
}
|
||||
|
||||
int check_floatComplex() {
|
||||
int check_floatComplex(void) {
|
||||
return sizeof(float _Complex);
|
||||
// CHECK: ret i32 8
|
||||
}
|
||||
|
||||
int check_doubleComplex() {
|
||||
int check_doubleComplex(void) {
|
||||
return sizeof(double _Complex);
|
||||
// CHECK: ret i32 16
|
||||
}
|
||||
|
||||
int check_longdoubleComplex() {
|
||||
int check_longdoubleComplex(void) {
|
||||
return sizeof(long double _Complex);
|
||||
// CHECK: ret i32 32
|
||||
}
|
||||
|
||||
int check_bool() {
|
||||
int check_bool(void) {
|
||||
return sizeof(_Bool);
|
||||
// CHECK: ret i32 1
|
||||
}
|
||||
|
||||
int check_wchar() {
|
||||
int check_wchar(void) {
|
||||
// PCS allows either unsigned short or unsigned int. Linux again says "bigger!"
|
||||
return sizeof(__WCHAR_TYPE__);
|
||||
// CHECK: ret i32 4
|
||||
}
|
||||
|
||||
int check_wchar_unsigned() {
|
||||
int check_wchar_unsigned(void) {
|
||||
return (__WCHAR_TYPE__)-1 > (__WCHAR_TYPE__)0;
|
||||
// CHECK: ret i32 1
|
||||
}
|
||||
@@ -84,7 +84,7 @@ enum Small {
|
||||
Item
|
||||
};
|
||||
|
||||
int foo() {
|
||||
int foo(void) {
|
||||
return sizeof(enum Small);
|
||||
// CHECK: ret i32 4
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ struct hfa simple_hfa(void) {
|
||||
// non-aligned fundamental types.
|
||||
|
||||
typedef int underaligned_int __attribute__((packed,aligned(2)));
|
||||
underaligned_int underaligned_int_test() {
|
||||
underaligned_int underaligned_int_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @underaligned_int_test()
|
||||
return va_arg(the_list, underaligned_int);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -277,7 +277,7 @@ underaligned_int underaligned_int_test() {
|
||||
}
|
||||
|
||||
typedef int overaligned_int __attribute__((aligned(32)));
|
||||
overaligned_int overaligned_int_test() {
|
||||
overaligned_int overaligned_int_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @overaligned_int_test()
|
||||
return va_arg(the_list, overaligned_int);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -314,7 +314,7 @@ overaligned_int overaligned_int_test() {
|
||||
}
|
||||
|
||||
typedef long long underaligned_long_long __attribute__((packed,aligned(2)));
|
||||
underaligned_long_long underaligned_long_long_test() {
|
||||
underaligned_long_long underaligned_long_long_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i64 @underaligned_long_long_test()
|
||||
return va_arg(the_list, underaligned_long_long);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -347,7 +347,7 @@ underaligned_long_long underaligned_long_long_test() {
|
||||
}
|
||||
|
||||
typedef long long overaligned_long_long __attribute__((aligned(32)));
|
||||
overaligned_long_long overaligned_long_long_test() {
|
||||
overaligned_long_long overaligned_long_long_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i64 @overaligned_long_long_test()
|
||||
return va_arg(the_list, overaligned_long_long);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -380,7 +380,7 @@ overaligned_long_long overaligned_long_long_test() {
|
||||
}
|
||||
|
||||
typedef __int128 underaligned_int128 __attribute__((packed,aligned(2)));
|
||||
underaligned_int128 underaligned_int128_test() {
|
||||
underaligned_int128 underaligned_int128_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i128 @underaligned_int128_test()
|
||||
return va_arg(the_list, underaligned_int128);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -419,7 +419,7 @@ underaligned_int128 underaligned_int128_test() {
|
||||
}
|
||||
|
||||
typedef __int128 overaligned_int128 __attribute__((aligned(32)));
|
||||
overaligned_int128 overaligned_int128_test() {
|
||||
overaligned_int128 overaligned_int128_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i128 @overaligned_int128_test()
|
||||
return va_arg(the_list, overaligned_int128);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -472,7 +472,7 @@ overaligned_int128 overaligned_int128_test() {
|
||||
typedef struct __attribute__((packed,aligned(2))) {
|
||||
int val;
|
||||
} underaligned_int_struct;
|
||||
underaligned_int_struct underaligned_int_struct_test() {
|
||||
underaligned_int_struct underaligned_int_struct_test(void) {
|
||||
// CHECK-LE-LABEL: define{{.*}} i32 @underaligned_int_struct_test()
|
||||
// CHECK-BE-LABEL: define{{.*}} i64 @underaligned_int_struct_test()
|
||||
return va_arg(the_list, underaligned_int_struct);
|
||||
@@ -506,7 +506,7 @@ underaligned_int_struct underaligned_int_struct_test() {
|
||||
typedef struct __attribute__((aligned(16))) {
|
||||
int val;
|
||||
} overaligned_int_struct;
|
||||
overaligned_int_struct overaligned_int_struct_test() {
|
||||
overaligned_int_struct overaligned_int_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i128 @overaligned_int_struct_test()
|
||||
return va_arg(the_list, overaligned_int_struct);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -539,7 +539,7 @@ overaligned_int_struct overaligned_int_struct_test() {
|
||||
typedef struct __attribute__((packed,aligned(2))) {
|
||||
long long val;
|
||||
} underaligned_long_long_struct;
|
||||
underaligned_long_long_struct underaligned_long_long_struct_test() {
|
||||
underaligned_long_long_struct underaligned_long_long_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i64 @underaligned_long_long_struct_test()
|
||||
return va_arg(the_list, underaligned_long_long_struct);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -572,7 +572,7 @@ underaligned_long_long_struct underaligned_long_long_struct_test() {
|
||||
typedef struct __attribute__((aligned(16))) {
|
||||
long long val;
|
||||
} overaligned_long_long_struct;
|
||||
overaligned_long_long_struct overaligned_long_long_struct_test() {
|
||||
overaligned_long_long_struct overaligned_long_long_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i128 @overaligned_long_long_struct_test()
|
||||
return va_arg(the_list, overaligned_long_long_struct);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -605,7 +605,7 @@ overaligned_long_long_struct overaligned_long_long_struct_test() {
|
||||
typedef struct __attribute__((packed,aligned(2))) {
|
||||
__int128 val;
|
||||
} underaligned_int128_struct;
|
||||
underaligned_int128_struct underaligned_int128_struct_test() {
|
||||
underaligned_int128_struct underaligned_int128_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} [2 x i64] @underaligned_int128_struct_test()
|
||||
return va_arg(the_list, underaligned_int128_struct);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -639,7 +639,7 @@ underaligned_int128_struct underaligned_int128_struct_test() {
|
||||
typedef struct __attribute__((aligned(32))) {
|
||||
__int128 val;
|
||||
} overaligned_int128_struct;
|
||||
overaligned_int128_struct overaligned_int128_struct_test() {
|
||||
overaligned_int128_struct overaligned_int128_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @overaligned_int128_struct_test(%struct.overaligned_int128_struct* noalias sret(%struct.overaligned_int128_struct) align 32 %agg.result)
|
||||
return va_arg(the_list, overaligned_int128_struct);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -675,7 +675,7 @@ overaligned_int128_struct overaligned_int128_struct_test() {
|
||||
typedef struct {
|
||||
int val __attribute__((packed,aligned(2)));
|
||||
} underaligned_int_struct_member;
|
||||
underaligned_int_struct_member underaligned_int_struct_member_test() {
|
||||
underaligned_int_struct_member underaligned_int_struct_member_test(void) {
|
||||
// CHECK-LE-LABEL: define{{.*}} i32 @underaligned_int_struct_member_test()
|
||||
// CHECK-BE-LABEL: define{{.*}} i64 @underaligned_int_struct_member_test()
|
||||
return va_arg(the_list, underaligned_int_struct_member);
|
||||
@@ -709,7 +709,7 @@ underaligned_int_struct_member underaligned_int_struct_member_test() {
|
||||
typedef struct {
|
||||
int val __attribute__((aligned(16)));
|
||||
} overaligned_int_struct_member;
|
||||
overaligned_int_struct_member overaligned_int_struct_member_test() {
|
||||
overaligned_int_struct_member overaligned_int_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i128 @overaligned_int_struct_member_test()
|
||||
return va_arg(the_list, overaligned_int_struct_member);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -748,7 +748,7 @@ overaligned_int_struct_member overaligned_int_struct_member_test() {
|
||||
typedef struct {
|
||||
long long val __attribute__((packed,aligned(2)));
|
||||
} underaligned_long_long_struct_member;
|
||||
underaligned_long_long_struct_member underaligned_long_long_struct_member_test() {
|
||||
underaligned_long_long_struct_member underaligned_long_long_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i64 @underaligned_long_long_struct_member_test()
|
||||
return va_arg(the_list, underaligned_long_long_struct_member);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -781,7 +781,7 @@ underaligned_long_long_struct_member underaligned_long_long_struct_member_test()
|
||||
typedef struct {
|
||||
long long val __attribute__((aligned(16)));
|
||||
} overaligned_long_long_struct_member;
|
||||
overaligned_long_long_struct_member overaligned_long_long_struct_member_test() {
|
||||
overaligned_long_long_struct_member overaligned_long_long_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i128 @overaligned_long_long_struct_member_test()
|
||||
return va_arg(the_list, overaligned_long_long_struct_member);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -820,7 +820,7 @@ overaligned_long_long_struct_member overaligned_long_long_struct_member_test() {
|
||||
typedef struct {
|
||||
__int128 val __attribute__((packed,aligned(2)));
|
||||
} underaligned_int128_struct_member;
|
||||
underaligned_int128_struct_member underaligned_int128_struct_member_test() {
|
||||
underaligned_int128_struct_member underaligned_int128_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} [2 x i64] @underaligned_int128_struct_member_test()
|
||||
return va_arg(the_list, underaligned_int128_struct_member);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
@@ -854,7 +854,7 @@ underaligned_int128_struct_member underaligned_int128_struct_member_test() {
|
||||
typedef struct {
|
||||
__int128 val __attribute__((aligned(32)));
|
||||
} overaligned_int128_struct_member;
|
||||
overaligned_int128_struct_member overaligned_int128_struct_member_test() {
|
||||
overaligned_int128_struct_member overaligned_int128_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @overaligned_int128_struct_member_test(%struct.overaligned_int128_struct_member* noalias sret(%struct.overaligned_int128_struct_member) align 32 %agg.result)
|
||||
return va_arg(the_list, overaligned_int128_struct_member);
|
||||
// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
|
||||
|
||||
@@ -21,7 +21,7 @@ int i;
|
||||
|
||||
void foo();
|
||||
|
||||
void bar() {
|
||||
void bar(void) {
|
||||
static __flash const int var2[] = {555, 666, 777};
|
||||
static __flash3 const int f3var2[] = {5555, 6666, 7787};
|
||||
foo(var1[i]);
|
||||
|
||||
@@ -12,7 +12,7 @@ int a __attribute__((address_space(0)));
|
||||
|
||||
// CHECK-LABEL: define{{.*}} i32 @test1()
|
||||
// CHECK: load i32, i32 addrspace(1)* @foo
|
||||
int test1() { return foo; }
|
||||
int test1(void) { return foo; }
|
||||
|
||||
// CHECK-LABEL: define{{.*}} i32 @test2(i32 noundef %i)
|
||||
// CHECK: load i32, i32 addrspace(1)*
|
||||
@@ -29,7 +29,7 @@ __attribute__((address_space(2))) int *A, *B;
|
||||
// X86: load i32 addrspace(2)*, i32 addrspace(2)** @A
|
||||
// AMDGCN: load i32 addrspace(2)*, i32 addrspace(2)** addrspacecast (i32 addrspace(2)* addrspace(1)* @A to i32 addrspace(2)**)
|
||||
// CHECK: store i32 {{.*}}, i32 addrspace(2)*
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
*A = *B;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ void_ptr_arithmetic_test(void __attribute__((address_space(1))) *arg) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define{{.*}} i32* @test5(
|
||||
const unsigned *test5() {
|
||||
const unsigned *test5(void) {
|
||||
// Intentionally leave a part of an array uninitialized. This triggers a
|
||||
// different code path contrary to a fully initialized array.
|
||||
// CHECK: ret i32* getelementptr inbounds ([256 x i32]
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
extern const int g1[], g2[];
|
||||
|
||||
const int *f1() {
|
||||
const int *f1(void) {
|
||||
return g1;
|
||||
}
|
||||
|
||||
int f2() {
|
||||
int f2(void) {
|
||||
return g2[0];
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ struct S foo(void);
|
||||
|
||||
// CHECK-LABEL: define dso_local void @bar
|
||||
__attribute__((optnone))
|
||||
struct S bar() {
|
||||
struct S bar(void) {
|
||||
// O0-NOT: @llvm.lifetime.start
|
||||
// O0-NOT: @llvm.lifetime.end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ typedef struct __attribute((aligned(16))) {int x[4];} ff;
|
||||
|
||||
// CHECK: alloca %struct.ff, align 16
|
||||
// CHECK: alloca %struct.anon, align 16
|
||||
int a() {
|
||||
int a(void) {
|
||||
ff a;
|
||||
struct {int x[4];} b __attribute((aligned(16)));
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
// CHECK_8: .p2align 3, 0x90
|
||||
// CHECK_32: .p2align 5, 0x90
|
||||
|
||||
void bar();
|
||||
void foo() {
|
||||
void bar(void);
|
||||
void foo(void) {
|
||||
for (int i = 0; i < 64; ++i)
|
||||
bar();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void test6(float4align64 *p) {
|
||||
// CHECK: load <4 x float>, <4 x float>* {{.*}}, align 2
|
||||
|
||||
typedef int __attribute__((ext_vector_type(200 * 16))) BigVecTy;
|
||||
void test7() {
|
||||
void test7(void) {
|
||||
BigVecTy V;
|
||||
}
|
||||
// CHECK-LABEL: @test7
|
||||
|
||||
@@ -7,6 +7,6 @@ struct s0 {
|
||||
};
|
||||
|
||||
struct s0 t1_tmp;
|
||||
int f0() {
|
||||
int f0(void) {
|
||||
return __alignof__(t1_tmp);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ void *my_malloc(size_t) __attribute__((alloc_size(1)));
|
||||
void *my_calloc(size_t, size_t) __attribute__((alloc_size(1, 2)));
|
||||
|
||||
// CHECK-LABEL: @test1
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
void *const vp = my_malloc(100);
|
||||
// CHECK: store i32 100
|
||||
gi = OBJECT_SIZE_BUILTIN(vp, 0);
|
||||
@@ -82,7 +82,7 @@ void test1() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test2
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
void *const vp = my_malloc(gi);
|
||||
// CHECK: @llvm.objectsize
|
||||
gi = OBJECT_SIZE_BUILTIN(vp, 0);
|
||||
@@ -97,7 +97,7 @@ void test2() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test3
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
char *const buf = (char *)my_calloc(100, 5);
|
||||
// CHECK: store i32 500
|
||||
gi = OBJECT_SIZE_BUILTIN(buf, 0);
|
||||
@@ -117,7 +117,7 @@ struct Data {
|
||||
};
|
||||
|
||||
// CHECK-LABEL: @test5
|
||||
void test5() {
|
||||
void test5(void) {
|
||||
struct Data *const data = my_malloc(sizeof(*data));
|
||||
// CHECK: store i32 48
|
||||
gi = OBJECT_SIZE_BUILTIN(data, 0);
|
||||
@@ -158,7 +158,7 @@ void test5() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test6
|
||||
void test6() {
|
||||
void test6(void) {
|
||||
// Things that would normally trigger conservative estimates don't need to do
|
||||
// so when we know the source of the allocation.
|
||||
struct Data *const data = my_malloc(sizeof(*data) + 10);
|
||||
@@ -222,7 +222,7 @@ void test6() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test7
|
||||
void test7() {
|
||||
void test7(void) {
|
||||
struct Data *const data = my_malloc(sizeof(*data) + 5);
|
||||
// CHECK: store i32 9
|
||||
gi = OBJECT_SIZE_BUILTIN(data->pad, 0);
|
||||
@@ -235,7 +235,7 @@ void test7() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test8
|
||||
void test8() {
|
||||
void test8(void) {
|
||||
// Non-const pointers aren't currently supported.
|
||||
void *buf = my_calloc(100, 5);
|
||||
// CHECK: @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, i1
|
||||
@@ -249,7 +249,7 @@ void test8() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test9
|
||||
void test9() {
|
||||
void test9(void) {
|
||||
// Check to be sure that we unwrap things correctly.
|
||||
short *const buf0 = (my_malloc(100));
|
||||
short *const buf1 = (short*)(my_malloc(100));
|
||||
@@ -264,7 +264,7 @@ void test9() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test10
|
||||
void test10() {
|
||||
void test10(void) {
|
||||
// Yay overflow
|
||||
short *const arr = my_calloc((size_t)-1 / 2 + 1, 2);
|
||||
// CHECK: @llvm.objectsize
|
||||
@@ -304,7 +304,7 @@ void *my_tiny_malloc(char) __attribute__((alloc_size(1)));
|
||||
void *my_tiny_calloc(char, char) __attribute__((alloc_size(1, 2)));
|
||||
|
||||
// CHECK-LABEL: @test11
|
||||
void test11() {
|
||||
void test11(void) {
|
||||
void *const vp = my_tiny_malloc(100);
|
||||
// CHECK: store i32 100
|
||||
gi = OBJECT_SIZE_BUILTIN(vp, 0);
|
||||
@@ -332,7 +332,7 @@ void *my_signed_malloc(long) __attribute__((alloc_size(1)));
|
||||
void *my_signed_calloc(long, long) __attribute__((alloc_size(1, 2)));
|
||||
|
||||
// CHECK-LABEL: @test12
|
||||
void test12() {
|
||||
void test12(void) {
|
||||
// CHECK: store i32 100
|
||||
gi = OBJECT_SIZE_BUILTIN(my_signed_malloc(100), 0);
|
||||
// CHECK: store i32 500
|
||||
@@ -361,7 +361,7 @@ void test12() {
|
||||
void *alloc_uchar(unsigned char) __attribute__((alloc_size(1)));
|
||||
|
||||
// CHECK-LABEL: @test13
|
||||
void test13() {
|
||||
void test13(void) {
|
||||
// If 128 were incorrectly seen as negative, the result would become -1.
|
||||
// CHECK: store i32 128,
|
||||
gi = OBJECT_SIZE_BUILTIN(alloc_uchar(128), 0);
|
||||
@@ -371,7 +371,7 @@ void *(*malloc_function_pointer)(int)__attribute__((alloc_size(1)));
|
||||
void *(*calloc_function_pointer)(int, int)__attribute__((alloc_size(1, 2)));
|
||||
|
||||
// CHECK-LABEL: @test_fn_pointer
|
||||
void test_fn_pointer() {
|
||||
void test_fn_pointer(void) {
|
||||
void *const vp = malloc_function_pointer(100);
|
||||
// CHECK: store i32 100
|
||||
gi = __builtin_object_size(vp, 0);
|
||||
@@ -434,7 +434,7 @@ extern my_malloc_function_pointer_type malloc_function_pointer_with_typedef;
|
||||
extern my_calloc_function_pointer_type calloc_function_pointer_with_typedef;
|
||||
|
||||
// CHECK-LABEL: @test_fn_pointer_typedef
|
||||
void test_fn_pointer_typedef() {
|
||||
void test_fn_pointer_typedef(void) {
|
||||
malloc_function_pointer_with_typedef(100);
|
||||
void *const vp = malloc_function_pointer_with_typedef(100);
|
||||
// CHECK: store i32 100
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
// CHECK-NOT: foo
|
||||
|
||||
void bar() {
|
||||
void bar(void) {
|
||||
}
|
||||
|
||||
inline void __attribute__((__always_inline__)) foo() {
|
||||
inline void __attribute__((__always_inline__)) foo(void) {
|
||||
bar();
|
||||
}
|
||||
|
||||
void i_want_bar() {
|
||||
void i_want_bar(void) {
|
||||
foo();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef struct {
|
||||
int cc;
|
||||
} s2;
|
||||
// CHECK: define{{.*}} void @f2(%struct.s2* noalias sret(%struct.s2) align 4 %agg.result)
|
||||
s2 f2() {
|
||||
s2 f2(void) {
|
||||
s2 foo;
|
||||
return foo;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ typedef struct {
|
||||
int dd;
|
||||
} s3;
|
||||
// CHECK: define{{.*}} void @f3(%struct.s3* noalias sret(%struct.s3) align 4 %agg.result)
|
||||
s3 f3() {
|
||||
s3 f3(void) {
|
||||
s3 foo;
|
||||
return foo;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ typedef struct {
|
||||
|
||||
// CHECK: define{{.*}} i32 @f1
|
||||
// CHECK: ret i32 12
|
||||
int f1() {
|
||||
int f1(void) {
|
||||
return sizeof(s1);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ typedef struct {
|
||||
} s2;
|
||||
// CHECK: define{{.*}} i32 @f2
|
||||
// CHECK: ret i32 12
|
||||
int f2() {
|
||||
int f2(void) {
|
||||
return sizeof(s2);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
// word-aligned address and then loaded into r0 with an LDR instruction
|
||||
|
||||
extern union Us { short s; } us;
|
||||
union Us callee_us() { return us; }
|
||||
union Us callee_us(void) { return us; }
|
||||
// CHECK-LABEL: callee_us()
|
||||
// CHECK: zext i16
|
||||
// CHECK: shl
|
||||
// CHECK: ret i32
|
||||
|
||||
void caller_us() {
|
||||
void caller_us(void) {
|
||||
us = callee_us();
|
||||
// CHECK-LABEL: caller_us()
|
||||
// CHECK: call i32
|
||||
@@ -21,13 +21,13 @@ void caller_us() {
|
||||
}
|
||||
|
||||
extern struct Ss { short s; } ss;
|
||||
struct Ss callee_ss() { return ss; }
|
||||
struct Ss callee_ss(void) { return ss; }
|
||||
// CHECK-LABEL: callee_ss()
|
||||
// CHECK: zext i16
|
||||
// CHECK: shl
|
||||
// CHECK: ret i32
|
||||
|
||||
void caller_ss() {
|
||||
void caller_ss(void) {
|
||||
ss = callee_ss();
|
||||
// CHECK-LABEL: caller_ss()
|
||||
// CHECK: call i32
|
||||
|
||||
@@ -7,7 +7,7 @@ extern struct T {
|
||||
int b2 : 1;
|
||||
} g;
|
||||
|
||||
int func() {
|
||||
int func(void) {
|
||||
return g.b1;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ void f2(callback2_t *fptr)
|
||||
fptr();
|
||||
}
|
||||
|
||||
void f3() __attribute__((cmse_nonsecure_entry));
|
||||
void f3()
|
||||
void f3(void) __attribute__((cmse_nonsecure_entry));
|
||||
void f3(void)
|
||||
{
|
||||
}
|
||||
|
||||
void f4() __attribute__((cmse_nonsecure_entry))
|
||||
void f4(void) __attribute__((cmse_nonsecure_entry))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ void t1(__fp16 a) { g = a; }
|
||||
// NATIVE: define{{.*}} void @t1(half noundef [[PARAM:%.*]])
|
||||
// CHECK: store half [[PARAM]], half* @g
|
||||
|
||||
__fp16 t2() { return g; }
|
||||
__fp16 t2(void) { return g; }
|
||||
// SOFT: define{{.*}} half @t2()
|
||||
// HARD: define{{.*}} arm_aapcs_vfpcc half @t2()
|
||||
// NATIVE: define{{.*}} half @t2()
|
||||
@@ -25,7 +25,7 @@ void t3(_Float16 a) { h = a; }
|
||||
// NATIVE: define{{.*}} void @t3(half noundef [[PARAM:%.*]])
|
||||
// CHECK: store half [[PARAM]], half* @h
|
||||
|
||||
_Float16 t4() { return h; }
|
||||
_Float16 t4(void) { return h; }
|
||||
// SOFT: define{{.*}} half @t4()
|
||||
// HARD: define{{.*}} arm_aapcs_vfpcc half @t4()
|
||||
// NATIVE: define{{.*}} half @t4()
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
// RUN: %clang_cc1 -triple thumb-apple-darwin -target-abi aapcs -target-cpu cortex-m3 -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple arm-apple-darwin -target-abi apcs-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-APCS
|
||||
|
||||
__attribute__((interrupt)) void test_generic_interrupt() {
|
||||
__attribute__((interrupt)) void test_generic_interrupt(void) {
|
||||
// CHECK: define{{.*}} arm_aapcscc void @test_generic_interrupt() [[GENERIC_ATTR:#[0-9]+]]
|
||||
|
||||
// CHECK-APCS: define{{.*}} void @test_generic_interrupt() [[GENERIC_ATTR:#[0-9]+]]
|
||||
}
|
||||
|
||||
__attribute__((interrupt("IRQ"))) void test_irq_interrupt() {
|
||||
__attribute__((interrupt("IRQ"))) void test_irq_interrupt(void) {
|
||||
// CHECK: define{{.*}} arm_aapcscc void @test_irq_interrupt() [[IRQ_ATTR:#[0-9]+]]
|
||||
}
|
||||
|
||||
__attribute__((interrupt("FIQ"))) void test_fiq_interrupt() {
|
||||
__attribute__((interrupt("FIQ"))) void test_fiq_interrupt(void) {
|
||||
// CHECK: define{{.*}} arm_aapcscc void @test_fiq_interrupt() [[FIQ_ATTR:#[0-9]+]]
|
||||
}
|
||||
|
||||
__attribute__((interrupt("SWI"))) void test_swi_interrupt() {
|
||||
__attribute__((interrupt("SWI"))) void test_swi_interrupt(void) {
|
||||
// CHECK: define{{.*}} arm_aapcscc void @test_swi_interrupt() [[SWI_ATTR:#[0-9]+]]
|
||||
}
|
||||
|
||||
__attribute__((interrupt("ABORT"))) void test_abort_interrupt() {
|
||||
__attribute__((interrupt("ABORT"))) void test_abort_interrupt(void) {
|
||||
// CHECK: define{{.*}} arm_aapcscc void @test_abort_interrupt() [[ABORT_ATTR:#[0-9]+]]
|
||||
}
|
||||
|
||||
|
||||
__attribute__((interrupt("UNDEF"))) void test_undef_interrupt() {
|
||||
__attribute__((interrupt("UNDEF"))) void test_undef_interrupt(void) {
|
||||
// CHECK: define{{.*}} arm_aapcscc void @test_undef_interrupt() [[UNDEF_ATTR:#[0-9]+]]
|
||||
}
|
||||
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
// CHECK-NOMAX: attributes #0 = { {{.*}} vscale_range([[#VBITS]],0) {{.*}} }
|
||||
// CHECK-UNBOUNDED: attributes #0 = { {{.*}} vscale_range(1,0) {{.*}} }
|
||||
// CHECK-NONE: attributes #0 = { {{.*}} vscale_range(1,16) {{.*}} }
|
||||
void func() {}
|
||||
void func(void) {}
|
||||
|
||||
@@ -43,7 +43,7 @@ SWIFTCALL void context_error_1(CONTEXT int *self, ERROR float **error) {}
|
||||
// CHECK: store float* [[T0]], float** [[TEMP]], align 4
|
||||
// CHECK: [[T0:%.*]] = load float*, float** [[TEMP]], align 4
|
||||
// CHECK: store float* [[T0]], float** [[ERRORARG]], align 4
|
||||
void test_context_error_1() {
|
||||
void test_context_error_1(void) {
|
||||
int x;
|
||||
float *error;
|
||||
context_error_1(&x, &error);
|
||||
@@ -85,7 +85,7 @@ typedef long long long2 __attribute__((ext_vector_type(2)));
|
||||
} \
|
||||
SWIFTCALL void take_##TYPE(TYPE v) { \
|
||||
} \
|
||||
void test_##TYPE() { \
|
||||
void test_##TYPE(void) { \
|
||||
take_##TYPE(return_##TYPE()); \
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s
|
||||
// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s
|
||||
|
||||
__attribute__((target("arm"))) void test_target_arm() {
|
||||
__attribute__((target("arm"))) void test_target_arm(void) {
|
||||
// CHECKPOS: define{{.*}} void @test_target_arm() [[ARM_ATTRS:#[0-9]+]]
|
||||
// CHECKNEG: define{{.*}} void @test_target_arm() [[ARM_ATTRS:#[0-9]+]]
|
||||
}
|
||||
|
||||
__attribute__((target("thumb"))) void test_target_thumb() {
|
||||
__attribute__((target("thumb"))) void test_target_thumb(void) {
|
||||
// CHECKPOS: define{{.*}} void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]]
|
||||
// CHECKNEG: define{{.*}} void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]]
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ struct hfa simple_hfa(void) {
|
||||
// non-aligned fundamental types.
|
||||
|
||||
typedef int underaligned_int __attribute__((packed,aligned(2)));
|
||||
underaligned_int underaligned_int_test() {
|
||||
underaligned_int underaligned_int_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @underaligned_int_test()
|
||||
return va_arg(the_list, underaligned_int);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -107,7 +107,7 @@ underaligned_int underaligned_int_test() {
|
||||
}
|
||||
|
||||
typedef int overaligned_int __attribute__((aligned(32)));
|
||||
overaligned_int overaligned_int_test() {
|
||||
overaligned_int overaligned_int_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @overaligned_int_test()
|
||||
return va_arg(the_list, overaligned_int);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -119,7 +119,7 @@ overaligned_int overaligned_int_test() {
|
||||
}
|
||||
|
||||
typedef long long underaligned_long_long __attribute__((packed,aligned(2)));
|
||||
underaligned_long_long underaligned_long_long_test() {
|
||||
underaligned_long_long underaligned_long_long_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i64 @underaligned_long_long_test()
|
||||
return va_arg(the_list, underaligned_long_long);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -135,7 +135,7 @@ underaligned_long_long underaligned_long_long_test() {
|
||||
}
|
||||
|
||||
typedef long long overaligned_long_long __attribute__((aligned(32)));
|
||||
overaligned_long_long overaligned_long_long_test() {
|
||||
overaligned_long_long overaligned_long_long_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i64 @overaligned_long_long_test()
|
||||
return va_arg(the_list, overaligned_long_long);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -165,7 +165,7 @@ overaligned_long_long overaligned_long_long_test() {
|
||||
typedef struct __attribute__((packed,aligned(2))) {
|
||||
int val;
|
||||
} underaligned_int_struct;
|
||||
underaligned_int_struct underaligned_int_struct_test() {
|
||||
underaligned_int_struct underaligned_int_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @underaligned_int_struct_test()
|
||||
return va_arg(the_list, underaligned_int_struct);
|
||||
// CHECK: [[RETVAL:%[a-z0-9._]+]] = alloca %struct.underaligned_int_struct, align 2
|
||||
@@ -184,7 +184,7 @@ underaligned_int_struct underaligned_int_struct_test() {
|
||||
typedef struct __attribute__((aligned(16))) {
|
||||
int val;
|
||||
} overaligned_int_struct;
|
||||
overaligned_int_struct overaligned_int_struct_test() {
|
||||
overaligned_int_struct overaligned_int_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @overaligned_int_struct_test(%struct.overaligned_int_struct* noalias sret(%struct.overaligned_int_struct) align 16 %agg.result)
|
||||
return va_arg(the_list, overaligned_int_struct);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -200,7 +200,7 @@ overaligned_int_struct overaligned_int_struct_test() {
|
||||
typedef struct __attribute__((packed,aligned(2))) {
|
||||
long long val;
|
||||
} underaligned_long_long_struct;
|
||||
underaligned_long_long_struct underaligned_long_long_struct_test() {
|
||||
underaligned_long_long_struct underaligned_long_long_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @underaligned_long_long_struct_test(%struct.underaligned_long_long_struct* noalias sret(%struct.underaligned_long_long_struct) align 2 %agg.result)
|
||||
return va_arg(the_list, underaligned_long_long_struct);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -216,7 +216,7 @@ underaligned_long_long_struct underaligned_long_long_struct_test() {
|
||||
typedef struct __attribute__((aligned(16))) {
|
||||
long long val;
|
||||
} overaligned_long_long_struct;
|
||||
overaligned_long_long_struct overaligned_long_long_struct_test() {
|
||||
overaligned_long_long_struct overaligned_long_long_struct_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @overaligned_long_long_struct_test(%struct.overaligned_long_long_struct* noalias sret(%struct.overaligned_long_long_struct) align 16 %agg.result)
|
||||
return va_arg(the_list, overaligned_long_long_struct);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -239,7 +239,7 @@ overaligned_long_long_struct overaligned_long_long_struct_test() {
|
||||
typedef struct {
|
||||
int val __attribute__((packed,aligned(2)));
|
||||
} underaligned_int_struct_member;
|
||||
underaligned_int_struct_member underaligned_int_struct_member_test() {
|
||||
underaligned_int_struct_member underaligned_int_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @underaligned_int_struct_member_test()
|
||||
return va_arg(the_list, underaligned_int_struct_member);
|
||||
// CHECK: [[RETVAL:%[a-z0-9._]+]] = alloca %struct.underaligned_int_struct_member, align 2
|
||||
@@ -258,7 +258,7 @@ underaligned_int_struct_member underaligned_int_struct_member_test() {
|
||||
typedef struct {
|
||||
int val __attribute__((aligned(16)));
|
||||
} overaligned_int_struct_member;
|
||||
overaligned_int_struct_member overaligned_int_struct_member_test() {
|
||||
overaligned_int_struct_member overaligned_int_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @overaligned_int_struct_member_test(%struct.overaligned_int_struct_member* noalias sret(%struct.overaligned_int_struct_member) align 16 %agg.result)
|
||||
return va_arg(the_list, overaligned_int_struct_member);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -278,7 +278,7 @@ overaligned_int_struct_member overaligned_int_struct_member_test() {
|
||||
typedef struct {
|
||||
long long val __attribute__((packed,aligned(2)));
|
||||
} underaligned_long_long_struct_member;
|
||||
underaligned_long_long_struct_member underaligned_long_long_struct_member_test() {
|
||||
underaligned_long_long_struct_member underaligned_long_long_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @underaligned_long_long_struct_member_test(%struct.underaligned_long_long_struct_member* noalias sret(%struct.underaligned_long_long_struct_member) align 2 %agg.result)
|
||||
return va_arg(the_list, underaligned_long_long_struct_member);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
@@ -294,7 +294,7 @@ underaligned_long_long_struct_member underaligned_long_long_struct_member_test()
|
||||
typedef struct {
|
||||
long long val __attribute__((aligned(16)));
|
||||
} overaligned_long_long_struct_member;
|
||||
overaligned_long_long_struct_member overaligned_long_long_struct_member_test() {
|
||||
overaligned_long_long_struct_member overaligned_long_long_struct_member_test(void) {
|
||||
// CHECK-LABEL: define{{.*}} void @overaligned_long_long_struct_member_test(%struct.overaligned_long_long_struct_member* noalias sret(%struct.overaligned_long_long_struct_member) align 16 %agg.result)
|
||||
return va_arg(the_list, overaligned_long_long_struct_member);
|
||||
// CHECK: [[CUR:%[a-z0-9._]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0), align 4
|
||||
|
||||
@@ -74,7 +74,7 @@ void check__sevl(void) {
|
||||
// CHECK-MSVC: @llvm.aarch64.hint(i32 5)
|
||||
// CHECK-LINUX: error: implicit declaration of function '__sevl'
|
||||
|
||||
void check_ReadWriteBarrier() {
|
||||
void check_ReadWriteBarrier(void) {
|
||||
_ReadWriteBarrier();
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ unsigned long long check_umulh(unsigned long long a, unsigned long long b) {
|
||||
// CHECK-MSVC: %[[RES:.*]] = trunc i128 %[[HIGH]] to i64
|
||||
// CHECK-LINUX: error: implicit declaration of function '__umulh'
|
||||
|
||||
unsigned __int64 check__getReg() {
|
||||
unsigned __int64 check__getReg(void) {
|
||||
unsigned volatile __int64 reg;
|
||||
reg = __getReg(18);
|
||||
reg = __getReg(31);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// RUN: %clang_cc1 -emit-llvm %s -o %t
|
||||
|
||||
void f() {
|
||||
void f(void) {
|
||||
int a[2];
|
||||
a[0] = 0;
|
||||
}
|
||||
|
||||
void f2() {
|
||||
void f2(void) {
|
||||
int x = 0;
|
||||
int y = 1;
|
||||
int a[10] = { y, x, 2, 3};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
|
||||
|
||||
extern void foo();
|
||||
extern void foo(void);
|
||||
// CHECK: !DISubprogram(name: "foo"
|
||||
// CHECK-SAME: flags: DIFlagArtificial
|
||||
inline void __attribute__((artificial)) foo() {}
|
||||
inline void __attribute__((artificial)) foo(void) {}
|
||||
|
||||
void baz() {
|
||||
void baz(void) {
|
||||
foo();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// knows how to make the metadata comdat associative, so the string literal
|
||||
// global is only registered if the instrumented global prevails during linking.
|
||||
|
||||
const char *foo() { return "asdf"; }
|
||||
const char *foo(void) { return "asdf"; }
|
||||
|
||||
// LINUX: @.str = private unnamed_addr constant [5 x i8] c"asdf\00", align 1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu| FileCheck %s
|
||||
|
||||
void callee(void);
|
||||
void caller() {
|
||||
void caller(void) {
|
||||
//CHECK: call void asm sideeffect "rcall $0", "n,~{dirflag},~{fpsr},~{flags}"(void ()* @callee)
|
||||
asm("rcall %0" ::"n"(callee));
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
int *foo(void);
|
||||
|
||||
// CHECK: @test1
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
// CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call i32* @foo()
|
||||
// CHECK: call void asm "foobar", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) [[REGCALLRESULT]], i32* elementtype(i32) [[REGCALLRESULT]])
|
||||
asm ("foobar" : "+m"(*foo()));
|
||||
}
|
||||
|
||||
// CHECK: @test2
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
// CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call i32* @foo()
|
||||
// CHECK: load i32, i32* [[REGCALLRESULT]]
|
||||
// CHECK: call i32 asm
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
|
||||
// Exercise various use cases for local asm "register variables".
|
||||
|
||||
int foo() {
|
||||
int foo(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @foo()
|
||||
// CHECK: [[A:%[a-zA-Z0-9]+]] = alloca i32
|
||||
|
||||
@@ -24,7 +24,7 @@ int foo() {
|
||||
// CHECK: ret i32 [[TMP1]]
|
||||
}
|
||||
|
||||
int earlyclobber() {
|
||||
int earlyclobber(void) {
|
||||
// CHECK-LABEL: define{{.*}} i32 @earlyclobber()
|
||||
// CHECK: [[A:%[a-zA-Z0-9]+]] = alloca i32
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ unsigned long long foo2(unsigned long long addr, double a0,
|
||||
// CHECK: call i64 asm "call *$1", "={rax},r,{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},~{dirflag},~{fpsr},~{flags}
|
||||
|
||||
int randomvar asm("randomvar");
|
||||
void foo3() {
|
||||
void foo3(void) {
|
||||
asm("vartest %0" : : "r"(randomvar));
|
||||
}
|
||||
// CHECK: call void asm sideeffect "vartest $0", "r,~{dirflag},~{fpsr},~{flags}"
|
||||
|
||||
@@ -20,7 +20,7 @@ void t3(unsigned char *src, unsigned long long temp) {
|
||||
__asm__ volatile("" : "+m"(temp), "+r"(src));
|
||||
}
|
||||
|
||||
void t4() {
|
||||
void t4(void) {
|
||||
unsigned long long a;
|
||||
struct reg { unsigned long long a, b; } b;
|
||||
|
||||
@@ -43,7 +43,7 @@ void t7(int a) {
|
||||
// CHECK: T7 NAMED: $1
|
||||
}
|
||||
|
||||
void t8() {
|
||||
void t8(void) {
|
||||
__asm__ volatile("T8 NAMED MODIFIER: %c[input]" :: [input] "i" (4));
|
||||
// CHECK: @t8()
|
||||
// CHECK: T8 NAMED MODIFIER: ${0:c}
|
||||
@@ -110,7 +110,7 @@ void t14(struct S *P) {
|
||||
}
|
||||
|
||||
// PR4938
|
||||
int t16() {
|
||||
int t16(void) {
|
||||
int a,b;
|
||||
asm ( "nop;"
|
||||
:"=%c" (a)
|
||||
@@ -120,7 +120,7 @@ int t16() {
|
||||
}
|
||||
|
||||
// PR6475
|
||||
void t17() {
|
||||
void t17(void) {
|
||||
int i;
|
||||
__asm__ ( "nop": "=m"(i));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
// CHECK-LABEL: @t1
|
||||
void t1() {
|
||||
void t1(void) {
|
||||
__asm__ ("mov r8w, 100;");
|
||||
// CHECK: call void asm sideeffect "mov r8w, 100;"
|
||||
__asm__ ("mov r8d, 100;");
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
// rdar://9167275
|
||||
|
||||
int t1()
|
||||
int t1(void)
|
||||
{
|
||||
int x;
|
||||
__asm__("mov %0, 7" : "=r" (x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long t2()
|
||||
long t2(void)
|
||||
{
|
||||
long x;
|
||||
__asm__("mov %0, 7" : "=r" (x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long t3()
|
||||
long t3(void)
|
||||
{
|
||||
long x;
|
||||
__asm__("mov %w0, 7" : "=r" (x));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// CHECK-NEXT: store i32 1, i32* [[x_0]]
|
||||
// CHECK-NEXT: store i32 1, i32* [[y_0]]
|
||||
// CHECK: }
|
||||
void f0() {
|
||||
void f0(void) {
|
||||
int x, y;
|
||||
x = 1;
|
||||
y = (x = 1);
|
||||
@@ -25,7 +25,7 @@ void f0() {
|
||||
// CHECK-NEXT: store volatile i32 1, i32* [[x_1]]
|
||||
// CHECK-NEXT: store volatile i32 1, i32* [[y_1]]
|
||||
// CHECK: }
|
||||
void f1() {
|
||||
void f1(void) {
|
||||
volatile int x, y;
|
||||
x = 1;
|
||||
y = (x = 1);
|
||||
|
||||
@@ -8,7 +8,7 @@ void *my_aligned_alloc(int size, int alignment) __attribute__((assume_aligned(32
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call align 32 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 16)
|
||||
// CHECK-NEXT: ret i8* [[CALL]]
|
||||
//
|
||||
void *t0_immediate0() {
|
||||
void *t0_immediate0(void) {
|
||||
return my_aligned_alloc(320, 16);
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ void *t0_immediate0() {
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call align 32 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 32)
|
||||
// CHECK-NEXT: ret i8* [[CALL]]
|
||||
//
|
||||
void *t1_immediate1() {
|
||||
void *t1_immediate1(void) {
|
||||
return my_aligned_alloc(320, 32);
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ void *t1_immediate1() {
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call align 64 i8* @my_aligned_alloc(i32 noundef 320, i32 noundef 64)
|
||||
// CHECK-NEXT: ret i8* [[CALL]]
|
||||
//
|
||||
void *t2_immediate2() {
|
||||
void *t2_immediate2(void) {
|
||||
return my_aligned_alloc(320, 64);
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ extern _Atomic(pointer_quad_t) a_pointer_quad;
|
||||
// CHECK-NEXT: store i8 1, i8* [[TEMP]]
|
||||
// CHECK-NEXT: [[T0:%.*]] = load i8, i8* [[TEMP]], align 1
|
||||
// CHECK-NEXT: store atomic i8 [[T0]], i8* @a_bool seq_cst, align 1
|
||||
void test0() {
|
||||
void test0(void) {
|
||||
__c11_atomic_store(&a_bool, 1, memory_order_seq_cst);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ void test0() {
|
||||
// CHECK-NEXT: [[T0:%.*]] = bitcast float* [[TEMP]] to i32*
|
||||
// CHECK-NEXT: [[T1:%.*]] = load i32, i32* [[T0]], align 4
|
||||
// CHECK-NEXT: store atomic i32 [[T1]], i32* bitcast (float* @a_float to i32*) seq_cst, align 4
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
__c11_atomic_store(&a_float, 3, memory_order_seq_cst);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void test1() {
|
||||
// CHECK-NEXT: [[T0:%.*]] = bitcast i8** [[TEMP]] to i64*
|
||||
// CHECK-NEXT: [[T1:%.*]] = load i64, i64* [[T0]], align 8
|
||||
// CHECK-NEXT: store atomic i64 [[T1]], i64* bitcast (i8** @a_pointer to i64*) seq_cst, align 8
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
__c11_atomic_store(&a_pointer, &a_bool, memory_order_seq_cst);
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ _Bool fsb(_Bool *c) {
|
||||
|
||||
char flag1;
|
||||
volatile char flag2;
|
||||
void test_and_set() {
|
||||
void test_and_set(void) {
|
||||
// CHECK: atomicrmw xchg i8* @flag1, i8 1 seq_cst, align 1
|
||||
__atomic_test_and_set(&flag1, memory_order_seq_cst);
|
||||
// CHECK: atomicrmw volatile xchg i8* @flag2, i8 1 acquire, align 1
|
||||
@@ -388,7 +388,7 @@ struct bar smallThing, thing1, thing2;
|
||||
struct foo bigThing;
|
||||
_Atomic(struct foo) bigAtomic;
|
||||
|
||||
void structAtomicStore() {
|
||||
void structAtomicStore(void) {
|
||||
// CHECK-LABEL: @structAtomicStore
|
||||
struct foo f = {0};
|
||||
struct bar b = {0};
|
||||
@@ -398,7 +398,7 @@ void structAtomicStore() {
|
||||
__atomic_store(&bigThing, &f, 5);
|
||||
// CHECK: call void @__atomic_store(i32 noundef 512, i8* noundef {{.*}} @bigThing
|
||||
}
|
||||
void structAtomicLoad() {
|
||||
void structAtomicLoad(void) {
|
||||
// CHECK-LABEL: @structAtomicLoad
|
||||
struct bar b;
|
||||
__atomic_load(&smallThing, &b, 5);
|
||||
@@ -408,7 +408,7 @@ void structAtomicLoad() {
|
||||
__atomic_load(&bigThing, &f, 5);
|
||||
// CHECK: call void @__atomic_load(i32 noundef 512, i8* noundef {{.*}} @bigThing
|
||||
}
|
||||
struct foo structAtomicExchange() {
|
||||
struct foo structAtomicExchange(void) {
|
||||
// CHECK-LABEL: @structAtomicExchange
|
||||
struct foo f = {0};
|
||||
struct foo old;
|
||||
@@ -418,7 +418,7 @@ struct foo structAtomicExchange() {
|
||||
return __c11_atomic_exchange(&bigAtomic, f, 5);
|
||||
// CHECK: call void @__atomic_exchange(i32 noundef 512, i8* noundef bitcast ({{.*}} @bigAtomic to i8*),
|
||||
}
|
||||
int structAtomicCmpExchange() {
|
||||
int structAtomicCmpExchange(void) {
|
||||
// CHECK-LABEL: @structAtomicCmpExchange
|
||||
// CHECK: %[[x_mem:.*]] = alloca i8
|
||||
_Bool x = __atomic_compare_exchange(&smallThing, &thing1, &thing2, 1, 5, 5);
|
||||
@@ -444,7 +444,7 @@ int structAtomicCmpExchange() {
|
||||
_Atomic(int) atomic_init_i = 42;
|
||||
|
||||
// CHECK-LABEL: @atomic_init_foo
|
||||
void atomic_init_foo()
|
||||
void atomic_init_foo(void)
|
||||
{
|
||||
// CHECK-NOT: }
|
||||
// CHECK-NOT: atomic
|
||||
@@ -651,7 +651,7 @@ void EMIT_ALL_THE_THINGS(int *ptr, int *ptr2, int new, _Bool weak, int success,
|
||||
// CHECK: = cmpxchg weak {{.*}} seq_cst seq_cst, align
|
||||
}
|
||||
|
||||
int PR21643() {
|
||||
int PR21643(void) {
|
||||
return __atomic_or_fetch((int __attribute__((address_space(257))) *)0x308, 1,
|
||||
__ATOMIC_RELAXED);
|
||||
// CHECK: %[[atomictmp:.*]] = alloca i32, align 4
|
||||
@@ -698,7 +698,7 @@ int PR17306_2(volatile int *i, int value) {
|
||||
return __atomic_add_fetch(i, value, memory_order_seq_cst);
|
||||
}
|
||||
|
||||
void test_underaligned() {
|
||||
void test_underaligned(void) {
|
||||
// CHECK-LABEL: @test_underaligned
|
||||
struct Underaligned { char c[8]; } underaligned_a, underaligned_b, underaligned_c;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void foo(int x)
|
||||
|
||||
extern _Atomic _Bool b;
|
||||
|
||||
_Bool bar() {
|
||||
_Bool bar(void) {
|
||||
// NATIVE-LABEL: @bar
|
||||
// NATIVE: %[[load:.*]] = load atomic i8, i8* @b seq_cst, align 1
|
||||
// NATIVE: %[[tobool:.*]] = trunc i8 %[[load]] to i1
|
||||
|
||||
@@ -5,26 +5,26 @@
|
||||
// CHECK-10_4-LABEL: define hidden void @f2
|
||||
// CHECK-10_5-LABEL: define hidden void @f2
|
||||
// CHECK-10_6-LABEL: define hidden void @f2
|
||||
void f2();
|
||||
void f2() { }
|
||||
void f2(void);
|
||||
void f2(void) { }
|
||||
|
||||
// CHECK-10_4-LABEL: define hidden void @f3
|
||||
// CHECK-10_5-LABEL: define hidden void @f3
|
||||
// CHECK-10_6-LABEL: define hidden void @f3
|
||||
void f3() __attribute__((availability(macosx,introduced=10.5)));
|
||||
void f3() { }
|
||||
void f3(void) __attribute__((availability(macosx,introduced=10.5)));
|
||||
void f3(void) { }
|
||||
|
||||
// CHECK-10_4: declare extern_weak void @f0
|
||||
// CHECK-10_5: declare void @f0
|
||||
// CHECK-10_6: declare void @f0
|
||||
void f0() __attribute__((availability(macosx,introduced=10.5)));
|
||||
void f0(void) __attribute__((availability(macosx,introduced=10.5)));
|
||||
|
||||
// CHECK-10_4: declare extern_weak void @f1
|
||||
// CHECK-10_5: declare extern_weak void @f1
|
||||
// CHECK-10_6: declare void @f1
|
||||
void f1() __attribute__((availability(macosx,introduced=10.6)));
|
||||
void f1(void) __attribute__((availability(macosx,introduced=10.6)));
|
||||
|
||||
void test() {
|
||||
void test(void) {
|
||||
f0();
|
||||
f1();
|
||||
f2();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// <rdar://problem/6827047>
|
||||
void f(void* arg);
|
||||
void g() {
|
||||
void g(void) {
|
||||
__attribute__((cleanup(f))) void *g;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -check-prefixes=CHECK,O0
|
||||
// RUN: %clang_cc1 -emit-llvm %s -o - -O1 -disable-llvm-passes | FileCheck %s -check-prefixes=CHECK,O1
|
||||
|
||||
int test1() __attribute__((__cold__)) {
|
||||
int test1(void) __attribute__((__cold__)) {
|
||||
return 42;
|
||||
|
||||
// Check that we set the optsize attribute on the function.
|
||||
|
||||
@@ -80,7 +80,7 @@ void ThreeVersionsSameAttr(void){}
|
||||
// CHECK: define {{.*}}void @ThreeVersionsSameAttr.S() #[[S]]
|
||||
// CHECK: define {{.*}}void @ThreeVersionsSameAttr.Z() #[[K]]
|
||||
|
||||
void usages() {
|
||||
void usages(void) {
|
||||
SingleVersion();
|
||||
// LINUX: @SingleVersion.ifunc()
|
||||
// WINDOWS: @SingleVersion()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// RUN: %clang_cc1 -debug-info-kind=limited %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
void t1() __attribute__((disable_sanitizer_instrumentation)) {
|
||||
void t1(void) __attribute__((disable_sanitizer_instrumentation)) {
|
||||
}
|
||||
// CHECK: disable_sanitizer_instrumentation
|
||||
// CHECK-NEXT: void @t1
|
||||
|
||||
// CHECK-NOT: disable_sanitizer_instrumentation
|
||||
// CHECK: void @t2
|
||||
void t2() {
|
||||
void t2(void) {
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
// ENABLE: define{{.*}} i32 @f1() [[ATTRFALSE:#[0-9]+]] {
|
||||
// ENABLE: define{{.*}} i32 @f2() [[ATTRTRUE:#[0-9]+]] {
|
||||
|
||||
int f1() {
|
||||
int f1(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int f2() __attribute__((disable_tail_calls)) {
|
||||
int f2(void) __attribute__((disable_tail_calls)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,48 +3,48 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only %s
|
||||
|
||||
#if defined(_WIN32)
|
||||
void foo() {}
|
||||
void bar() __attribute__((ifunc("foo")));
|
||||
void foo(void) {}
|
||||
void bar(void) __attribute__((ifunc("foo")));
|
||||
// expected-warning@-1 {{unknown attribute 'ifunc' ignored}}
|
||||
|
||||
#else
|
||||
#if defined(CHECK_ALIASES)
|
||||
void *f1_ifunc();
|
||||
void f1() __attribute__((ifunc("f1_ifunc")));
|
||||
void *f1_ifunc(void);
|
||||
void f1(void) __attribute__((ifunc("f1_ifunc")));
|
||||
// expected-error@-1 {{ifunc must point to a defined function}}
|
||||
|
||||
void *f2_a() __attribute__((alias("f2_b")));
|
||||
void *f2_b() __attribute__((ifunc("f2_a")));
|
||||
void *f2_a(void) __attribute__((alias("f2_b")));
|
||||
void *f2_b(void) __attribute__((ifunc("f2_a")));
|
||||
// expected-error@-1 {{ifunc definition is part of a cycle}}
|
||||
|
||||
void *f3_a() __attribute__((ifunc("f3_b")));
|
||||
void *f3_a(void) __attribute__((ifunc("f3_b")));
|
||||
// expected-warning@-1 {{ifunc will always resolve to f3_c even if weak definition of f3_b is overridden}}
|
||||
void *f3_b() __attribute__((weak, alias("f3_c")));
|
||||
void *f3_c() { return 0; }
|
||||
void *f3_b(void) __attribute__((weak, alias("f3_c")));
|
||||
void *f3_c(void) { return 0; }
|
||||
|
||||
void f4_ifunc() {}
|
||||
void f4() __attribute__((ifunc("f4_ifunc")));
|
||||
void f4_ifunc(void) {}
|
||||
void f4(void) __attribute__((ifunc("f4_ifunc")));
|
||||
// expected-error@-1 {{ifunc resolver function must return a pointer}}
|
||||
|
||||
int f5_resolver_gvar;
|
||||
void f5() __attribute__((ifunc("f5_resolver_gvar")));
|
||||
void f5(void) __attribute__((ifunc("f5_resolver_gvar")));
|
||||
// expected-error@-1 {{ifunc must point to a defined function}}
|
||||
|
||||
void *f6_resolver_resolver() { return 0; }
|
||||
void *f6_resolver() __attribute__((ifunc("f6_resolver_resolver")));
|
||||
void f6() __attribute__((ifunc("f6_resolver")));
|
||||
void *f6_resolver_resolver(void) { return 0; }
|
||||
void *f6_resolver(void) __attribute__((ifunc("f6_resolver_resolver")));
|
||||
void f6(void) __attribute__((ifunc("f6_resolver")));
|
||||
// expected-error@-1 {{ifunc must point to a defined function}}
|
||||
|
||||
#else
|
||||
void f1a() __asm("f1");
|
||||
void f1a() {}
|
||||
void f1a(void) __asm("f1");
|
||||
void f1a(void) {}
|
||||
// expected-note@-1 {{previous definition is here}}
|
||||
void f1() __attribute__((ifunc("f1_ifunc")));
|
||||
void f1(void) __attribute__((ifunc("f1_ifunc")));
|
||||
// expected-error@-1 {{definition with same mangled name 'f1' as another definition}}
|
||||
void *f1_ifunc() { return 0; }
|
||||
void *f1_ifunc(void) { return 0; }
|
||||
|
||||
void *f6_ifunc(int i);
|
||||
void __attribute__((ifunc("f6_ifunc"))) f6() {}
|
||||
void __attribute__((ifunc("f6_ifunc"))) f6(void) {}
|
||||
// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -Oz -o - %s | FileCheck %s
|
||||
|
||||
// CHECK: define{{.*}} void @f() local_unnamed_addr [[ATTRS:#[0-9]+]] {
|
||||
void f() __attribute__((leaf));
|
||||
void f(void) __attribute__((leaf));
|
||||
|
||||
void f()
|
||||
void f(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// 1. "typedef enum { A } __attribute__((mode(HI))) T;" is accepted,
|
||||
// 2. "enum X __attribute__((mode(QI))) var;" forms a complete integer type.
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
// CHECK: [[X1:%.+]] = alloca i8
|
||||
enum { A1, B1 } __attribute__((mode(QI))) x1 = A1;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ typedef int __attribute__((mode(DI))) __attribute__((vector_size(64)))vec_t4;
|
||||
typedef float __attribute__((mode(SF))) __attribute__((vector_size(128))) vec_t5;
|
||||
typedef float __attribute__((mode(DF))) __attribute__((vector_size(256))) vec_t6;
|
||||
|
||||
void check() {
|
||||
void check(void) {
|
||||
// CHECK: alloca <4 x i8>
|
||||
vec_t1 v1;
|
||||
// CHECK: alloca <8 x i8>
|
||||
@@ -23,19 +23,19 @@ void check() {
|
||||
}
|
||||
|
||||
// CHECK: ret i32 4
|
||||
int check_size1() { return sizeof(vec_t1); }
|
||||
int check_size1(void) { return sizeof(vec_t1); }
|
||||
|
||||
// CHECK: ret i32 8
|
||||
int check_size2() { return sizeof(vec_t2); }
|
||||
int check_size2(void) { return sizeof(vec_t2); }
|
||||
|
||||
// CHECK: ret i32 16
|
||||
int check_size3() { return sizeof(vec_t3); }
|
||||
int check_size3(void) { return sizeof(vec_t3); }
|
||||
|
||||
// CHECK: ret i32 64
|
||||
int check_size4() { return sizeof(vec_t4); }
|
||||
int check_size4(void) { return sizeof(vec_t4); }
|
||||
|
||||
// CHECK: ret i32 128
|
||||
int check_size5() { return sizeof(vec_t5); }
|
||||
int check_size5(void) { return sizeof(vec_t5); }
|
||||
|
||||
// CHECK: ret i32 256
|
||||
int check_size6() { return sizeof(vec_t6); }
|
||||
int check_size6(void) { return sizeof(vec_t6); }
|
||||
|
||||
@@ -32,7 +32,7 @@ int b = 0;
|
||||
// C11-NOT: br {{.*}}!llvm.loop
|
||||
// FINITE-NEXT: br {{.*}}!llvm.loop
|
||||
//
|
||||
void f0() {
|
||||
void f0(void) {
|
||||
for (; ;) ;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void f0() {
|
||||
// CHECK: for.end:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void f1() {
|
||||
void f1(void) {
|
||||
for (; 1;) {
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void f1() {
|
||||
// CHECK: for.end:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void f2() {
|
||||
void f2(void) {
|
||||
for (; a == b;) {
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void f2() {
|
||||
// CHECK: for.end3:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void F() {
|
||||
void F(void) {
|
||||
for (; 1;) {
|
||||
}
|
||||
for (; a == b;) {
|
||||
@@ -115,7 +115,7 @@ void F() {
|
||||
// C11-NOT: br {{.*}}, !llvm.loop
|
||||
// FINITE-NEXT: br {{.*}}, !llvm.loop
|
||||
//
|
||||
void w1() {
|
||||
void w1(void) {
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void w1() {
|
||||
// CHECK: while.end:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void w2() {
|
||||
void w2(void) {
|
||||
while (a == b) {
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ void w2() {
|
||||
// C11-NOT: br {{.*}} !llvm.loop
|
||||
// FINITE-NEXT: br {{.*}} !llvm.loop
|
||||
//
|
||||
void W() {
|
||||
void W(void) {
|
||||
while (a == b) {
|
||||
}
|
||||
while (1) {
|
||||
@@ -181,7 +181,7 @@ void W() {
|
||||
// CHECK: do.end:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void d1() {
|
||||
void d1(void) {
|
||||
do {
|
||||
} while (1);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ void d1() {
|
||||
// CHECK: do.end:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void d2() {
|
||||
void d2(void) {
|
||||
do {
|
||||
} while (a == b);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ void d2() {
|
||||
// CHECK: do.end3:
|
||||
// CHECK-NEXT: ret void
|
||||
//
|
||||
void D() {
|
||||
void D(void) {
|
||||
do {
|
||||
} while (1);
|
||||
do {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
void t1() __attribute__((naked));
|
||||
void t1(void) __attribute__((naked));
|
||||
|
||||
// Basic functionality check
|
||||
// (Note that naked needs to imply noinline to work properly.)
|
||||
// CHECK: define{{.*}} void @t1() [[NAKED_OPTNONE:#[0-9]+]] {
|
||||
void t1()
|
||||
void t1(void)
|
||||
{
|
||||
}
|
||||
|
||||
// Make sure this doesn't explode in the verifier.
|
||||
// (It doesn't really make sense, but it isn't invalid.)
|
||||
// CHECK: define{{.*}} void @t2() [[NAKED:#[0-9]+]] {
|
||||
__attribute((naked, always_inline)) void t2() {
|
||||
__attribute((naked, always_inline)) void t2(void) {
|
||||
}
|
||||
|
||||
// Make sure not to generate prolog or epilog for naked functions.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
void t1() __attribute__((nodebug));
|
||||
void t1(void) __attribute__((nodebug));
|
||||
|
||||
void t1()
|
||||
void t1(void)
|
||||
{
|
||||
int a = 10;
|
||||
a++;
|
||||
}
|
||||
|
||||
void t2()
|
||||
void t2(void)
|
||||
{
|
||||
int b = 10;
|
||||
b++;
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void t1();
|
||||
void t1(void);
|
||||
|
||||
void use() { t1(); }
|
||||
void use(void) { t1(); }
|
||||
|
||||
__attribute__((nodebug)) void t1() {
|
||||
__attribute__((nodebug)) void t1(void) {
|
||||
int a = 10;
|
||||
a++;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o %t %s
|
||||
// RUN: grep 'noinline' %t
|
||||
|
||||
void t1() __attribute__((noinline));
|
||||
void t1(void) __attribute__((noinline));
|
||||
|
||||
void t1()
|
||||
void t1(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
typedef void (*fptrs_t[4])(void);
|
||||
fptrs_t p __attribute__((noreturn));
|
||||
|
||||
void __attribute__((noreturn)) f() {
|
||||
void __attribute__((noreturn)) f(void) {
|
||||
p[0]();
|
||||
}
|
||||
// CHECK: call void
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
// RUN: FileCheck %s --check-prefix=MINSIZE < %t
|
||||
|
||||
__attribute__((always_inline))
|
||||
int test2() { return 0; }
|
||||
int test2(void) { return 0; }
|
||||
// OPTSIZE: @test2{{.*}}[[ATTR2:#[0-9]+]]
|
||||
// MINSIZE: @test2{{.*}}[[ATTR2:#[0-9]+]]
|
||||
|
||||
__attribute__((optnone))
|
||||
int test3() { return 0; }
|
||||
int test3(void) { return 0; }
|
||||
// PRESENT-DAG: @test3{{.*}}[[ATTR3:#[0-9]+]]
|
||||
|
||||
__attribute__((optnone)) __attribute__((cold))
|
||||
int test4() { return test2(); }
|
||||
int test4(void) { return test2(); }
|
||||
// PRESENT-DAG: @test4{{.*}}[[ATTR4:#[0-9]+]]
|
||||
// Also check that test2 is inlined into test4 (always_inline still works).
|
||||
// PRESENT-NOT: call i32 @test2
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
const int c0 __attribute__((retain)) = 42;
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
static int l0 __attribute__((retain)) = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Check that we set the attribute on each function.
|
||||
|
||||
int test1() {
|
||||
int test1(void) {
|
||||
return 42;
|
||||
}
|
||||
// SLH: @{{.*}}test1{{.*}}[[SLH:#[0-9]+]]
|
||||
|
||||
@@ -33,7 +33,7 @@ __attribute__((target_clones("default,default ,sse4.2"))) void foo_dupes(void) {
|
||||
// WINDOWS: musttail call void @foo_dupes.sse4.2.0
|
||||
// WINDOWS: musttail call void @foo_dupes.default.1
|
||||
|
||||
void bar2() {
|
||||
void bar2(void) {
|
||||
// LINUX: define {{.*}}void @bar2()
|
||||
// WINDOWS: define dso_local void @bar2()
|
||||
foo_dupes();
|
||||
@@ -41,7 +41,7 @@ void bar2() {
|
||||
// WINDOWS: call void @foo_dupes()
|
||||
}
|
||||
|
||||
int bar() {
|
||||
int bar(void) {
|
||||
// LINUX: define {{.*}}i32 @bar() #[[DEF:[0-9]+]]
|
||||
// WINDOWS: define dso_local i32 @bar() #[[DEF:[0-9]+]]
|
||||
return foo();
|
||||
@@ -68,7 +68,7 @@ foo_inline(void) { return 0; }
|
||||
inline int __attribute__((target_clones("arch=sandybridge,default,sse4.2")))
|
||||
foo_inline2(void);
|
||||
|
||||
int bar3() {
|
||||
int bar3(void) {
|
||||
// LINUX: define {{.*}}i32 @bar3()
|
||||
// WINDOWS: define dso_local i32 @bar3()
|
||||
return foo_inline() + foo_inline2();
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
// CHECK: define{{.*}} void @f() [[GPR_ATTRS:#[0-9]+]]
|
||||
void __attribute__((target("general-regs-only"))) f() { }
|
||||
void __attribute__((target("general-regs-only"))) f(void) { }
|
||||
// CHECK: define{{.*}} void @f_before() [[GPR_ATTRS:#[0-9]+]]
|
||||
void __attribute__((target("avx2,general-regs-only"))) f_before() { }
|
||||
void __attribute__((target("avx2,general-regs-only"))) f_before(void) { }
|
||||
// CHECK: define{{.*}} void @f_after() [[AVX2_ATTRS:#[0-9]+]]
|
||||
void __attribute__((target("general-regs-only,avx2"))) f_after() { }
|
||||
void __attribute__((target("general-regs-only,avx2"))) f_after(void) { }
|
||||
|
||||
// CHECK: attributes [[GPR_ATTRS]] = { {{.*}} "target-features"="{{.*}}-avx{{.*}}-avx2{{.*}}-avx512f{{.*}}-sse{{.*}}-sse2{{.*}}-ssse3{{.*}}-x87{{.*}}"
|
||||
// CHECK: attributes [[AVX2_ATTRS]] = { {{.*}} "target-features"="{{.*}}+avx{{.*}}+avx2{{.*}}+sse{{.*}}+sse2{{.*}}+ssse3{{.*}}-avx512f{{.*}}-x87{{.*}}"
|
||||
|
||||
@@ -8,7 +8,7 @@ int __attribute__((target("default"))) foo(int i) { return 2; }
|
||||
typedef int (*FuncPtr)(int);
|
||||
void func(FuncPtr);
|
||||
|
||||
int bar() {
|
||||
int bar(void) {
|
||||
func(foo);
|
||||
FuncPtr Free = &foo;
|
||||
FuncPtr Free2 = foo;
|
||||
|
||||
@@ -5,7 +5,7 @@ int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
|
||||
int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
|
||||
int __attribute__((target("default"))) foo(int i, ...) { return 2; }
|
||||
|
||||
int bar() {
|
||||
int bar(void) {
|
||||
return foo(1, 'a', 1.1) + foo(2, 2.2, "asdf");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ int __attribute__((target("arch=alderlake"))) foo(void) {return 11;}
|
||||
int __attribute__((target("arch=rocketlake"))) foo(void) {return 12;}
|
||||
int __attribute__((target("default"))) foo(void) { return 2; }
|
||||
|
||||
int bar() {
|
||||
int bar(void) {
|
||||
return foo();
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ inline int __attribute__((target("arch=sandybridge"))) foo_inline(void);
|
||||
inline int __attribute__((target("arch=ivybridge"))) foo_inline(void) {return 1;}
|
||||
inline int __attribute__((target("default"))) foo_inline(void) { return 2; }
|
||||
|
||||
int bar2() {
|
||||
int bar2(void) {
|
||||
return foo_inline();
|
||||
}
|
||||
|
||||
inline __attribute__((target("default"))) void foo_decls(void);
|
||||
inline __attribute__((target("sse4.2"))) void foo_decls(void);
|
||||
void bar3() {
|
||||
void bar3(void) {
|
||||
foo_decls();
|
||||
}
|
||||
inline __attribute__((target("default"))) void foo_decls(void) {}
|
||||
@@ -41,7 +41,7 @@ inline __attribute__((target("default"))) void foo_multi(int i, double d) {}
|
||||
inline __attribute__((target("avx,sse4.2"))) void foo_multi(int i, double d) {}
|
||||
inline __attribute__((target("sse4.2,fma4"))) void foo_multi(int i, double d) {}
|
||||
inline __attribute__((target("arch=ivybridge,fma4,sse4.2"))) void foo_multi(int i, double d) {}
|
||||
void bar4() {
|
||||
void bar4(void) {
|
||||
foo_multi(1, 5.0);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ int fwd_decl_avx(void);
|
||||
int __attribute__((target("avx"))) fwd_decl_avx(void) { return 2; }
|
||||
int __attribute__((target("default"))) fwd_decl_avx(void) { return 2; }
|
||||
|
||||
void bar5() {
|
||||
void bar5(void) {
|
||||
fwd_decl_default();
|
||||
fwd_decl_avx();
|
||||
}
|
||||
@@ -69,12 +69,12 @@ __attribute__((target("avx,sse4.2"), used)) inline void foo_used2(int i, double
|
||||
// PR50025:
|
||||
static void must_be_emitted(void) {}
|
||||
inline __attribute__((target("default"))) void pr50025(void) { must_be_emitted(); }
|
||||
void calls_pr50025() { pr50025(); }
|
||||
void calls_pr50025(void) { pr50025(); }
|
||||
|
||||
// Also need to make sure we get other multiversion functions.
|
||||
inline __attribute__((target("default"))) void pr50025b(void) { must_be_emitted(); }
|
||||
inline __attribute__((target("default"))) void pr50025c(void) { pr50025b(); }
|
||||
void calls_pr50025c() { pr50025c(); }
|
||||
void calls_pr50025c(void) { pr50025c(); }
|
||||
|
||||
// LINUX: @llvm.compiler.used = appending global [2 x i8*] [i8* bitcast (void (i32, double)* @foo_used to i8*), i8* bitcast (void (i32, double)* @foo_used2.avx_sse4.2 to i8*)], section "llvm.metadata"
|
||||
// WINDOWS: @llvm.used = appending global [2 x i8*] [i8* bitcast (void (i32, double)* @foo_used to i8*), i8* bitcast (void (i32, double)* @foo_used2.avx_sse4.2 to i8*)], section "llvm.metadata"
|
||||
|
||||
@@ -32,9 +32,9 @@ int __attribute__((target("arch=lakemont,mmx"))) use_before_def(void) {
|
||||
|
||||
int __attribute__((target("tune=sandybridge"))) walrus(int a) { return 4; }
|
||||
|
||||
void __attribute__((target("arch=x86-64-v2"))) x86_64_v2() {}
|
||||
void __attribute__((target("arch=x86-64-v3"))) x86_64_v3() {}
|
||||
void __attribute__((target("arch=x86-64-v4"))) x86_64_v4() {}
|
||||
void __attribute__((target("arch=x86-64-v2"))) x86_64_v2(void) {}
|
||||
void __attribute__((target("arch=x86-64-v3"))) x86_64_v3(void) {}
|
||||
void __attribute__((target("arch=x86-64-v4"))) x86_64_v4(void) {}
|
||||
|
||||
// Check that we emit the additional subtarget and cpu features for foo and not for baz or bar.
|
||||
// CHECK: baz{{.*}} #0
|
||||
|
||||
@@ -13,9 +13,9 @@ int g0 __attribute__((used));
|
||||
static void __attribute__((used)) f0(void) {
|
||||
}
|
||||
|
||||
void f1() {
|
||||
void f1(void) {
|
||||
static int l0 __attribute__((used)) = 5225;
|
||||
}
|
||||
|
||||
__attribute__((used)) int a0;
|
||||
void pr27535() { (void)a0; }
|
||||
void pr27535(void) { (void)a0; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %clang_cc1 %s -emit-llvm -o - | grep llvm.global_ctors
|
||||
|
||||
void foo() __attribute__((constructor));
|
||||
void foo() {
|
||||
void foo(void) __attribute__((constructor));
|
||||
void foo(void) {
|
||||
bar();
|
||||
}
|
||||
|
||||
@@ -32,41 +32,41 @@ void t9() __attribute__((weak, alias("__t8")));
|
||||
|
||||
// CHECK: declare extern_weak i32 @t15()
|
||||
int __attribute__((weak_import)) t15(void);
|
||||
int t17() {
|
||||
int t17(void) {
|
||||
return t15() + t16;
|
||||
}
|
||||
|
||||
// CHECK: define{{.*}} void @t1() [[NR:#[0-9]+]] {
|
||||
void t1() __attribute__((noreturn));
|
||||
void t1() { while (1) {} }
|
||||
void t1(void) __attribute__((noreturn));
|
||||
void t1(void) { while (1) {} }
|
||||
|
||||
// CHECK: define{{.*}} void @t2() [[NUW:#[0-9]+]] {
|
||||
void t2() __attribute__((nothrow));
|
||||
void t2() {}
|
||||
void t2(void) __attribute__((nothrow));
|
||||
void t2(void) {}
|
||||
|
||||
// CHECK: define weak{{.*}} void @t3() [[NUW]] {
|
||||
void t3() __attribute__((weak));
|
||||
void t3() {}
|
||||
void t3(void) __attribute__((weak));
|
||||
void t3(void) {}
|
||||
|
||||
// CHECK: define hidden void @t4() [[NUW]] {
|
||||
void t4() __attribute__((visibility("hidden")));
|
||||
void t4() {}
|
||||
void t4(void) __attribute__((visibility("hidden")));
|
||||
void t4(void) {}
|
||||
|
||||
// CHECK: define{{.*}} void @t7() [[NR]] {
|
||||
void t7() __attribute__((noreturn, nothrow));
|
||||
void t7() { while (1) {} }
|
||||
void t7(void) __attribute__((noreturn, nothrow));
|
||||
void t7(void) { while (1) {} }
|
||||
|
||||
// CHECK: define{{.*}} void @t72() [[COLDDEF:#[0-9]+]] {
|
||||
void t71(void) __attribute__((cold));
|
||||
void t72() __attribute__((cold));
|
||||
void t72() { t71(); }
|
||||
void t72(void) __attribute__((cold));
|
||||
void t72(void) { t71(); }
|
||||
// CHECK: call void @t71() [[COLDSITE:#[0-9]+]]
|
||||
// CHECK: declare void @t71() [[COLDDECL:#[0-9]+]]
|
||||
|
||||
// CHECK: define{{.*}} void @t82() [[HOTDEF:#[0-9]+]] {
|
||||
void t81(void) __attribute__((hot));
|
||||
void t82() __attribute__((hot));
|
||||
void t82() { t81(); }
|
||||
void t82(void) __attribute__((hot));
|
||||
void t82(void) { t81(); }
|
||||
// CHECK: call void @t81() [[HOTSITE:#[0-9]+]]
|
||||
// CHECK: declare void @t81() [[HOTDECL:#[0-9]+]]
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ inline void f0(int y) { x = y; }
|
||||
// CHECK: declare void @f0(i32 noundef)
|
||||
// LTO-LABEL: define{{.*}} void @test()
|
||||
// LTO: define available_externally void @f0
|
||||
void test() {
|
||||
void test(void) {
|
||||
f0(17);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const unsigned char val = 0;
|
||||
|
||||
int foo() {
|
||||
int foo(void) {
|
||||
__asm__ volatile("foo %0, 1" : : "fo" (val)); // expected-error {{invalid input constraint 'fo' in asm}}
|
||||
__asm__ volatile("foo %0, 1" : : "Nd" (val)); // expected-error {{invalid input constraint 'Nd' in asm}}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: %clang_cc1 -triple avr -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
int main() {
|
||||
int (*p)();
|
||||
int main(void) {
|
||||
int (*p)(void);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: %p = alloca i16 (...) addrspace(1)*
|
||||
// CHECK: %p = alloca i16 () addrspace(1)*
|
||||
|
||||
@@ -177,7 +177,7 @@ _Bool fsb(_Bool *c) {
|
||||
|
||||
char flag1;
|
||||
volatile char flag2;
|
||||
void test_and_set() {
|
||||
void test_and_set(void) {
|
||||
// CHECK: atomicrmw xchg i8* @flag1, i8 1 seq_cst, align 1
|
||||
__atomic_test_and_set(&flag1, memory_order_seq_cst);
|
||||
// CHECK: atomicrmw volatile xchg i8* @flag2, i8 1 acquire, align 1
|
||||
@@ -243,7 +243,7 @@ struct bar smallThing, thing1, thing2;
|
||||
struct foo bigThing;
|
||||
_Atomic(struct foo) bigAtomic;
|
||||
|
||||
void structAtomicStore() {
|
||||
void structAtomicStore(void) {
|
||||
// CHECK: @structAtomicStore
|
||||
struct foo f = {0};
|
||||
__c11_atomic_store(&bigAtomic, f, 5);
|
||||
@@ -256,7 +256,7 @@ void structAtomicStore() {
|
||||
__atomic_store(&bigThing, &f, 5);
|
||||
// CHECK: call void @__atomic_store(i64 noundef 512, i8* noundef {{.*}} @bigThing
|
||||
}
|
||||
void structAtomicLoad() {
|
||||
void structAtomicLoad(void) {
|
||||
// CHECK: @structAtomicLoad
|
||||
struct foo f = __c11_atomic_load(&bigAtomic, 5);
|
||||
// CHECK: call void @__atomic_load(i64 noundef 512, i8* noundef bitcast ({{.*}} @bigAtomic to i8*),
|
||||
@@ -268,7 +268,7 @@ void structAtomicLoad() {
|
||||
__atomic_load(&bigThing, &f, 5);
|
||||
// CHECK: call void @__atomic_load(i64 noundef 512, i8* noundef {{.*}} @bigThing
|
||||
}
|
||||
struct foo structAtomicExchange() {
|
||||
struct foo structAtomicExchange(void) {
|
||||
// CHECK: @structAtomicExchange
|
||||
struct foo f = {0};
|
||||
struct foo old;
|
||||
@@ -278,7 +278,7 @@ struct foo structAtomicExchange() {
|
||||
return __c11_atomic_exchange(&bigAtomic, f, 5);
|
||||
// CHECK: call void @__atomic_exchange(i64 noundef 512, i8* noundef bitcast ({{.*}} @bigAtomic to i8*),
|
||||
}
|
||||
int structAtomicCmpExchange() {
|
||||
int structAtomicCmpExchange(void) {
|
||||
// CHECK: @structAtomicCmpExchange
|
||||
_Bool x = __atomic_compare_exchange(&smallThing, &thing1, &thing2, 1, 5, 5);
|
||||
// CHECK: call zeroext i1 @__atomic_compare_exchange(i64 noundef 3, {{.*}} @smallThing{{.*}} @thing1{{.*}} @thing2
|
||||
@@ -295,7 +295,7 @@ int structAtomicCmpExchange() {
|
||||
_Atomic(int) atomic_init_i = 42;
|
||||
|
||||
// CHECK: @atomic_init_foo
|
||||
void atomic_init_foo()
|
||||
void atomic_init_foo(void)
|
||||
{
|
||||
// CHECK-NOT: }
|
||||
// CHECK-NOT: atomic
|
||||
|
||||
@@ -35,7 +35,7 @@ int f0_reload(struct s0 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i64 @test_0()
|
||||
// CHECK-OPT: ret i64 1
|
||||
// CHECK-OPT: }
|
||||
unsigned long long test_0() {
|
||||
unsigned long long test_0(void) {
|
||||
struct s0 g0 = { 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g0.f0;
|
||||
@@ -81,7 +81,7 @@ int f1_reload(struct s1 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i64 @test_1()
|
||||
// CHECK-OPT: ret i64 210
|
||||
// CHECK-OPT: }
|
||||
unsigned long long test_1() {
|
||||
unsigned long long test_1(void) {
|
||||
struct s1 g1 = { 0xdeadbeef, 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g1.f0 ^ g1.f1;
|
||||
@@ -123,7 +123,7 @@ int f2_reload(union u2 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i64 @test_2()
|
||||
// CHECK-OPT: ret i64 2
|
||||
// CHECK-OPT: }
|
||||
unsigned long long test_2() {
|
||||
unsigned long long test_2(void) {
|
||||
union u2 g2 = { 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g2.f0;
|
||||
@@ -159,7 +159,7 @@ int f3_reload(struct s3 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i64 @test_3()
|
||||
// CHECK-OPT: ret i64 -559039940
|
||||
// CHECK-OPT: }
|
||||
unsigned long long test_3() {
|
||||
unsigned long long test_3(void) {
|
||||
struct s3 g3 = { 0xdeadbeef, 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g3.f0 ^ g3.f1;
|
||||
@@ -193,7 +193,7 @@ int f4_reload(struct s4 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i64 @test_4()
|
||||
// CHECK-OPT: ret i64 4860
|
||||
// CHECK-OPT: }
|
||||
unsigned long long test_4() {
|
||||
unsigned long long test_4(void) {
|
||||
struct s4 g4 = { 0xdeadbeef, 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g4.f0 ^ g4.f1;
|
||||
@@ -225,7 +225,7 @@ int f5_reload(struct s5 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i64 @test_5()
|
||||
// CHECK-OPT: ret i64 2
|
||||
// CHECK-OPT: }
|
||||
unsigned long long test_5() {
|
||||
unsigned long long test_5(void) {
|
||||
struct s5 g5 = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g5.f0 ^ g5.f1 ^ g5.f2;
|
||||
@@ -255,7 +255,7 @@ int f6_reload(struct s6 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} zeroext i1 @test_6()
|
||||
// CHECK-OPT: ret i1 true
|
||||
// CHECK-OPT: }
|
||||
_Bool test_6() {
|
||||
_Bool test_6(void) {
|
||||
struct s6 g6 = { 0xF };
|
||||
unsigned long long res = 0;
|
||||
res ^= g6.f0;
|
||||
@@ -313,7 +313,7 @@ int f8_reload(struct s8 *a0) {
|
||||
// CHECK-OPT-LABEL: define{{.*}} i32 @test_8()
|
||||
// CHECK-OPT: ret i32 -3
|
||||
// CHECK-OPT: }
|
||||
unsigned test_8() {
|
||||
unsigned test_8(void) {
|
||||
struct s8 g8 = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef };
|
||||
unsigned long long res = 0;
|
||||
res ^= g8.f0 ^ g8.f2 ^ g8.f3;
|
||||
|
||||
@@ -19,7 +19,7 @@ struct s0 {
|
||||
unsigned f2 : 2;
|
||||
};
|
||||
|
||||
int g0();
|
||||
int g0(void);
|
||||
|
||||
void f0(void) {
|
||||
struct s0 s;
|
||||
|
||||
@@ -6,7 +6,7 @@ const c d = { 1 };
|
||||
struct Token {
|
||||
unsigned n : 31;
|
||||
};
|
||||
void sqlite3CodeSubselect(){
|
||||
void sqlite3CodeSubselect(void){
|
||||
struct Token one = { 1 };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10
|
||||
// rdar://10001085
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
^{
|
||||
__attribute__((__blocks__(byref))) int index = ({ int __a; int __b; __a < __b ? __b : __a; });
|
||||
};
|
||||
@@ -13,7 +13,7 @@ typedef struct {} Z;
|
||||
|
||||
typedef int (^B)(Z);
|
||||
|
||||
void testPR13229() {
|
||||
void testPR13229(void) {
|
||||
Z z1;
|
||||
B b1 = ^(Z z1) { return 1; };
|
||||
b1(z1);
|
||||
|
||||
@@ -7,7 +7,7 @@ Agg makeAgg(void);
|
||||
// When assigning into a __block variable, ensure that we compute that
|
||||
// address *after* evaluating the RHS when the RHS has the capacity to
|
||||
// cause a block copy. rdar://9309454
|
||||
void test0() {
|
||||
void test0(void) {
|
||||
__block Agg a = {100};
|
||||
^{ (void)a; };
|
||||
|
||||
@@ -35,7 +35,7 @@ void test0() {
|
||||
// When chaining assignments into __block variables, make sure we
|
||||
// propagate the actual value into the outer variable.
|
||||
// rdar://11757470
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
__block Agg a, b;
|
||||
^{ (void)a; (void)b; };
|
||||
a = b = makeAgg();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
void foo();
|
||||
|
||||
float bar() {
|
||||
float bar(void) {
|
||||
float lookupTable[] = {-1,-1,-1,0, -1,-1,0,-1, -1,-1,0,1, -1,-1,1,0,
|
||||
-1,0,-1,-1, -1,0,-1,1, -1,0,1,-1, -1,0,1,1,
|
||||
-1,1,-1,0, -1,1,0,-1, -1,1,0,1, -1,1,1,0,
|
||||
|
||||
@@ -6,7 +6,7 @@ void syslog(const char *, ...);
|
||||
void handler( );
|
||||
|
||||
__attribute__((used))
|
||||
static void (^spd)() = ^()
|
||||
static void (^spd)(void) = ^(void)
|
||||
{
|
||||
handler( ^(){ syslog("%s", __FUNCTION__); } );
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
int printf(const char *, ...);
|
||||
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
__block int a;
|
||||
int b=2;
|
||||
a=1;
|
||||
@@ -29,7 +29,7 @@ void test1() {
|
||||
printf("a is %d, b is %d\n", a, b);
|
||||
}
|
||||
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
__block int a;
|
||||
a=1;
|
||||
printf("a is %d\n", a);
|
||||
@@ -43,13 +43,13 @@ void test2() {
|
||||
printf("a is %d\n", a);
|
||||
}
|
||||
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
__block int k;
|
||||
__block int (^j)(int);
|
||||
^{j=0; k=0;}(); // needs copy/dispose
|
||||
}
|
||||
|
||||
int test4() {
|
||||
int test4(void) {
|
||||
extern int g;
|
||||
static int i = 1;
|
||||
^(int j){ i = j; g = 0; }(0); // does not need copy/dispose
|
||||
@@ -58,25 +58,25 @@ int test4() {
|
||||
|
||||
int g;
|
||||
|
||||
void test5() {
|
||||
void test5(void) {
|
||||
__block struct { int i; } i;
|
||||
^{ (void)i; }(); // needs copy/dispose
|
||||
}
|
||||
|
||||
void test6() {
|
||||
void test6(void) {
|
||||
__block int i;
|
||||
^{ i=1; }(); // needs copy/dispose
|
||||
^{}(); // does not need copy/dispose
|
||||
}
|
||||
|
||||
void test7() {
|
||||
void test7(void) {
|
||||
^{ // does not need copy/dispose
|
||||
__block int i;
|
||||
^{ i = 1; }(); // needs copy/dispose
|
||||
}();
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
int rv = 0;
|
||||
test1();
|
||||
test2();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// RUN: %clang_cc1 -emit-llvm -o - -triple i386-apple-darwin10 -fblocks %s
|
||||
typedef int __attribute__((aligned(32))) ai;
|
||||
|
||||
void f() {
|
||||
void f(void) {
|
||||
__block ai a = 10;
|
||||
|
||||
^{
|
||||
@@ -10,7 +10,7 @@ void f() {
|
||||
}();
|
||||
}
|
||||
|
||||
void g() {
|
||||
void g(void) {
|
||||
__block double a = 10;
|
||||
|
||||
^{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
|
||||
// CHECK: [[Vi:%.+]] = alloca %struct.__block_byref_i, align 8
|
||||
// CHECK: call i32 (...) @rhs()
|
||||
// CHECK: call i32 @rhs()
|
||||
// CHECK: [[V7:%.+]] = getelementptr inbounds %struct.__block_byref_i, %struct.__block_byref_i* [[Vi]], i32 0, i32 1
|
||||
// CHECK: load %struct.__block_byref_i*, %struct.__block_byref_i** [[V7]]
|
||||
// CHECK: call i32 (...) @rhs()
|
||||
// CHECK: call i32 @rhs()
|
||||
// CHECK: [[V11:%.+]] = getelementptr inbounds %struct.__block_byref_i, %struct.__block_byref_i* [[Vi]], i32 0, i32 1
|
||||
// CHECK: load %struct.__block_byref_i*, %struct.__block_byref_i** [[V11]]
|
||||
|
||||
int rhs();
|
||||
int rhs(void);
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
__block int i;
|
||||
^{ (void)i; };
|
||||
i = rhs();
|
||||
|
||||
@@ -68,7 +68,7 @@ ftype ^test2 = ^ftype {
|
||||
|
||||
// rdar://problem/8605032
|
||||
void f3_helper(void (^)(void));
|
||||
void f3() {
|
||||
void f3(void) {
|
||||
_Bool b = 0;
|
||||
f3_helper(^{ if (b) {} });
|
||||
}
|
||||
@@ -101,7 +101,7 @@ void f5(void) {
|
||||
|
||||
// rdar://14085217
|
||||
void (^b)() = ^{};
|
||||
int main() {
|
||||
int main(void) {
|
||||
(b?: ^{})();
|
||||
}
|
||||
// CHECK: [[ZERO:%.*]] = load void (...)*, void (...)** @b
|
||||
@@ -112,7 +112,7 @@ int main() {
|
||||
|
||||
// Ensure that we don't emit helper code in copy/dispose routines for variables
|
||||
// that are const-captured.
|
||||
void testConstCaptureInCopyAndDestroyHelpers() {
|
||||
void testConstCaptureInCopyAndDestroyHelpers(void) {
|
||||
const int x = 0;
|
||||
__block int i;
|
||||
(^ { i = x; })();
|
||||
|
||||
@@ -13,7 +13,7 @@ double f(int b, int i) {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @f2
|
||||
void f2() {
|
||||
void f2(void) {
|
||||
// everything is constant; no trap possible
|
||||
// CHECK-NOT: call {{.*}} @llvm.{{(ubsan)?trap}}
|
||||
int a[2];
|
||||
@@ -26,7 +26,7 @@ void f2() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @f3
|
||||
void f3() {
|
||||
void f3(void) {
|
||||
int a[1];
|
||||
// CHECK: call {{.*}} @llvm.{{(ubsan)?trap}}
|
||||
a[2] = 1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %clang %s -O0 -emit-llvm -S -o - | FileCheck %s
|
||||
|
||||
void foo();
|
||||
void bar();
|
||||
void foo(void);
|
||||
void bar(void);
|
||||
|
||||
void fold_if(int a, int b) {
|
||||
// CHECK: define {{.*}} @fold_if(
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
// Note that the frontend inverts branches to simplify the condition, so the
|
||||
// order of a branch instruction's labels cannot be used as a source order bias.
|
||||
|
||||
void calla();
|
||||
void callb();
|
||||
void callc();
|
||||
void calla(void);
|
||||
void callb(void);
|
||||
void callc(void);
|
||||
|
||||
// CHECK: @test1
|
||||
// CHECK: @calla
|
||||
|
||||
@@ -81,28 +81,28 @@ int test4(int *a, int b) {
|
||||
return a[0];
|
||||
}
|
||||
|
||||
int *m1() __attribute__((assume_aligned(64)));
|
||||
int *m1(void) __attribute__((assume_aligned(64)));
|
||||
|
||||
// CHECK-LABEL: @test5(
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call align 64 i32* (...) @m1()
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call align 64 i32* @m1()
|
||||
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4
|
||||
// CHECK-NEXT: ret i32 [[TMP0]]
|
||||
//
|
||||
int test5() {
|
||||
int test5(void) {
|
||||
return *m1();
|
||||
}
|
||||
|
||||
int *m2() __attribute__((assume_aligned(64, 12)));
|
||||
int *m2(void) __attribute__((assume_aligned(64, 12)));
|
||||
|
||||
// CHECK-LABEL: @test6(
|
||||
// CHECK-NEXT: entry:
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call i32* (...) @m2()
|
||||
// CHECK-NEXT: [[CALL:%.*]] = call i32* @m2()
|
||||
// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i32* [[CALL]], i64 64, i64 12) ]
|
||||
// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4
|
||||
// CHECK-NEXT: ret i32 [[TMP0]]
|
||||
//
|
||||
int test6() {
|
||||
int test6(void) {
|
||||
return *m2();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ struct foo test0(int expr) {
|
||||
|
||||
/* --- Pointer types */
|
||||
|
||||
int test1() {
|
||||
int test1(void) {
|
||||
// CHECK-LABEL: test1
|
||||
// CHECK: ret i32 0
|
||||
return __builtin_constant_p(&a - 13);
|
||||
@@ -29,7 +29,7 @@ int test1() {
|
||||
|
||||
int b[] = {1, 2, 3};
|
||||
|
||||
int test2() {
|
||||
int test2(void) {
|
||||
// CHECK-LABEL: test2
|
||||
// CHECK: ret i32 0
|
||||
return __builtin_constant_p(b);
|
||||
@@ -37,7 +37,7 @@ int test2() {
|
||||
|
||||
const char test3_c[] = {1, 2, 3, 0};
|
||||
|
||||
int test3() {
|
||||
int test3(void) {
|
||||
// CHECK-LABEL: test3
|
||||
// CHECK: ret i32 0
|
||||
return __builtin_constant_p(test3_c);
|
||||
@@ -47,7 +47,7 @@ inline char test4_i(const char *x) {
|
||||
return x[1];
|
||||
}
|
||||
|
||||
int test4() {
|
||||
int test4(void) {
|
||||
// CHECK: define{{.*}} i32 @test4
|
||||
// CHECK: ret i32 0
|
||||
return __builtin_constant_p(test4_i(test3_c));
|
||||
@@ -57,7 +57,7 @@ int test4() {
|
||||
|
||||
const int c = 42;
|
||||
|
||||
int test5() {
|
||||
int test5(void) {
|
||||
// CHECK-LABEL: test5
|
||||
// CHECK: ret i32 1
|
||||
return __builtin_constant_p(c);
|
||||
@@ -68,19 +68,19 @@ int test5() {
|
||||
int arr[] = { 1, 2, 3 };
|
||||
const int c_arr[] = { 1, 2, 3 };
|
||||
|
||||
int test6() {
|
||||
int test6(void) {
|
||||
// CHECK-LABEL: test6
|
||||
// CHECK: call i1 @llvm.is.constant.i32
|
||||
return __builtin_constant_p(arr[2]);
|
||||
}
|
||||
|
||||
int test7() {
|
||||
int test7(void) {
|
||||
// CHECK-LABEL: test7
|
||||
// CHECK: call i1 @llvm.is.constant.i32
|
||||
return __builtin_constant_p(c_arr[2]);
|
||||
}
|
||||
|
||||
int test8() {
|
||||
int test8(void) {
|
||||
// CHECK-LABEL: test8
|
||||
// CHECK: ret i32 0
|
||||
return __builtin_constant_p(c_arr);
|
||||
@@ -88,13 +88,13 @@ int test8() {
|
||||
|
||||
/* --- Function pointers */
|
||||
|
||||
int test9() {
|
||||
int test9(void) {
|
||||
// CHECK-LABEL: test9
|
||||
// CHECK: ret i32 0
|
||||
return __builtin_constant_p(&test9);
|
||||
}
|
||||
|
||||
int test10() {
|
||||
int test10(void) {
|
||||
// CHECK-LABEL: test10
|
||||
// CHECK: ret i32 1
|
||||
return __builtin_constant_p(&test10 != 0);
|
||||
@@ -122,7 +122,7 @@ extern fn_p *dest_p;
|
||||
static void src_fn(void) {
|
||||
}
|
||||
|
||||
void test11() {
|
||||
void test11(void) {
|
||||
assign(dest_p, src_fn);
|
||||
}
|
||||
|
||||
@@ -137,16 +137,16 @@ struct { int a; } test13 = { __builtin_constant_p(test13_v) };
|
||||
|
||||
extern unsigned long long test14_v;
|
||||
|
||||
void test14() {
|
||||
void test14(void) {
|
||||
// CHECK-LABEL: test14
|
||||
// CHECK: call void asm sideeffect "", {{.*}}(i32 -1)
|
||||
__asm__ __volatile__("" :: "n"( (__builtin_constant_p(test14_v) || 0) ? 1 : -1));
|
||||
}
|
||||
|
||||
int test15_f();
|
||||
int test15_f(void);
|
||||
// CHECK-LABEL: define{{.*}} void @test15
|
||||
// CHECK-NOT: call {{.*}}test15_f
|
||||
void test15() {
|
||||
void test15(void) {
|
||||
int a, b;
|
||||
(void)__builtin_constant_p((a = b, test15_f()));
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ extern void a(const char *);
|
||||
|
||||
// CHECK: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] }
|
||||
|
||||
void intel() {
|
||||
void intel(void) {
|
||||
if (__builtin_cpu_is("intel"))
|
||||
a("intel");
|
||||
|
||||
@@ -14,7 +14,7 @@ void intel() {
|
||||
// CHECK: = icmp eq i32 [[LOAD]], 1
|
||||
}
|
||||
|
||||
void amd() {
|
||||
void amd(void) {
|
||||
if (__builtin_cpu_is("amd"))
|
||||
a("amd");
|
||||
|
||||
@@ -22,7 +22,7 @@ void amd() {
|
||||
// CHECK: = icmp eq i32 [[LOAD]], 2
|
||||
}
|
||||
|
||||
void atom() {
|
||||
void atom(void) {
|
||||
if (__builtin_cpu_is("atom"))
|
||||
a("atom");
|
||||
|
||||
@@ -30,7 +30,7 @@ void atom() {
|
||||
// CHECK: = icmp eq i32 [[LOAD]], 1
|
||||
}
|
||||
|
||||
void amdfam10h() {
|
||||
void amdfam10h(void) {
|
||||
if (__builtin_cpu_is("amdfam10h"))
|
||||
a("amdfam10h");
|
||||
|
||||
@@ -38,7 +38,7 @@ void amdfam10h() {
|
||||
// CHECK: = icmp eq i32 [[LOAD]], 4
|
||||
}
|
||||
|
||||
void barcelona() {
|
||||
void barcelona(void) {
|
||||
if (__builtin_cpu_is("barcelona"))
|
||||
a("barcelona");
|
||||
|
||||
@@ -46,7 +46,7 @@ void barcelona() {
|
||||
// CHECK: = icmp eq i32 [[LOAD]], 4
|
||||
}
|
||||
|
||||
void nehalem() {
|
||||
void nehalem(void) {
|
||||
if (__builtin_cpu_is("nehalem"))
|
||||
a("nehalem");
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern void a(const char *);
|
||||
// CHECK: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] }
|
||||
// CHECK: @__cpu_features2 = external dso_local global i32
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
__builtin_cpu_init();
|
||||
|
||||
// CHECK: call void @__cpu_indicator_init
|
||||
|
||||
@@ -28,9 +28,9 @@ int expect_not_taken(int x) {
|
||||
|
||||
int x;
|
||||
int y(void);
|
||||
void foo();
|
||||
void foo(void);
|
||||
|
||||
void expect_value_side_effects() {
|
||||
void expect_value_side_effects(void) {
|
||||
// ALL-LABEL: define{{.*}} void @expect_value_side_effects()
|
||||
// ALL: [[CALL:%.*]] = call i32 @y
|
||||
// O1: [[SEXT:%.*]] = sext i32 [[CALL]] to i64
|
||||
@@ -46,12 +46,12 @@ void expect_value_side_effects() {
|
||||
// There's no compare, so there's nothing to expect?
|
||||
// rdar://9330105
|
||||
void isigprocmask(void);
|
||||
long bar();
|
||||
long bar(void);
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
// ALL-LABEL: define{{.*}} i32 @main()
|
||||
// ALL: call void @isigprocmask()
|
||||
// ALL: [[CALL:%.*]] = call i64 (...) @bar()
|
||||
// ALL: [[CALL:%.*]] = call i64 @bar()
|
||||
// O1: call i64 @llvm.expect.i64(i64 0, i64 [[CALL]])
|
||||
// O0-NOT: @llvm.expect
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void test8(int *arg) {
|
||||
}
|
||||
|
||||
__attribute((aligned(16))) int x[4], y[4];
|
||||
void test9() {
|
||||
void test9(void) {
|
||||
// CHECK: @test9
|
||||
// CHECK: call void @llvm.memcpy{{.*}} align 16 {{.*}} align 16 {{.*}} 16, i1 false)
|
||||
__builtin_memcpy(x, y, sizeof(y));
|
||||
@@ -95,7 +95,7 @@ wchar_t src;
|
||||
|
||||
// CHECK-LABEL: @test10
|
||||
// FIXME: Consider lowering these to llvm.memcpy / llvm.memmove.
|
||||
void test10() {
|
||||
void test10(void) {
|
||||
// CHECK: call i32* @wmemcpy(i32* noundef @dest, i32* noundef @src, i32 noundef 4)
|
||||
__builtin_wmemcpy(&dest, &src, 4);
|
||||
|
||||
@@ -104,7 +104,7 @@ void test10() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test11
|
||||
void test11() {
|
||||
void test11(void) {
|
||||
typedef struct { int a; } b;
|
||||
int d;
|
||||
b e;
|
||||
@@ -115,7 +115,7 @@ void test11() {
|
||||
// CHECK-LABEL: @test12
|
||||
extern char dest_array[];
|
||||
extern char src_array[];
|
||||
void test12() {
|
||||
void test12(void) {
|
||||
// CHECK: call void @llvm.memcpy{{.*}}(
|
||||
memcpy(&dest_array, &dest_array, 2);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user