inline.c revision b3d74da3e1620c9a7a378afb5f244e4987e6713e
1// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
2
3int test1_f1() {
4  int y = 1;
5  y++;
6  return y;
7}
8
9void test1_f2() {
10  int x = 1;
11  x = test1_f1();
12  if (x == 1) {
13    int *p = 0;
14    *p = 3; // no-warning
15  }
16  if (x == 2) {
17    int *p = 0;
18    *p = 3; // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
19  }
20}
21
22// Test that inlining works when the declared function has less arguments
23// than the actual number in the declaration.
24void test2_f1() {}
25int test2_f2();
26
27void test2_f3() {
28  test2_f1(test2_f2()); // expected-warning{{too many arguments in call to 'test2_f1'}}
29}
30
31