summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/copypaste
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/copypaste')
-rw-r--r--clang/test/Analysis/copypaste/false-positives.cpp21
-rw-r--r--clang/test/Analysis/copypaste/functions.cpp10
2 files changed, 9 insertions, 22 deletions
diff --git a/clang/test/Analysis/copypaste/false-positives.cpp b/clang/test/Analysis/copypaste/false-positives.cpp
deleted file mode 100644
index 4c6275949da..00000000000
--- a/clang/test/Analysis/copypaste/false-positives.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// RUN: %clang_cc1 -analyze -std=c++11 -analyzer-checker=alpha.clone.CloneChecker -verify %s
-
-// This test contains false-positive reports from the CloneChecker that need to
-// be fixed.
-
-void log();
-
-int max(int a, int b) { // expected-warning{{Detected code clone.}}
- log();
- if (a > b)
- return a;
- return b;
-}
-
-// FIXME: Detect different variable patterns.
-int min2(int a, int b) { // expected-note{{Related code clone is here.}}
- log();
- if (b > a)
- return a;
- return b;
-}
diff --git a/clang/test/Analysis/copypaste/functions.cpp b/clang/test/Analysis/copypaste/functions.cpp
index bedd374b79d..2a871f74b03 100644
--- a/clang/test/Analysis/copypaste/functions.cpp
+++ b/clang/test/Analysis/copypaste/functions.cpp
@@ -37,7 +37,7 @@ int testBaseClass2(int a, int b) { // no-warning
return b;
}
-
+// No clone because of the different comparison operator.
int min1(int a, int b) { // no-warning
log();
if (a < b)
@@ -45,6 +45,14 @@ int min1(int a, int b) { // no-warning
return b;
}
+// No clone because of the different pattern in which the variables are used.
+int min2(int a, int b) { // no-warning
+ log();
+ if (a > b)
+ return b;
+ return a;
+}
+
int foo(int a, int b) { // no-warning
return a + b;
}
OpenPOWER on IntegriCloud