1 // RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -S -O3 -fno-builtin-ceil -fno-builtin-copysign -fno-builtin-cos \
3 // RUN:  -fno-builtin-fabs -fno-builtin-floor -fno-builtin-strcat -fno-builtin-strncat \
4 // RUN:  -fno-builtin-strchr -fno-builtin-strrchr -fno-builtin-strcmp -fno-builtin-strncmp \
5 // RUN:  -fno-builtin-strcpy -fno-builtin-stpcpy -fno-builtin-strncpy -fno-builtin-strlen \
6 // RUN:  -fno-builtin-strpbrk -fno-builtin-strspn -fno-builtin-strtod -fno-builtin-strtof \
7 // RUN:  -fno-builtin-strtold -fno-builtin-strtol -fno-builtin-strtoll -fno-builtin-strtoul \
8 // RUN:  -fno-builtin-strtoull -o - %s | FileCheck %s
9 // rdar://10551066
10 
11 typedef __SIZE_TYPE__ size_t;
12 
13 double ceil(double x);
14 double copysign(double,double);
15 double cos(double x);
16 double fabs(double x);
17 double floor(double x);
18 char *strcat(char *s1, const char *s2);
19 char *strncat(char *s1, const char *s2, size_t n);
20 char *strchr(const char *s, int c);
21 char *strrchr(const char *s, int c);
22 int strcmp(const char *s1, const char *s2);
23 int strncmp(const char *s1, const char *s2, size_t n);
24 char *strcpy(char *s1, const char *s2);
25 char *stpcpy(char *s1, const char *s2);
26 char *strncpy(char *s1, const char *s2, size_t n);
27 size_t strlen(const char *s);
28 char *strpbrk(const char *s1, const char *s2);
29 size_t strspn(const char *s1, const char *s2);
30 double strtod(const char *nptr, char **endptr);
31 float strtof(const char *nptr, char **endptr);
32 long double strtold(const char *nptr, char **endptr);
33 long int strtol(const char *nptr, char **endptr, int base);
34 long long int strtoll(const char *nptr, char **endptr, int base);
35 unsigned long int strtoul(const char *nptr, char **endptr, int base);
36 unsigned long long int strtoull(const char *nptr, char **endptr, int base);
37 
t1(double x)38 double t1(double x) { return ceil(x); }
39 // CHECK: t1
40 // CHECK: ceil
41 
t2(double x,double y)42 double t2(double x, double y) { return copysign(x,y); }
43 // CHECK: t2
44 // CHECK: copysign
45 
t3(double x)46 double t3(double x) { return cos(x); }
47 // CHECK: t3
48 // CHECK: cos
49 
t4(double x)50 double t4(double x) { return fabs(x); }
51 // CHECK: t4
52 // CHECK: fabs
53 
t5(double x)54 double t5(double x) { return floor(x); }
55 // CHECK: t5
56 // CHECK: floor
57 
t6(char * x)58 char *t6(char *x) { return strcat(x, ""); }
59 // CHECK: t6
60 // CHECK: strcat
61 
t7(char * x)62 char *t7(char *x) { return strncat(x, "", 1); }
63 // CHECK: t7
64 // CHECK: strncat
65 
t8(void)66 char *t8(void) { return strchr("hello, world", 'w'); }
67 // CHECK: t8
68 // CHECK: strchr
69 
t9(void)70 char *t9(void) { return strrchr("hello, world", 'w'); }
71 // CHECK: t9
72 // CHECK: strrchr
73 
t10(void)74 int t10(void) { return strcmp("foo", "bar"); }
75 // CHECK: t10
76 // CHECK: strcmp
77 
t11(void)78 int t11(void) { return strncmp("foo", "bar", 3); }
79 // CHECK: t11
80 // CHECK: strncmp
81 
t12(char * x)82 char *t12(char *x) { return strcpy(x, "foo"); }
83 // CHECK: t12
84 // CHECK: strcpy
85 
t13(char * x)86 char *t13(char *x) { return stpcpy(x, "foo"); }
87 // CHECK: t13
88 // CHECK: stpcpy
89 
t14(char * x)90 char *t14(char *x) { return strncpy(x, "foo", 3); }
91 // CHECK: t14
92 // CHECK: strncpy
93 
t15(void)94 size_t t15(void) { return strlen("foo"); }
95 // CHECK: t15
96 // CHECK: strlen
97 
t16(char * x)98 char *t16(char *x) { return strpbrk(x, ""); }
99 // CHECK: t16
100 // CHECK: strpbrk
101 
t17(char * x)102 size_t t17(char *x) { return strspn(x, ""); }
103 // CHECK: t17
104 // CHECK: strspn
105 
t18(char ** x)106 double t18(char **x) { return strtod("123.4", x); }
107 // CHECK: t18
108 // CHECK: strtod
109 
t19(char ** x)110 float t19(char **x) { return strtof("123.4", x); }
111 // CHECK: t19
112 // CHECK: strtof
113 
t20(char ** x)114 long double t20(char **x) { return strtold("123.4", x); }
115 // CHECK: t20
116 // CHECK: strtold
117 
t21(char ** x)118 long int t21(char **x) { return strtol("1234", x, 10); }
119 // CHECK: t21
120 // CHECK: strtol
121 
t22(char ** x)122 long int t22(char **x) { return strtoll("1234", x, 10); }
123 // CHECK: t22
124 // CHECK: strtoll
125 
t23(char ** x)126 long int t23(char **x) { return strtoul("1234", x, 10); }
127 // CHECK: t23
128 // CHECK: strtoul
129 
t24(char ** x)130 long int t24(char **x) { return strtoull("1234", x, 10); }
131 // CHECK: t24
132 // CHECK: strtoull
133