summaryrefslogtreecommitdiff
path: root/test/Analysis/copypaste/ui_autogenerated.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-26 20:33:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-26 20:33:12 +0000
commitef915aab0ac566c55bfb0d7a9f6635bb5d94d4af (patch)
treeac935cfa19985d33098fc13e288b5ac830672dba /test/Analysis/copypaste/ui_autogenerated.cpp
parent325377b57338e700317f5e423e5b0f1c08d99a39 (diff)
Notes
Diffstat (limited to 'test/Analysis/copypaste/ui_autogenerated.cpp')
-rw-r--r--test/Analysis/copypaste/ui_autogenerated.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Analysis/copypaste/ui_autogenerated.cpp b/test/Analysis/copypaste/ui_autogenerated.cpp
new file mode 100644
index 0000000000000..a08c33fe9e2a0
--- /dev/null
+++ b/test/Analysis/copypaste/ui_autogenerated.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -analyzer-config alpha.clone.CloneChecker:IgnoredFilesPattern="moc_|ui_|.*_automoc" -verify %s
+
+// Because files that have `ui_' 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;
+ }
+}