diff options
| author | Anna Zaks <ganna@apple.com> | 2012-02-29 18:42:47 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2012-02-29 18:42:47 +0000 |
| commit | e0c03cab58c92716882c09b279cd07417ba3ffca (patch) | |
| tree | 05a674b3103521a7eb3ffb292a8e9a943172607d /clang/test/Analysis/system-header-simulator.h | |
| parent | 64d6eb1195796726f5096f84c281ca22b68aa295 (diff) | |
| download | bcm5719-llvm-e0c03cab58c92716882c09b279cd07417ba3ffca.tar.gz bcm5719-llvm-e0c03cab58c92716882c09b279cd07417ba3ffca.zip | |
[analyzer] Malloc: A pointer might escape through CFContainers APIs,
funopen, setvbuf.
Teach the checker and the engine about these APIs to resolve malloc
false positives. As I am adding more of these APIs, it is clear that all
this should be factored out into a separate callback (for example,
region escapes). Malloc, KeyChainAPI and RetainRelease checkers could
all use it.
llvm-svn: 151737
Diffstat (limited to 'clang/test/Analysis/system-header-simulator.h')
| -rw-r--r-- | clang/test/Analysis/system-header-simulator.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/clang/test/Analysis/system-header-simulator.h b/clang/test/Analysis/system-header-simulator.h index 472cb5a6160..6212131071d 100644 --- a/clang/test/Analysis/system-header-simulator.h +++ b/clang/test/Analysis/system-header-simulator.h @@ -2,16 +2,37 @@ typedef struct _FILE FILE; extern FILE *stdin; -int fscanf(FILE *restrict stream, const char *restrict format, ...); +extern FILE *stdout; +extern FILE *stderr; +// Include a variant of standard streams that occur in the pre-processed file. +extern FILE *__stdinp; +extern FILE *__stdoutp; +extern FILE *__stderrp; + + +int fscanf(FILE *restrict, const char *restrict, ...); // Note, on some platforms errno macro gets replaced with a function call. extern int errno; unsigned long strlen(const char *); -char *strcpy(char *restrict s1, const char *restrict s2); +char *strcpy(char *restrict, const char *restrict); typedef unsigned long __darwin_pthread_key_t; typedef __darwin_pthread_key_t pthread_key_t; -int pthread_setspecific(pthread_key_t , - const void *); +int pthread_setspecific(pthread_key_t, const void *); + +typedef long long __int64_t; +typedef __int64_t __darwin_off_t; +typedef __darwin_off_t fpos_t; + +void setbuf(FILE * restrict, char * restrict); +int setvbuf(FILE * restrict, char * restrict, int, size_t); + +FILE *funopen(const void *, + int (*)(void *, char *, int), + int (*)(void *, const char *, int), + fpos_t (*)(void *, fpos_t, int), + int (*)(void *)); + |

