brintos

brintos / llvm-project-archived public Read only

0
0
Text · 806 B · be46776 Raw
42 lines · plain
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx -verify %s2 3typedef signed char BOOL;4 5@protocol NSObject  - (BOOL)isEqual:(id)object; @end6@interface NSObject <NSObject> {}7+(id)alloc;8+(id)new;9-(id)init;10-(id)autorelease;11-(id)copy;12- (Class)class;13-(id)retain;14- (oneway void)release;15@end16 17@interface Cell : NSObject {18  int x;19}20- (id) init;21- (void)test;22@end23 24@implementation Cell25- (id) init {26  if ((self = [super init])) {27    return self;28  }29  // Test that this is being analyzed.30  int m;31  m = m + 1; //expected-warning {{The left operand of '+' is a garbage value}}32  return self;33}34 35// Make sure that we do not propagate the 'nil' check from inlined 'init' to 'test'.36- (void) test {37  Cell *newCell = [[Cell alloc] init];38  newCell->x = 5; // no-warning39  [newCell release];40}41@end42