blob: 701479faa820be06aa87de1aaedbf8b0eee31e72 [file] [log] [blame]
Anna Zaks2cbe7912011-12-20 22:35:30 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -verify %s
2
3// Intra-procedural C++ tests.
4
5// Test relaxing function call arguments invalidation to be aware of const
6// arguments. radar://10595327
7struct InvalidateArgs {
8 void ttt(const int &nptr);
9 virtual void vttt(const int *nptr);
10};
11struct ChildOfInvalidateArgs: public InvalidateArgs {
12 virtual void vttt(const int *nptr);
13};
14void declarationFun(int x) {
15 InvalidateArgs t;
16 x = 3;
17 int y = x + 1;
18 int *p = 0;
19 t.ttt(y);
20 if (x == y)
21 y = *p; // no-warning
22}
23void virtualFun(int x) {
24 ChildOfInvalidateArgs t;
25 InvalidateArgs *pt = &t;
26 x = 3;
27 int y = x + 1;
28 int *p = 0;
29 pt->vttt(&y);
30 if (x == y)
31 y = *p; // no-warning
32}