summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/copypaste/functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/copypaste/functions.cpp')
-rw-r--r--clang/test/Analysis/copypaste/functions.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Analysis/copypaste/functions.cpp b/clang/test/Analysis/copypaste/functions.cpp
index 29f389a5eac..bedd374b79d 100644
--- a/clang/test/Analysis/copypaste/functions.cpp
+++ b/clang/test/Analysis/copypaste/functions.cpp
@@ -20,6 +20,31 @@ int maxClone(int x, int y) { // expected-note{{Related code clone is here.}}
// Functions below are not clones and should not be reported.
+// The next two functions test that statement classes are still respected when
+// checking for clones in expressions. This will show that the statement
+// specific data of all base classes is collected, and not just the data of the
+// first base class.
+int testBaseClass(int a, int b) { // no-warning
+ log();
+ if (a > b)
+ return true ? a : b;
+ return b;
+}
+int testBaseClass2(int a, int b) { // no-warning
+ log();
+ if (a > b)
+ return __builtin_choose_expr(true, a, b);
+ return b;
+}
+
+
+int min1(int a, int b) { // no-warning
+ log();
+ if (a < b)
+ return a;
+ return b;
+}
+
int foo(int a, int b) { // no-warning
return a + b;
}
OpenPOWER on IntegriCloud