brintos

brintos / llvm-project-archived public Read only

0
0
Text · 558 B · 4edb460 Raw
30 lines · cpp
1// RUN: %clang_analyze_cc1 -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -verify %s2 3// expected-no-diagnostics4 5bool foo1(int x, int* a) {6  if (x > 0)7    return false;8  else if (x < 0)9    delete a;10  return true;11}12 13// Explicit global delete14bool foo2(int x, int* a) {15  if (x > 0)16    return false;17  else if (x < 0)18    ::delete a;19  return true;20}21 22// Array delete23bool foo3(int x, int* a) {24  if (x > 0)25    return false;26  else if (x < 0)27    delete[] a;28  return true;29}30