Clang Project

clang_source_code/test/Analysis/copypaste/ui_autogenerated.cpp
1// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:IgnoredFilesPattern="moc_|ui_|.*_automoc" -verify %s
2
3// Because files that have `ui_' in their names are most likely autogenerated,
4// we suppress copy-paste warnings here.
5
6// expected-no-diagnostics
7
8void f1() {
9  int *p1 = new int[1];
10  int *p2 = new int[1];
11  if (p1) {
12    delete [] p1;
13    p1 = nullptr;
14  }
15  if (p2) {
16    delete [] p1; // no-warning
17    p2 = nullptr;
18  }
19}
20