summaryrefslogtreecommitdiff
path: root/test/Analysis/copypaste/not-autogenerated.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/copypaste/not-autogenerated.cpp')
-rw-r--r--test/Analysis/copypaste/not-autogenerated.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Analysis/copypaste/not-autogenerated.cpp b/test/Analysis/copypaste/not-autogenerated.cpp
new file mode 100644
index 000000000000..765e7aaf2aab
--- /dev/null
+++ b/test/Analysis/copypaste/not-autogenerated.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:IgnoredFilesPattern="moc_|ui_|dbus_|.*_automoc" -verify %s
+
+void f1() {
+ int *p1 = new int[1];
+ int *p2 = new int[1];
+ if (p1) {
+ delete [] p1; // expected-note{{Similar code using 'p1' here}}
+ p1 = nullptr;
+ }
+ if (p2) {
+ delete [] p1; // expected-warning{{Potential copy-paste error; did you really mean to use 'p1' here?}}
+ p2 = nullptr;
+ }
+}