diff options
author | Eric Christopher <echristo@gmail.com> | 2018-05-30 21:11:45 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2018-05-30 21:11:45 +0000 |
commit | 5b91350b4a572b6a6317f3907204d77d8c66d9b1 (patch) | |
tree | 51d47ac1231636ec9cb783a9123a024becdd54f8 | |
parent | 63ec0ea7bc6b5d1e50c15f00c505c78cae01256e (diff) | |
download | bcm5719-llvm-5b91350b4a572b6a6317f3907204d77d8c66d9b1.tar.gz bcm5719-llvm-5b91350b4a572b6a6317f3907204d77d8c66d9b1.zip |
Add fopen to the list of builtins that we check and whitelist.
llvm-svn: 333594
-rw-r--r-- | clang/include/clang/Basic/Builtins.def | 1 | ||||
-rw-r--r-- | clang/test/CodeGen/libcalls-fno-builtin.c | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def index 2126acb9413..510b143d5b3 100644 --- a/clang/include/clang/Basic/Builtins.def +++ b/clang/include/clang/Basic/Builtins.def @@ -862,6 +862,7 @@ LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(fopen, "P*cC*cC*", "f", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(fread, "zv*zzP*", "f", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(fwrite, "zvC*zzP*", "f", "stdio.h", ALL_LANGUAGES) diff --git a/clang/test/CodeGen/libcalls-fno-builtin.c b/clang/test/CodeGen/libcalls-fno-builtin.c index 14f361747c8..6fac6ee3390 100644 --- a/clang/test/CodeGen/libcalls-fno-builtin.c +++ b/clang/test/CodeGen/libcalls-fno-builtin.c @@ -5,7 +5,8 @@ // RUN: -fno-builtin-strcpy -fno-builtin-stpcpy -fno-builtin-strncpy -fno-builtin-strlen \ // RUN: -fno-builtin-strpbrk -fno-builtin-strspn -fno-builtin-strtod -fno-builtin-strtof \ // RUN: -fno-builtin-strtold -fno-builtin-strtol -fno-builtin-strtoll -fno-builtin-strtoul \ -// RUN: -fno-builtin-strtoull -fno-builtin-fread -fno-builtin-fwrite -o - %s | FileCheck %s +// RUN: -fno-builtin-strtoull -fno-builtin-fread -fno-builtin-fwrite -fno-builtin-fopen \ +// RUN: -o - %s | FileCheck %s // RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck --check-prefix=ASM %s // RUN: %clang_cc1 -S -O3 -fno-builtin-ceil -o - %s | FileCheck --check-prefix=ASM-INDIV %s @@ -41,6 +42,7 @@ unsigned long long int strtoull(const char *nptr, char **endptr, int base); size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); +FILE *fopen(const char *path, const char *mode); double t1(double x) { return ceil(x); } // CHECK-LABEL: t1 @@ -152,4 +154,10 @@ void t25(FILE *fp, int *buf) { // CHECK: call{{.*}}@fwrite{{.*}} [[ATTR]] // CHECK: call{{.*}}@fread{{.*}} [[ATTR]] +FILE *t26(const char *path, const char *mode) { + return fopen(path, mode); +} +// CHECK-LABEL: t26 +// CHECK: call{{.*}}@fopen{{.*}} [[ATTR]] + // CHECK: [[ATTR]] = { nobuiltin } |