xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/objc-bool.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang --analyze %s -o %t -Xclang -verify
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc// Test handling of ObjC bool literals.
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuctypedef signed char BOOL;
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambucvoid rdar_10597458() {
9*f4a2713aSLionel Sambuc  if (__objc_yes)
10*f4a2713aSLionel Sambuc    return;
11*f4a2713aSLionel Sambuc  int *p = 0;
12*f4a2713aSLionel Sambuc  *p = 0xDEADBEEF; // no-warning
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambucvoid rdar_10597458_b(BOOL b) {
16*f4a2713aSLionel Sambuc  if (b == __objc_no)
17*f4a2713aSLionel Sambuc    return;
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc  if (b == __objc_no) {
20*f4a2713aSLionel Sambuc    int *p = 0;
21*f4a2713aSLionel Sambuc    *p = 0xDEADBEEF; // no-warning
22*f4a2713aSLionel Sambuc  }
23*f4a2713aSLionel Sambuc}
24