aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/copypaste/dependent-exist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/copypaste/dependent-exist.cpp')
-rw-r--r--test/Analysis/copypaste/dependent-exist.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Analysis/copypaste/dependent-exist.cpp b/test/Analysis/copypaste/dependent-exist.cpp
new file mode 100644
index 000000000000..5182ba61c9dc
--- /dev/null
+++ b/test/Analysis/copypaste/dependent-exist.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -analyze -fms-extensions -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -verify %s
+
+// expected-no-diagnostics
+
+bool foo1(int x) {
+ if (x < 0) {
+ __if_exists(x) { return false; }
+ }
+ return true;
+}
+
+// Same as above, but __if_not_exists
+bool foo2(int x) {
+ if (x < 0) {
+ __if_not_exists(x) { return false; }
+ }
+ return true;
+}