]> granicus.if.org Git - clang/commitdiff
Clean up builtin lists, add a few new builtins. (I re-sorted the
authorEli Friedman <eli.friedman@gmail.com>
Thu, 4 Jun 2009 19:35:30 +0000 (19:35 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 4 Jun 2009 19:35:30 +0000 (19:35 +0000)
string.h builtins to be in the same order as the list in the C99
standard.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72882 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Builtins.def
test/Analysis/ptr-arith.c

index 11f3264faa2d23e3820e38f858ec7a27880e0ae8..1baee6ddd80646c400b74554e53b779272f76e6e 100644 (file)
@@ -332,25 +332,31 @@ BUILTIN(__sync_fetch_and_max, "ii*i", "n")
 BUILTIN(__sync_fetch_and_umin, "UiUi*Ui", "n")
 BUILTIN(__sync_fetch_and_umax, "UiUi*Ui", "n")
 
-// Builtin library functions
-LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h")
+// C99 library functions
+// C99 stdlib.h
 LIBBUILTIN(calloc, "v*zz",        "f",     "stdlib.h")
 LIBBUILTIN(malloc, "v*z",         "f",     "stdlib.h")
 LIBBUILTIN(realloc, "v*v*z",      "f",     "stdlib.h")
+// C99 string.h
 LIBBUILTIN(memcpy, "v*v*vC*z",    "f",     "string.h")
 LIBBUILTIN(memmove, "v*v*vC*z",   "f",     "string.h")
-LIBBUILTIN(memset, "v*v*iz",      "f",     "string.h")
+LIBBUILTIN(strcpy, "c*c*cC*",     "f",     "string.h")
+LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     "string.h")
 LIBBUILTIN(strcat, "c*c*cC*",     "f",     "string.h")
+LIBBUILTIN(strncat, "c*c*cC*z",   "f",     "string.h")
+LIBBUILTIN(strxfrm, "zc*cC*z",    "f",     "string.h")
+LIBBUILTIN(memchr, "v*vC*iz",     "f",     "string.h")
 LIBBUILTIN(strchr, "c*cC*i",      "f",     "string.h")
-LIBBUILTIN(strcpy, "c*c*cC*",     "f",     "string.h")
 LIBBUILTIN(strcspn, "zcC*cC*",    "f",     "string.h")
-LIBBUILTIN(strlen, "zcC*",        "f",     "string.h")
-LIBBUILTIN(strncat, "c*c*cC*z",   "f",     "string.h")
-LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     "string.h")
 LIBBUILTIN(strpbrk, "c*cC*cC*",   "f",     "string.h")
 LIBBUILTIN(strrchr, "c*cC*i",     "f",     "string.h")
 LIBBUILTIN(strspn, "zcC*cC*",     "f",     "string.h")
 LIBBUILTIN(strstr, "c*cC*cC*",    "f",     "string.h")
+LIBBUILTIN(strtok, "c*c*cC*",     "f",     "string.h")
+LIBBUILTIN(memset, "v*v*iz",      "f",     "string.h")
+LIBBUILTIN(strerror, "c*i",       "f",     "string.h")
+LIBBUILTIN(strlen, "zcC*",        "f",     "string.h")
+// C99 stdio.h
 LIBBUILTIN(printf, "icC*.",       "fp:0:", "stdio.h")
 LIBBUILTIN(fprintf, "iP*cC*.",    "fp:1:", "stdio.h")
 LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", "stdio.h")
@@ -360,6 +366,13 @@ LIBBUILTIN(vfprintf, "i.",        "fP:1:", "stdio.h")
 LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h")
 LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h")
 
+// Non-C library functions
+// FIXME: Non-C-standard stuff shouldn't be builtins in non-GNU mode!
+LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h")
+// POSIX strings.h
+LIBBUILTIN(index, "c*cC*i",       "f",     "strings.h")
+LIBBUILTIN(rindex, "c*cC*i",      "f",     "strings.h")
+
 // FIXME: This type isn't very correct, it should be
 //   id objc_msgSend(id, SEL)
 // but we need new type letters for that.
index ea8b7f566615a3b88c3420cab5412c2730c6bfcb..34840c7b7c58261868684a45324858e3f492eac3 100644 (file)
@@ -18,7 +18,7 @@ void f2() {
 // This test case checks if we get the right rvalue type of a TypedViewRegion.
 // The ElementRegion's type depends on the array region's rvalue type. If it was
 // a pointer type, we would get a loc::SymbolVal for '*p'.
-char* memchr();
+void* memchr();
 static int
 domain_port (const char *domain_b, const char *domain_e,
              const char **domain_e_ptr)