Add fopen to the list of builtins that we check and whitelist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333594 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2018-05-30 21:11:45 +00:00
parent ce5f8b38a8
commit 7c6bc9f175
2 changed files with 10 additions and 1 deletions

View File

@ -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)

View File

@ -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 }