blob: b672be2ba245feb8c3c056e936d878fe125650f6 [file] [log] [blame]
Dominic Chen184c6242017-03-03 18:02:02 +00001// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete,debug.ExprInspection -analyzer-config c++-container-inlining=true -analyzer-config c++-stdlib-inlining=false -std=c++11 -verify %s
2// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete,debug.ExprInspection -analyzer-config c++-container-inlining=true -analyzer-config c++-stdlib-inlining=true -std=c++11 -DINLINE=1 -verify %s
Jordan Rose1e0e4002012-09-10 21:27:35 +00003
Chandler Carruth66a34a62012-09-12 01:11:10 +00004#include "../Inputs/system-header-simulator-cxx.h"
Jordan Rose1e0e4002012-09-10 21:27:35 +00005
6void clang_analyzer_eval(bool);
7
8void testVector(std::vector<int> &nums) {
Gabor Horvath3d574572017-01-09 09:52:32 +00009 if (nums.begin() != nums.end()) return;
Jordan Rose1e0e4002012-09-10 21:27:35 +000010
11 clang_analyzer_eval(nums.size() == 0);
12#if INLINE
13 // expected-warning@-2 {{TRUE}}
14#else
15 // expected-warning@-4 {{UNKNOWN}}
16#endif
17}
18
19void testException(std::exception e) {
20 // Notice that the argument is NOT passed by reference, so we can devirtualize.
21 const char *x = e.what();
22 clang_analyzer_eval(x == 0);
23#if INLINE
24 // expected-warning@-2 {{TRUE}}
25#else
26 // expected-warning@-4 {{UNKNOWN}}
27#endif
28}