aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis-Apple/NoReturn.m
blob: 3447bfbc94c86bcdc0391dc242340b139f799a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: clang -checker-simple -verify %s
// RUN: clang -checker-cfref -verify %s


#include <Foundation/NSException.h>
#include <Foundation/NSString.h>

int f1(int *x, NSString* s) {
  
  if (x) ++x;
  
  [NSException raise:@"Blah" format:[NSString stringWithFormat:@"Blah %@", s]];
  
  return *x; // no-warning
}

int f2(int *x, ...) {
  
  if (x) ++x;
  va_list alist;
  va_start(alist, x);
  
  [NSException raise:@"Blah" format:@"Blah %@" arguments:alist];
  
  return *x; // no-warning
}

int f3(int* x) {
  
  if (x) ++x;
  
  [[NSException exceptionWithName:@"My Exception" reason:@"Want to test exceptions." userInfo:nil] raise];

  return *x; // no-warning
}