[cfe-commits] r167661 - /cfe/trunk/test/CodeGen/libcalls-fno-builtin.c

Meador Inge meadori at codesourcery.com
Fri Nov 9 19:56:55 PST 2012


Author: meadori
Date: Fri Nov  9 21:56:55 2012
New Revision: 167661

URL: http://llvm.org/viewvc/llvm-project?rev=167661&view=rev
Log:
Add a few more test cases for verifying -fno-builtin.

Some holes in testing where discovered while working on the LLVM library
call simplifiers.

Modified:
    cfe/trunk/test/CodeGen/libcalls-fno-builtin.c

Modified: cfe/trunk/test/CodeGen/libcalls-fno-builtin.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/libcalls-fno-builtin.c?rev=167661&r1=167660&r2=167661&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/libcalls-fno-builtin.c (original)
+++ cfe/trunk/test/CodeGen/libcalls-fno-builtin.c Fri Nov  9 21:56:55 2012
@@ -1,11 +1,32 @@
 // RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck %s
 // rdar://10551066
 
+typedef __SIZE_TYPE__ size_t;
+
 double ceil(double x);
 double copysign(double,double);
 double cos(double x);
 double fabs(double x);
 double floor(double x);
+char *strcat(char *s1, const char *s2);
+char *strncat(char *s1, const char *s2, size_t n);
+char *strchr(const char *s, int c);
+char *strrchr(const char *s, int c);
+int strcmp(const char *s1, const char *s2);
+int strncmp(const char *s1, const char *s2, size_t n);
+char *strcpy(char *s1, const char *s2);
+char *stpcpy(char *s1, const char *s2);
+char *strncpy(char *s1, const char *s2, size_t n);
+size_t strlen(const char *s);
+char *strpbrk(const char *s1, const char *s2);
+size_t strspn(const char *s1, const char *s2);
+double strtod(const char *nptr, char **endptr);
+float strtof(const char *nptr, char **endptr);
+long double strtold(const char *nptr, char **endptr);
+long int strtol(const char *nptr, char **endptr, int base);
+long long int strtoll(const char *nptr, char **endptr, int base);
+unsigned long int strtoul(const char *nptr, char **endptr, int base);
+unsigned long long int strtoull(const char *nptr, char **endptr, int base);
 
 double t1(double x) { return ceil(x); }
 // CHECK: t1
@@ -26,3 +47,79 @@
 double t5(double x) { return floor(x); }
 // CHECK: t5
 // CHECK: floor
+
+char *t6(char *x) { return strcat(x, ""); }
+// CHECK: t6
+// CHECK: strcat
+
+char *t7(char *x) { return strncat(x, "", 1); }
+// CHECK: t7
+// CHECK: strncat
+
+char *t8(void) { return strchr("hello, world", 'w'); }
+// CHECK: t8
+// CHECK: strchr
+
+char *t9(void) { return strrchr("hello, world", 'w'); }
+// CHECK: t9
+// CHECK: strrchr
+
+int t10(void) { return strcmp("foo", "bar"); }
+// CHECK: t10
+// CHECK: strcmp
+
+int t11(void) { return strncmp("foo", "bar", 3); }
+// CHECK: t11
+// CHECK: strncmp
+
+char *t12(char *x) { return strcpy(x, "foo"); }
+// CHECK: t12
+// CHECK: strcpy
+
+char *t13(char *x) { return stpcpy(x, "foo"); }
+// CHECK: t13
+// CHECK: stpcpy
+
+char *t14(char *x) { return strncpy(x, "foo", 3); }
+// CHECK: t14
+// CHECK: strncpy
+
+size_t t15(void) { return strlen("foo"); }
+// CHECK: t15
+// CHECK: strlen
+
+char *t16(char *x) { return strpbrk(x, ""); }
+// CHECK: t16
+// CHECK: strpbrk
+
+size_t t17(char *x) { return strspn(x, ""); }
+// CHECK: t17
+// CHECK: strspn
+
+double t18(char **x) { return strtod("123.4", x); }
+// CHECK: t18
+// CHECK: strtod
+
+float t19(char **x) { return strtof("123.4", x); }
+// CHECK: t19
+// CHECK: strtof
+
+long double t20(char **x) { return strtold("123.4", x); }
+// CHECK: t20
+// CHECK: strtold
+
+long int t21(char **x) { return strtol("1234", x, 10); }
+// CHECK: t21
+// CHECK: strtol
+
+long int t22(char **x) { return strtoll("1234", x, 10); }
+// CHECK: t22
+// CHECK: strtoll
+
+long int t23(char **x) { return strtoul("1234", x, 10); }
+// CHECK: t23
+// CHECK: strtoul
+
+long int t24(char **x) { return strtoull("1234", x, 10); }
+// CHECK: t24
+// CHECK: strtoull





More information about the cfe-commits mailing list