Raphael Isemann | 89ef7d9 | 2017-09-04 05:56:36 +0000 | [diff] [blame] | 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 |
Leslie Zhai | 52b6305 | 2017-06-19 01:55:50 +0000 | [diff] [blame] | 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 | } |