[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / method-call.cpp
blob4f6a9a430a78e6e1c15a6dbd6ee3bffa4ac21039
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config c++-inlining=constructors -verify %s
3 void clang_analyzer_eval(bool);
6 struct A {
7 int x;
8 A(int a) { x = a; }
9 int getx() const { return x; }
12 struct B{
13 int x;
16 void testNullObject(A *a) {
17 clang_analyzer_eval(a); // expected-warning{{UNKNOWN}}
18 (void)a->getx(); // assume we know what we're doing
19 clang_analyzer_eval(a); // expected-warning{{TRUE}}
22 void f1() {
23 A x(3);
24 clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
27 void f2() {
28 const A &x = A(3);
29 clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
32 void f3() {
33 const A &x = (A)3;
34 clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
37 void f4() {
38 A x = 3;
39 clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
42 void checkThatCopyConstructorDoesNotInvalidateObjectBeingCopied() {
43 B t;
44 t.x = 0;
45 B t2(t);
46 clang_analyzer_eval(t.x == 0); // expected-warning{{TRUE}}