1 | // 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_|ui_|dbus_|.*_automoc" -verify %s |
2 | |
3 | void f1() { |
4 | int *p1 = new int[1]; |
5 | int *p2 = new int[1]; |
6 | if (p1) { |
7 | delete [] p1; // expected-note{{Similar code using 'p1' here}} |
8 | p1 = nullptr; |
9 | } |
10 | if (p2) { |
11 | delete [] p1; // expected-warning{{Potential copy-paste error; did you really mean to use 'p1' here?}} |
12 | p2 = nullptr; |
13 | } |
14 | } |
15 | |