| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus \ |
| 2 |
// RUN: -analyzer-output=plist -o %t.plist -w -verify=pure %s |
| 3 |
// RUN: cat %t.plist | FileCheck --check-prefixes=PURE %s |
| 4 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus \ |
| 5 |
// RUN: -analyzer-output=plist -o %t.plist -w -verify=impure %s |
| 6 |
// RUN: cat %t.plist | FileCheck --check-prefixes=IMPURE %s |
| 7 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus,optin.cplusplus \ |
| 8 |
// RUN: -analyzer-output=plist -o %t.plist -w -verify=pure,impure %s |
| 9 |
// RUN: cat %t.plist | FileCheck --check-prefixes=PURE,IMPURE %s |
| 10 |
|
| 11 |
struct S { |
| 12 |
virtual void foo(); |
| 13 |
virtual void bar() = 0; |
| 14 |
|
| 15 |
S() { |
| 16 |
// IMPURE: Call to virtual method 'S::foo' during construction bypasses virtual dispatch |
| 17 |
// IMPURE: optin.cplusplus.VirtualCall |
| 18 |
foo(); // impure-warning{{Call to virtual method 'S::foo' during construction bypasses virtual dispatch}} |
| 19 |
// PURE: Call to pure virtual method 'S::bar' during construction has undefined behavior |
| 20 |
// PURE: cplusplus.PureVirtualCall |
| 21 |
bar(); // pure-warning{{Call to pure virtual method 'S::bar' during construction has undefined behavior}} |
| 22 |
} |
| 23 |
}; |