r211649 - Split tests for __if_exists out into their own file

Reid Kleckner reid at kleckner.net
Tue Jun 24 17:08:11 PDT 2014


Author: rnk
Date: Tue Jun 24 19:08:10 2014
New Revision: 211649

URL: http://llvm.org/viewvc/llvm-project?rev=211649&view=rev
Log:
Split tests for __if_exists out into their own file

Added:
    cfe/trunk/test/Parser/ms-if-exists.cpp
Modified:
    cfe/trunk/test/Parser/MicrosoftExtensions.cpp

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=211649&r1=211648&r2=211649&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Tue Jun 24 19:08:10 2014
@@ -227,103 +227,6 @@ void interface_test() {
 
 __int64 x7 = __int64(0);
 
-
-namespace If_exists_test {
-
-class IF_EXISTS {
-private:
-    typedef int Type;
-};
-
-int __if_exists_test() {
-  int b=0;
-  __if_exists(IF_EXISTS::Type) {
-     b++;
-     b++;
-  }
-  __if_exists(IF_EXISTS::Type_not) {
-     this will not compile.
-  }
-  __if_not_exists(IF_EXISTS::Type) {
-     this will not compile.
-  }
-  __if_not_exists(IF_EXISTS::Type_not) {
-     b++;
-     b++;
-  }
-}
-
-
-__if_exists(IF_EXISTS::Type) {
-  int var23;
-}
-
-__if_exists(IF_EXISTS::Type_not) {
- this will not compile.
-}
-
-__if_not_exists(IF_EXISTS::Type) {
- this will not compile.
-}
-
-__if_not_exists(IF_EXISTS::Type_not) {
-  int var244;
-}
-
-int __if_exists_init_list() {
-
-  int array1[] = {
-    0,
-    __if_exists(IF_EXISTS::Type) {2, }
-    3
-  };
-
-  int array2[] = {
-    0,
-    __if_exists(IF_EXISTS::Type_not) { this will not compile }
-    3
-  };
-
-  int array3[] = {
-    0,
-    __if_not_exists(IF_EXISTS::Type_not) {2, }
-    3
-  };
-
-  int array4[] = {
-    0,
-    __if_not_exists(IF_EXISTS::Type) { this will not compile }
-    3
-  };
-
-}
-
-
-class IF_EXISTS_CLASS_TEST {
-  __if_exists(IF_EXISTS::Type) {
-    // __if_exists, __if_not_exists can nest
-    __if_not_exists(IF_EXISTS::Type_not) {
-      int var123;
-    }
-    int var23;
-  }
-
-  __if_exists(IF_EXISTS::Type_not) {
-   this will not compile.
-  }
-
-  __if_not_exists(IF_EXISTS::Type) {
-   this will not compile.
-  }
-
-  __if_not_exists(IF_EXISTS::Type_not) {
-    int var244;
-  }
-};
-
-}
-
-
 int __identifier(generic) = 3;
 int __identifier(int) = 4;
 struct __identifier(class) { __identifier(class) *__identifier(for); };

Added: cfe/trunk/test/Parser/ms-if-exists.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/ms-if-exists.cpp?rev=211649&view=auto
==============================================================================
--- cfe/trunk/test/Parser/ms-if-exists.cpp (added)
+++ cfe/trunk/test/Parser/ms-if-exists.cpp Tue Jun 24 19:08:10 2014
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wmicrosoft -verify -fms-extensions
+
+// expected-no-diagnostics
+
+class MayExist {
+private:
+  typedef int Type;
+};
+
+void test_if_exists_stmts() {
+  int b = 0;
+  __if_exists(MayExist::Type) {
+    b++;
+    b++;
+  }
+  __if_exists(MayExist::Type_not) {
+    this will not compile.
+  }
+  __if_not_exists(MayExist::Type) {
+    this will not compile.
+  }
+  __if_not_exists(MayExist::Type_not) {
+    b++;
+    b++;
+  }
+}
+
+__if_exists(MayExist::Type) {
+  int var23;
+}
+
+__if_exists(MayExist::Type_not) {
+  this will not compile.
+}
+
+__if_not_exists(MayExist::Type) {
+  this will not compile.
+}
+
+__if_not_exists(MayExist::Type_not) {
+  int var244;
+}
+
+void test_if_exists_init_list() {
+
+  int array1[] = {
+    0,
+    __if_exists(MayExist::Type) {2, }
+    3
+  };
+
+  int array2[] = {
+    0,
+    __if_exists(MayExist::Type_not) { this will not compile }
+    3
+  };
+
+  int array3[] = {
+    0,
+    __if_not_exists(MayExist::Type_not) {2, }
+    3
+  };
+
+  int array4[] = {
+    0,
+    __if_not_exists(MayExist::Type) { this will not compile }
+    3
+  };
+
+}
+
+
+class IfExistsClassScope {
+  __if_exists(MayExist::Type) {
+    // __if_exists, __if_not_exists can nest
+    __if_not_exists(MayExist::Type_not) {
+      int var123;
+    }
+    int var23;
+  }
+
+  __if_exists(MayExist::Type_not) {
+   this will not compile.
+  }
+
+  __if_not_exists(MayExist::Type) {
+   this will not compile.
+  }
+
+  __if_not_exists(MayExist::Type_not) {
+    int var244;
+  }
+};





More information about the cfe-commits mailing list