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