|
@@ -45,6 +45,7 @@ public:
|
|
class mycls {
|
|
class mycls {
|
|
public:
|
|
public:
|
|
int fcl(int x);
|
|
int fcl(int x);
|
|
|
|
+ virtual int fvcl(int x);
|
|
static int fscl(int x);
|
|
static int fscl(int x);
|
|
|
|
|
|
class embed_cls2 {
|
|
class embed_cls2 {
|
|
@@ -53,6 +54,11 @@ public:
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+class derived : public mycls {
|
|
|
|
+public:
|
|
|
|
+ virtual int fvcl(int x) override;
|
|
|
|
+};
|
|
|
|
+
|
|
namespace chns {
|
|
namespace chns {
|
|
int chf1(int x);
|
|
int chf1(int x);
|
|
}
|
|
}
|
|
@@ -98,6 +104,14 @@ union U {
|
|
};
|
|
};
|
|
extern U extU;
|
|
extern U extU;
|
|
|
|
|
|
|
|
+void test_virtual_functions(mycls* obj) {
|
|
|
|
+ // The dynamic type is known.
|
|
|
|
+ clang_analyzer_eval(mycls().fvcl(1) == 8); // expected-warning{{TRUE}}
|
|
|
|
+ clang_analyzer_eval(derived().fvcl(1) == 9); // expected-warning{{TRUE}}
|
|
|
|
+ // We cannot decide about the dynamic type.
|
|
|
|
+ clang_analyzer_eval(obj->fvcl(1) == 8); // expected-warning{{FALSE}} expected-warning{{TRUE}}
|
|
|
|
+}
|
|
|
|
+
|
|
int main() {
|
|
int main() {
|
|
clang_analyzer_eval(f(3) == 2); // expected-warning{{TRUE}}
|
|
clang_analyzer_eval(f(3) == 2); // expected-warning{{TRUE}}
|
|
clang_analyzer_eval(f(4) == 3); // expected-warning{{TRUE}}
|
|
clang_analyzer_eval(f(4) == 3); // expected-warning{{TRUE}}
|
|
@@ -116,7 +130,7 @@ int main() {
|
|
clang_analyzer_eval(fun_using_anon_struct(8) == 8); // expected-warning{{TRUE}}
|
|
clang_analyzer_eval(fun_using_anon_struct(8) == 8); // expected-warning{{TRUE}}
|
|
|
|
|
|
clang_analyzer_eval(other_macro_diag(1) == 1); // expected-warning{{TRUE}}
|
|
clang_analyzer_eval(other_macro_diag(1) == 1); // expected-warning{{TRUE}}
|
|
- // expected-warning@Inputs/ctu-other.cpp:80{{REACHABLE}}
|
|
|
|
|
|
+ // expected-warning@Inputs/ctu-other.cpp:93{{REACHABLE}}
|
|
MACRODIAG(); // expected-warning{{REACHABLE}}
|
|
MACRODIAG(); // expected-warning{{REACHABLE}}
|
|
|
|
|
|
clang_analyzer_eval(extInt == 2); // expected-warning{{TRUE}}
|
|
clang_analyzer_eval(extInt == 2); // expected-warning{{TRUE}}
|