brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 6678b5d Raw
29 lines · cpp
1// 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 -analyzer-config eagerly-assume=false %s2// 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 -analyzer-config eagerly-assume=false %s3 4#include "../Inputs/system-header-simulator-cxx.h"5 6void clang_analyzer_eval(bool);7 8void testVector(std::vector<int> &nums) {9  if (nums.begin() != nums.end()) return;10  11  clang_analyzer_eval(nums.size() == 0);12#if INLINE13  // expected-warning@-2 {{TRUE}}14#else15  // expected-warning@-4 {{UNKNOWN}}16#endif17}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 INLINE24  // expected-warning@-2 {{TRUE}}25#else26  // expected-warning@-4 {{UNKNOWN}}27#endif28}29