1 // RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -verify %s \ 2 // RUN: -analyzer-checker=core.builtin \ 3 // RUN: -analyzer-checker=debug.ExprInspection \ 4 // RUN: -analyzer-checker=unix.cstring \ 5 // RUN: -analyzer-config display-checker-name=false 6 7 struct S { 8 int z; 9 }; 10 11 void clang_analyzer_explain_int(int); 12 void clang_analyzer_explain_voidp(void *); 13 void clang_analyzer_explain_S(struct S); 14 15 int glob; 16 test_1(int param,void * ptr)17void test_1(int param, void *ptr) { 18 clang_analyzer_explain_voidp(&glob); // expected-warning-re{{{{^pointer to global variable 'glob'$}}}} 19 clang_analyzer_explain_int(param); // expected-warning-re{{{{^argument 'param'$}}}} 20 clang_analyzer_explain_voidp(ptr); // expected-warning-re{{{{^argument 'ptr'$}}}} 21 if (param == 42) 22 clang_analyzer_explain_int(param); // expected-warning-re{{{{^signed 32-bit integer '42'$}}}} 23 } 24 test_2(struct S s)25void test_2(struct S s) { 26 clang_analyzer_explain_S(s); //expected-warning-re{{{{^lazily frozen compound value of parameter 's'$}}}} 27 clang_analyzer_explain_voidp(&s); // expected-warning-re{{{{^pointer to parameter 's'$}}}} 28 clang_analyzer_explain_int(s.z); // expected-warning-re{{{{^initial value of field 'z' of parameter 's'$}}}} 29 } 30 test_3(int param)31void test_3(int param) { 32 clang_analyzer_explain_voidp(¶m); // expected-warning-re{{{{^pointer to parameter 'param'$}}}} 33 } 34 test_non_top_level(int param)35void test_non_top_level(int param) { 36 clang_analyzer_explain_voidp(¶m); // expected-warning-re{{{{^pointer to parameter 'param'$}}}} 37 } 38 test_4(int n)39void test_4(int n) { 40 test_non_top_level(n); 41 } 42