diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-05-06 20:48:22 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-05-06 20:48:22 +0000 |
commit | 4a7de3eb2cbd7b55fabe440d255ab1f0242cdde6 (patch) | |
tree | c470fabb65471f59bda2ecaaebd974b13bdffb5b /clang/test/Parser/MicrosoftExtensions.cpp | |
parent | 4a8ea1092abe14eb8e837e2a080b74c958213cd4 (diff) | |
download | bcm5719-llvm-4a7de3eb2cbd7b55fabe440d255ab1f0242cdde6.tar.gz bcm5719-llvm-4a7de3eb2cbd7b55fabe440d255ab1f0242cdde6.zip |
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.
llvm-svn: 131014
Diffstat (limited to 'clang/test/Parser/MicrosoftExtensions.cpp')
-rw-r--r-- | clang/test/Parser/MicrosoftExtensions.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp index 32ed375889a..933231d5f70 100644 --- a/clang/test/Parser/MicrosoftExtensions.cpp +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -164,3 +164,36 @@ __interface MicrosoftInterface { }; __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++; + } + +} |