[cfe-commits] r171959 - in /cfe/trunk: lib/Format/Format.cpp test/Index/comment-c-decls.c test/Index/format-comment-cdecls.c unittests/Format/FormatTest.cpp

Daniel Jasper djasper at google.com
Wed Jan 9 10:13:18 PST 2013


I suspected as much .. But one step at a time ;-)..


On Wed, Jan 9, 2013 at 6:43 PM, Jordan Rose <jordan_rose at apple.com> wrote:

>
> On Jan 9, 2013, at 0:36 , Daniel Jasper <djasper at google.com> wrote:
>
> > Author: djasper
> > Date: Wed Jan  9 02:36:49 2013
> > New Revision: 171959
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=171959&view=rev
> > Log:
> > Fix ObjC block declarations.
> >
> > Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
> > After:  int (^Block1) (int, int) = ^(int i, int j)
> >
>
> Much better, but for the variable I think there's conventionally no space
> between the name and the parameters (like function pointers).
>
> int (^Block1)(int, int);
>
> (reference:
> https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks/Articles/bxDeclaringCreating.html
> )
>
>
> > Modified:
> >    cfe/trunk/lib/Format/Format.cpp
> >    cfe/trunk/test/Index/comment-c-decls.c
> >    cfe/trunk/test/Index/format-comment-cdecls.c
> >    cfe/trunk/unittests/Format/FormatTest.cpp
> >
> > Modified: cfe/trunk/lib/Format/Format.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=171959&r1=171958&r2=171959&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Format/Format.cpp (original)
> > +++ cfe/trunk/lib/Format/Format.cpp Wed Jan  9 02:36:49 2013
> > @@ -846,8 +846,9 @@
> >     if (Current.Type == TT_Unknown) {
> >       if (Current.is(tok::star) || Current.is(tok::amp)) {
> >         Current.Type = determineStarAmpUsage(Current, IsRHS);
> > -      } else if (Current.is(tok::minus) || Current.is(tok::plus)) {
> > -        Current.Type = determinePlusMinusUsage(Current);
> > +      } else if (Current.is(tok::minus) || Current.is(tok::plus) ||
> > +                 Current.is(tok::caret)) {
> > +        Current.Type = determinePlusMinusCaretUsage(Current);
> >       } else if (Current.is(tok::minusminus) ||
> Current.is(tok::plusplus)) {
> >         Current.Type = determineIncrementUsage(Current);
> >       } else if (Current.is(tok::exclaim)) {
> > @@ -905,7 +906,7 @@
> >     return TT_PointerOrReference;
> >   }
> >
> > -  TokenType determinePlusMinusUsage(const AnnotatedToken &Tok) {
> > +  TokenType determinePlusMinusCaretUsage(const AnnotatedToken &Tok) {
> >     // At the start of the line, +/- specific ObjectiveC method
> declarations.
> >     if (Tok.Parent == NULL)
> >       return TT_ObjCMethodSpecifier;
> >
> > Modified: cfe/trunk/test/Index/comment-c-decls.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-c-decls.c?rev=171959&r1=171958&r2=171959&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/Index/comment-c-decls.c (original)
> > +++ cfe/trunk/test/Index/comment-c-decls.c Wed Jan  9 02:36:49 2013
> > @@ -95,10 +95,10 @@
> >  *\brief block declaration
> > */
> > int (^Block) (int i, int j);
> > -// CHECK: <Declaration>int ( ^ Block) (int, int)</Declaration>
> > +// CHECK: <Declaration>int (^Block) (int, int)</Declaration>
> >
> > /**
> >  *\brief block declaration
> > */
> > int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; };
> > -// CHECK: <Declaration>int ( ^ Block1) (int, int) = ^ (int i, int j)
> {\n}</Declaration>
> > +// CHECK: <Declaration>int (^Block1) (int, int) = ^(int i, int j)
> {\n}</Declaration>
> >
> > Modified: cfe/trunk/test/Index/format-comment-cdecls.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/format-comment-cdecls.c?rev=171959&r1=171958&r2=171959&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/Index/format-comment-cdecls.c (original)
> > +++ cfe/trunk/test/Index/format-comment-cdecls.c Wed Jan  9 02:36:49 2013
> > @@ -90,10 +90,10 @@
> >  *\brief block declaration
> > */
> > int (^Block) (int i, int j);
> > -// CHECK: <Declaration>int ( ^ Block) (int, int)</Declaration>
> > +// CHECK: <Declaration>int (^Block) (int, int)</Declaration>
> >
> > /**
> >  *\brief block declaration
> > */
> > int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; };
> > -// CHECK: <Declaration>int ( ^ Block1) (int, int) = ^ (int i, int j)
> {\n}</Declaration>
> > +// CHECK: <Declaration>int (^Block1) (int, int) = ^(int i, int j)
> {\n}</Declaration>
> >
> > Modified: cfe/trunk/unittests/Format/FormatTest.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171959&r1=171958&r2=171959&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
> > +++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jan  9 02:36:49 2013
> > @@ -1122,6 +1122,11 @@
> >           "outRange8:(NSRange) out_range8  outRange9:(NSRange)
> out_range9;"));
> > }
> >
> > +TEST_F(FormatTest, FormatObjCBlocks) {
> > +  verifyFormat("int (^Block) (int, int);");
> > +  verifyFormat("int (^Block1) (int, int) = ^(int i, int j)");
> > +}
> > +
> > TEST_F(FormatTest, ObjCAt) {
> >   verifyFormat("@autoreleasepool");
> >   verifyFormat("@catch");
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/551e470c/attachment.html>


More information about the cfe-commits mailing list