24 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus \2// RUN: -analyzer-output=plist -o %t.plist -w -verify=pure %s3// RUN: cat %t.plist | FileCheck --check-prefixes=PURE %s4// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus \5// RUN: -analyzer-output=plist -o %t.plist -w -verify=impure %s6// RUN: cat %t.plist | FileCheck --check-prefixes=IMPURE %s7// RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus,optin.cplusplus \8// RUN: -analyzer-output=plist -o %t.plist -w -verify=pure,impure %s9// RUN: cat %t.plist | FileCheck --check-prefixes=PURE,IMPURE %s10 11struct 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 dispatch17 // IMPURE: optin.cplusplus.VirtualCall18 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 behavior20 // PURE: cplusplus.PureVirtualCall21 bar(); // pure-warning{{Call to pure virtual method 'S::bar' during construction has undefined behavior}}22 }23};24