Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / copypaste / delete.cpp
blob4edb46035a39d305abf04711ca62cd49ef1bd451
1 // RUN: %clang_analyze_cc1 -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s
3 // expected-no-diagnostics
5 bool foo1(int x, int* a) {
6 if (x > 0)
7 return false;
8 else if (x < 0)
9 delete a;
10 return true;
13 // Explicit global delete
14 bool foo2(int x, int* a) {
15 if (x > 0)
16 return false;
17 else if (x < 0)
18 ::delete a;
19 return true;
22 // Array delete
23 bool foo3(int x, int* a) {
24 if (x > 0)
25 return false;
26 else if (x < 0)
27 delete[] a;
28 return true;