summaryrefslogtreecommitdiff
path: root/test/Parser/MicrosoftExtensions.cpp
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2011-12-12 23:24:39 +0000
committerFrancois Pichet <pichet2000@gmail.com>2011-12-12 23:24:39 +0000
commit9d24a8be93b28488dbfb9bbe8aa6fe35b21a5b0c (patch)
tree2b4a322ce4bea3d1ee2c6505ac2a7c48b2c2bd83 /test/Parser/MicrosoftExtensions.cpp
parent2e1732299461634b9791ddfe6e3770c6be3a3675 (diff)
downloadclang-9d24a8be93b28488dbfb9bbe8aa6fe35b21a5b0c.tar.gz
Implement the Microsoft __if_exists/if_not_exists extension in initializer-list.
Necessary to parse Microsoft ATL code. Example: int array[] = { 0, __if_exists(CLASS::Type) {2, } 3 }; will declare an array of 2 or 3 elements depending on if CLASS::Type exists or not. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/MicrosoftExtensions.cpp')
-rw-r--r--test/Parser/MicrosoftExtensions.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index 0c5459cba2..89394c303c 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -215,6 +215,35 @@ __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 wont compile }
+ 3
+ };
+
+ int array3[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type_not) {2, }
+ 3
+ };
+
+ int array4[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type) { this wont compile }
+ 3
+ };
+
+}
+
+
class IF_EXISTS_CLASS_TEST {
__if_exists(IF_EXISTS::Type) {
// __if_exists, __if_not_exists can nest