summaryrefslogtreecommitdiffstats
path: root/test/Analysis/copypaste/autogenerated_automoc.cpp
blob: 0f7f9c9e456576e8754a13883481f9ae3bfee1d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:MinimumCloneComplexity=10 -analyzer-config alpha.clone.CloneChecker:IgnoredFilesPattern="moc_|.*_automoc.cpp" -verify %s

// Because files that have `_automoc.' in their names are most likely autogenerated,
// we suppress copy-paste warnings here.

// expected-no-diagnostics

void f1() {
  int *p1 = new int[1];
  int *p2 = new int[1];
  if (p1) {
    delete [] p1;
    p1 = nullptr;
  }
  if (p2) {
    delete [] p1; // no-warning
    p2 = nullptr;
  }
}