summaryrefslogtreecommitdiffstats
path: root/test/Analysis/static_local.m
blob: daa7ef54c9f8ad55dddb9583bb119f117610349d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify -Wno-objc-root-class %s
// expected-no-diagnostics

// Test reasoning about static locals in ObjCMethods. 
int *getValidPtr();
@interface Radar11275803
- (int) useStaticInMethod;
@end
@implementation Radar11275803

- (int) useStaticInMethod
{
  static int *explInit = 0;
  static int implInit;
  if (!implInit)
    explInit = getValidPtr();
  return *explInit; //no-warning
}
@end