1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -Wno-objc-literal-conversion %s 2 3 void clang_analyzer_eval(bool); 4 @class NSString; 5 6 void sanity() { 7 clang_analyzer_eval(@""); // expected-warning{{TRUE}} 8 clang_analyzer_eval(@"abc"); // expected-warning{{TRUE}} 9 } 10 11 namespace rdar13773117 { 12 NSString *const kConstantGlobalString = @"foo"; 13 NSString *globalString = @"bar"; 14 15 extern void invalidateGlobals(); 16 17 void testGlobals() { 18 clang_analyzer_eval(kConstantGlobalString); // expected-warning{{TRUE}} 19 clang_analyzer_eval(globalString); // expected-warning{{UNKNOWN}} 20 21 globalString = @"baz"; 22 clang_analyzer_eval(globalString); // expected-warning{{TRUE}} 23 24 invalidateGlobals(); 25 26 clang_analyzer_eval(kConstantGlobalString); // expected-warning{{TRUE}} 27 clang_analyzer_eval(globalString); // expected-warning{{UNKNOWN}} 28 } 29 30 NSString *returnString(NSString *input = @"garply") { 31 return input; 32 } 33 34 void testDefaultArg() { 35 clang_analyzer_eval(returnString(@"")); // expected-warning{{TRUE}} 36 clang_analyzer_eval(returnString(0)); // expected-warning{{FALSE}} 37 clang_analyzer_eval(returnString()); // expected-warning{{TRUE}} 38 } 39 } 40