]> granicus.if.org Git - clang/commitdiff
Add some stdlib builtins
authorDaniel Dunbar <daniel@zuster.org>
Fri, 20 Feb 2009 06:36:40 +0000 (06:36 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 20 Feb 2009 06:36:40 +0000 (06:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65115 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Builtins.def
test/CodeGen/builtins.c

index 94696e8174f7ab03501af43c1ad9b29db2232c65..ce116586678f7a7ec43a680a818716150f0b9303 100644 (file)
@@ -138,6 +138,12 @@ BUILTIN(__builtin_bzero, "vv*z", "n")
 BUILTIN(__builtin_memcpy, "v*v*vC*z", "n")
 BUILTIN(__builtin_memmove, "v*v*vC*z", "n")
 BUILTIN(__builtin_memset, "v*v*iz", "n")
+BUILTIN(__builtin_strcat, "c*c*cC*", "nF")
+BUILTIN(__builtin_strncat, "c*c*cC*z", "nF")
+BUILTIN(__builtin_strcpy, "c*c*cC*", "nF")
+BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF")
+BUILTIN(__builtin_strchr, "c*cC*i", "nF")
+BUILTIN(__builtin_strrchr, "c*cC*i", "nF")
 BUILTIN(__builtin_return_address, "v*Ui", "n")
 BUILTIN(__builtin_frame_address, "v*Ui", "n")
 BUILTIN(__builtin_flt_rounds, "i", "nc")
index e7055d9ad8a43a76eb620e30de40bd70f6d1097c..07f3db9465fb00274240ee783f9e1da669671a9b 100644 (file)
@@ -77,9 +77,17 @@ int main() {
   Q(powif, (1.2f, N));
   Q(powil, (1.2f, N));
 
-  // Object size checking
+  // Lib functions
   int a, b, n = random(); // Avoid optimizing out.
   char s0[10], s1[] = "Hello";
+  V(strcat, (s0, s1));
+  V(strncat, (s0, s1, n));
+  V(strchr, (s0, s1[0]));
+  V(strrchr, (s0, s1[0]));
+  V(strcpy, (s0, s1));
+  V(strncpy, (s0, s1, n));
+  
+  // Object size checking
   V(__memset_chk, (s0, 0, sizeof s0, n));
   V(__memcpy_chk, (s0, s1, sizeof s0, n));
   V(__memmove_chk, (s0, s1, sizeof s0, n));