[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / new-with-exceptions.cpp
blob9d02574229c1bbc45c168de544bf05f4b29295c8
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-store region -std=c++11 -fexceptions -fcxx-exceptions -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-store region -std=c++11 -verify %s
4 void clang_analyzer_eval(bool);
6 typedef __typeof__(sizeof(int)) size_t;
7 extern "C" void *malloc(size_t);
9 // This is the standard placement new.
10 inline void* operator new(size_t, void* __p) throw()
12 return __p;
15 struct NoThrow {
16 void *operator new(size_t) throw();
19 struct NoExcept {
20 void *operator new(size_t) noexcept;
23 struct DefaultThrow {
24 void *operator new(size_t);
27 struct ExplicitThrow {
28 void *operator new(size_t) throw(int);
31 void testNew() {
32 clang_analyzer_eval(new NoThrow); // expected-warning{{UNKNOWN}}
33 clang_analyzer_eval(new NoExcept); // expected-warning{{UNKNOWN}}
35 clang_analyzer_eval(new DefaultThrow); // expected-warning{{TRUE}}
36 clang_analyzer_eval(new ExplicitThrow); // expected-warning{{TRUE}}
39 void testNewArray() {
40 clang_analyzer_eval(new NoThrow[2]); // expected-warning{{TRUE}}
41 clang_analyzer_eval(new NoExcept[2]); // expected-warning{{TRUE}}
42 clang_analyzer_eval(new DefaultThrow[2]); // expected-warning{{TRUE}}
43 clang_analyzer_eval(new ExplicitThrow[2]); // expected-warning{{TRUE}}
46 extern void *operator new[](size_t, int) noexcept;
48 void testNewArrayNoThrow() {
49 clang_analyzer_eval(new (1) NoThrow[2]); // expected-warning{{UNKNOWN}}
50 clang_analyzer_eval(new (1) NoExcept[2]); // expected-warning{{UNKNOWN}}
51 clang_analyzer_eval(new (1) DefaultThrow[2]); // expected-warning{{UNKNOWN}}
52 clang_analyzer_eval(new (1) ExplicitThrow[2]); // expected-warning{{UNKNOWN}}