Add support for Microsoft __if_exists and __if_not_exists construct inside function definition.
Allow to include or exclude code depending on if a symbol exists or not. Just like a #ifdef but for C/C++ symbols.
More doc: http://msdn.microsoft.com/en-us/library/x7wy9xh3(v=VS.100).aspx
Support at class and namespace scopes will be added later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index 32ed375..933231d 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -164,3 +164,36 @@
};
__int64 x7 = __int64(0);
+
+
+
+
+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 wont compile.
+ }
+
+ __if_not_exists(IF_EXISTS::Type) {
+ this wont compile.
+ }
+
+ __if_not_exists(IF_EXISTS::Type_not) {
+ b++;
+ b++;
+ }
+
+}