brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 831d700 Raw
47 lines · plain
1// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s2// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify -fobjc-arc %s3 4#if __has_feature(objc_arc)5// expected-no-diagnostics6#endif7 8@interface SomeClass9@end10 11void simpleStrongPointerValue(void) {12  SomeClass *x;13  if (x) {}14#if !__has_feature(objc_arc)15// expected-warning@-2{{Branch condition evaluates to a garbage value}}16#endif17}18 19void simpleArray(void) {20  SomeClass *vlaArray[5];21 22  if (vlaArray[0]) {}23#if !__has_feature(objc_arc)24// expected-warning@-2{{Branch condition evaluates to a garbage value}}25#endif26}27 28void variableLengthArray(void) {29   int count = 1;30   SomeClass * vlaArray[count];31 32   if (vlaArray[0]) {}33#if !__has_feature(objc_arc)34  // expected-warning@-2{{Branch condition evaluates to a garbage value}}35#endif36}37 38void variableLengthArrayWithExplicitStrongAttribute(void) {39   int count = 1;40   __attribute__((objc_ownership(strong))) SomeClass * vlaArray[count];41 42   if (vlaArray[0]) {}43#if !__has_feature(objc_arc)44  // expected-warning@-2{{Branch condition evaluates to a garbage value}}45#endif46}47