blob: 709ebf779376ee8e2bc238ab6f0b0a47c2b54962 [file] [log] [blame]
Jordan Rose7f660852012-08-15 21:56:23 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,debug.ExprInspection -analyzer-store=region -verify %s
2
3void clang_analyzer_eval(int);
Zhongxing Xuc4988482008-10-22 14:39:20 +00004
5void f(void) {
6 void (*p)(void);
7 p = f;
Tom Care6216dc02010-08-30 19:25:43 +00008 p = &f;
Zhongxing Xuc4988482008-10-22 14:39:20 +00009 p();
10 (*p)();
11}
Zhongxing Xu92429dd2008-10-27 09:21:27 +000012
13void g(void (*fp)(void));
14
15void f2() {
16 g(f);
17}
Jordan Rose7f660852012-08-15 21:56:23 +000018
19void f3(void (*f)(void), void (*g)(void)) {
20 clang_analyzer_eval(!f); // expected-warning{{UNKNOWN}}
21 f();
22 clang_analyzer_eval(!f); // expected-warning{{FALSE}}
23
24 clang_analyzer_eval(!g); // expected-warning{{UNKNOWN}}
25 (*g)();
26 clang_analyzer_eval(!g); // expected-warning{{FALSE}}
27}