brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 60a53d4 Raw
54 lines · plain
1// RUN: %clang_analyze_cc1 -w -Wno-int-conversion %s -verify \2// RUN:     -analyzer-checker=core,alpha.core,debug.ExprInspection3 4#ifdef HEADER // A clever trick to avoid splitting up the test.5extern void clang_analyzer_eval(int);6 7@interface NSObject8@end9 10@interface HeaderClass : NSObject11@property NSObject *prop;12@end13 14#else15#define HEADER16#include "ObjCProperties.m"17 18@implementation HeaderClass19- (void)foo {20  if ((self.prop)) {21  }22 23  // This test tests that no dynamic bifurcation is performed on the property.24  // The TRUE/FALSE dilemma correctly arises from eagerly-assume behavior25  // inside the if-statement. The dynamic bifurcation at (self.prop) inside26  // the if-statement was causing an UNKNOWN to show up as well due to27  // extra parentheses being caught inside PseudoObjectExpr.28  // This should not be UNKNOWN.29  clang_analyzer_eval(self.prop); // expected-warning{{TRUE}}30                                  // expected-warning@-1{{FALSE}}31}32@end33 34 35// The point of this test cases is to exercise properties in the static36// analyzer37 38@interface MyClass {39@private40    id _X;41}42- (id)initWithY:(id)Y;43@property(copy, readwrite) id X;44@end45 46@implementation MyClass47@synthesize X = _X;48- (id)initWithY:(id)Y {49  self.X = Y;50  return self;51}52@end53#endif54