40 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 %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 -verify %s3// 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 -DTEST_INLINABLE_ALLOCATORS -verify %s4// 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 -DTEST_INLINABLE_ALLOCATORS -verify %s5 6// expected-no-diagnostics7 8#include "../Inputs/system-header-simulator-cxx-std-suppression.h"9 10void testList_pop_front(std::list<int> list) {11 while(!list.empty())12 list.pop_front(); // no-warning13}14 15void testBasicStringSuppression() {16 std::basic_string<uint8_t> v;17 v.push_back(1); // no-warning18}19 20void testBasicStringSuppression_append() {21 std::basic_string<char32_t> v;22 v += 'c'; // no-warning23}24 25void testBasicStringSuppression_assign(std::basic_string<char32_t> &v,26 const std::basic_string<char32_t> &v2) {27 v = v2; // no-warning28}29 30class MyEngine;31void testSuppression_independent_bits_engine(MyEngine& e) {32 std::__independent_bits_engine<MyEngine, unsigned int> x(e, 64); // no-warning33}34 35void testSuppression_std_shared_pointer() {36 std::shared_ptr<int> p(new int(1));37 38 p = nullptr; // no-warning39}40