aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/copypaste/dependent-exist.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:08 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:08 +0000
commitbab175ec4b075c8076ba14c762900392533f6ee4 (patch)
tree01f4f29419a2cb10abe13c1e63cd2a66068b0137 /test/Analysis/copypaste/dependent-exist.cpp
parent8b7a8012d223fac5d17d16a66bb39168a9a1dfc0 (diff)
Notes
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;
+}