1 // RUN: %clang_analyze_cc1 -std=c++2b -verify %s \
2 // RUN: -analyzer-checker=core,debug.ExprInspection
4 template <typename T
> void clang_analyzer_dump(T
);
10 void a(this auto Self
) {
11 clang_analyzer_dump(&Self
); // expected-warning {{&Self}}
12 clang_analyzer_dump(Self
.orig
); // expected-warning {{&s}}
13 clang_analyzer_dump(Self
.num
); // expected-warning {{5 S32b}}
14 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{5 S32b}}
17 clang_analyzer_dump(Self
.num
); // expected-warning {{1 S32b}}
18 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{5 S32b}}
21 void b(this auto& Self
) {
22 clang_analyzer_dump(&Self
); // expected-warning {{&s}}
23 clang_analyzer_dump(Self
.orig
); // expected-warning {{&s}}
24 clang_analyzer_dump(Self
.num
); // expected-warning {{5 S32b}}
25 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{5 S32b}}
28 clang_analyzer_dump(Self
.num
); // expected-warning {{2 S32b}}
29 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{2 S32b}}
33 clang_analyzer_dump(&Self
); // expected-warning {{&Self}}
34 clang_analyzer_dump(Self
.orig
); // expected-warning {{&s}}
35 clang_analyzer_dump(Self
.num
); // expected-warning {{2 S32b}}
36 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{2 S32b}}
39 clang_analyzer_dump(Self
.num
); // expected-warning {{3 S32b}}
40 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{2 S32b}}
43 void c(this S Self
, int I
) {
44 clang_analyzer_dump(I
); // expected-warning {{11 S32b}}
45 clang_analyzer_dump(&Self
); // expected-warning {{&Self}}
46 clang_analyzer_dump(Self
.orig
); // expected-warning {{&s}}
47 clang_analyzer_dump(Self
.num
); // expected-warning {{2 S32b}}
48 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{2 S32b}}
51 clang_analyzer_dump(Self
.num
); // expected-warning {{4 S32b}}
52 clang_analyzer_dump(Self
.orig
->num
); // expected-warning {{2 S32b}}
57 S s
= {/*num=*/5, /*orig=*/&s
};
59 s
.b(); // This call changes 's.num' to 2.