exceptions.mm revision 19275bdec34b2ec5d77a78c0ea393a45ab05e128
1// RUN: %clang_cc1 -analyze -fexceptions -fobjc-exceptions -fcxx-exceptions -analyzer-ipa=inlining -analyzer-checker=core,unix.Malloc,debug.ExprInspection -verify %s
2
3void clang_analyzer_checkInlined(bool);
4
5typedef typeof(sizeof(int)) size_t;
6void *malloc(size_t);
7void free(void *);
8
9
10id getException();
11void inlinedObjC() {
12  clang_analyzer_checkInlined(true); // expected-warning{{TRUE}}
13  @throw getException();
14}
15
16int testObjC() {
17  int a; // uninitialized
18  void *mem = malloc(4); // no-warning (ObjC exceptions are usually fatal)
19  inlinedObjC();
20  free(mem);
21  return a; // no-warning
22}
23
24