Two comments: (1) I think this is a typo: + DefineBuiltinMacro(Buf, "__block=__attribute__((__ > > blocks__(byref)))");
(2) Should we really be defining the attributes to nothing when block support is not enabled? This may break working code which uses those names. - Daniel On Tue, Sep 2, 2008 at 8:20 AM, Steve Naroff <[EMAIL PROTECTED]> wrote: > Author: snaroff > Date: Tue Sep 2 10:20:19 2008 > New Revision: 55635 > > URL: http://llvm.org/viewvc/llvm-project?rev=55635&view=rev > Log: > Implement block pseudo-storage class modifiers (__block, __byref). > > Added: > cfe/trunk/test/Parser/block-block-storageclass.c > Modified: > cfe/trunk/lib/Lex/Preprocessor.cpp > > Modified: cfe/trunk/lib/Lex/Preprocessor.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=55635&r1=55634&r2=55635&view=diff > > > ============================================================================== > --- cfe/trunk/lib/Lex/Preprocessor.cpp (original) > +++ cfe/trunk/lib/Lex/Preprocessor.cpp Tue Sep 2 10:20:19 2008 > @@ -476,6 +476,13 @@ > DefineBuiltinMacro(Buf, "__int64=long long"); > DefineBuiltinMacro(Buf, "__declspec(X)="); > } > + if (PP.getLangOptions().Blocks) { > + DefineBuiltinMacro(Buf, "__byref=__attribute__((__blocks__(byref)))"); > + DefineBuiltinMacro(Buf, "__block=__attribute__((__blocks__(byref)))"); > + } else { > + DefineBuiltinMacro(Buf, "__byref="); > + DefineBuiltinMacro(Buf, "__block="); > + } > // FIXME: Should emit a #line directive here. > } > > > Added: cfe/trunk/test/Parser/block-block-storageclass.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/block-block-storageclass.c?rev=55635&view=auto > > > ============================================================================== > --- cfe/trunk/test/Parser/block-block-storageclass.c (added) > +++ cfe/trunk/test/Parser/block-block-storageclass.c Tue Sep 2 10:20:19 > 2008 > @@ -0,0 +1,18 @@ > +// RUN: clang -fsyntax-only -verify -parse-noop %s > + > +#include <stdio.h> > +void _Block_byref_release(void*src){} > + > +int main() { > + __block int X = 1234; > + __block const char * message = "HELLO"; > + > + X = X - 1234; > + > + X += 1; > + > + printf ("%s(%d)\n", message, X); > + X -= 1; > + > + return X; > +} > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
