[cfe-commits] r131014 - in /cfe/trunk: include/clang/Basic/TokenKinds.def include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/Parse/ParseStmt.cpp lib/Sema/SemaExprCXX.cpp test/Parser/MicrosoftExtensions.cpp

Francois Pichet pichet2000 at gmail.com
Fri May 6 14:09:05 PDT 2011


> Mo

On Fri, May 6, 2011 at 4:48 PM, Francois Pichet <pichet2000 at gmail.com> wrote:
> Author: fpichet
> Date: Fri May  6 15:48:22 2011
> New Revision: 131014
>
> URL: http://llvm.org/viewvc/llvm-project?rev=131014&view=rev
> Log:
> 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.

I am already expecting this comment so i'll answer:
__if_exists doesn't introduce a new scope for the { }

Example, given:
code1;
__if_exists(SYMBOL) {
code2;
}
code3;

if SYMBOL exists, this is equivalent to
code1;
code2;
code3

if SYMBOL doesn't exist then:
code1;
code3;



More information about the cfe-commits mailing list