[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / objc-string.mm
blob53f3c3736261e7ae58c2357b839352a183b3ee34
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -Wno-objc-literal-conversion %s
3 void clang_analyzer_eval(bool);
4 @class NSString;
6 void sanity() {
7   clang_analyzer_eval(@""); // expected-warning{{TRUE}}
8   clang_analyzer_eval(@"abc"); // expected-warning{{TRUE}}
11 namespace rdar13773117 {
12   NSString *const kConstantGlobalString = @"foo";
13   NSString *globalString = @"bar";
15   extern void invalidateGlobals();
17   void testGlobals() {
18     clang_analyzer_eval(kConstantGlobalString); // expected-warning{{TRUE}}
19     clang_analyzer_eval(globalString); // expected-warning{{UNKNOWN}}
21     globalString = @"baz";
22     clang_analyzer_eval(globalString); // expected-warning{{TRUE}}
24     invalidateGlobals();
26     clang_analyzer_eval(kConstantGlobalString); // expected-warning{{TRUE}}
27     clang_analyzer_eval(globalString); // expected-warning{{UNKNOWN}}
28   }
30   NSString *returnString(NSString *input = @"garply") {
31     return input;
32   }
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   }