Leslie Zhai | d91d19e | 2017-06-19 01:55:50 +0000 | [diff] [blame] | 1 | // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:IgnoredFilesPattern="moc_|.*_automoc" -verify %s |
| 2 | |
| 3 | // Because files that have `moc_' in their names are most likely autogenerated, |
| 4 | // we suppress copy-paste warnings here. |
| 5 | |
| 6 | // expected-no-diagnostics |
| 7 | |
| 8 | void 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 | } |