[cfe-commits] r72882 - in /cfe/trunk: include/clang/AST/Builtins.def test/Analysis/ptr-arith.c

Eli Friedman eli.friedman at gmail.com
Thu Jun 4 12:35:31 PDT 2009

Author: efriedma
Date: Thu Jun  4 14:35:30 2009
New Revision: 72882

URL: http://llvm.org/viewvc/llvm-project?rev=72882&view=rev
Clean up builtin lists, add a few new builtins.  (I re-sorted the 
string.h builtins to be in the same order as the list in the C99 


Modified: cfe/trunk/include/clang/AST/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Builtins.def?rev=72882&r1=72881&r2=72882&view=diff

--- cfe/trunk/include/clang/AST/Builtins.def (original)
+++ cfe/trunk/include/clang/AST/Builtins.def Thu Jun  4 14:35:30 2009
@@ -332,25 +332,31 @@
 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(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.

Modified: cfe/trunk/test/Analysis/ptr-arith.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/ptr-arith.c?rev=72882&r1=72881&r2=72882&view=diff

--- cfe/trunk/test/Analysis/ptr-arith.c (original)
+++ cfe/trunk/test/Analysis/ptr-arith.c Thu Jun  4 14:35:30 2009
@@ -18,7 +18,7 @@
 // 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)

More information about the cfe-commits mailing list