I feel like I've seen it in old framework headers, but yeah, maybe we just don't care anymore / for now. I just see us getting a bug about it somewhere down the line...
On Mar 22, 2013, at 9:33 , Daniel Jasper <[email protected]> wrote: > The second case is handled (and we have tests for that). Is the first case > realistically used somewhere (where people would mind us removing the space)? > > > On Fri, Mar 22, 2013 at 5:16 PM, Jordan Rose <[email protected]> wrote: > These are valid Objective-C method declarations. > > - methodReturningID; > + methodWithArgument:first context:second; > > The types are assumed to be 'id', just like C90 return types are assumed to > be 'int'. > > Most people don't write code like this today, but it is legal. It makes sense > for clang-format to not handle these well in macros, though. > > > On Mar 22, 2013, at 3:44 , Daniel Jasper <[email protected]> wrote: > > > Author: djasper > > Date: Fri Mar 22 05:44:43 2013 > > New Revision: 177725 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=177725&view=rev > > Log: > > More precisely recognize ObjC method declarations. > > > > Otherwise, +/- and the beginning of constants can be recognized > > incorrectly. > > > > Before: #define A - 1 > > After: #define A -1 > > > > Modified: > > cfe/trunk/lib/Format/TokenAnnotator.cpp > > cfe/trunk/unittests/Format/FormatTest.cpp > > > > Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp > > URL: > > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=177725&r1=177724&r2=177725&view=diff > > ============================================================================== > > --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) > > +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Mar 22 05:44:43 2013 > > @@ -313,9 +313,11 @@ private: > > switch (Tok->FormatTok.Tok.getKind()) { > > case tok::plus: > > case tok::minus: > > - // At the start of the line, +/- specific ObjectiveC method > > - // declarations. > > - if (Tok->Parent == NULL) > > + // At the start of the line, +/- specify ObjectiveC method > > declarations. > > + if (Tok->Children.empty() || Tok->Children[0].Children.empty()) > > + break; // Can't be an ObjectiveC method declaration. > > + if (Tok->Parent == NULL && (Tok->Children[0].is(tok::l_paren) || > > + > > Tok->Children[0].Children[0].is(tok::colon))) > > Tok->Type = TT_ObjCMethodSpecifier; > > break; > > case tok::colon: > > > > Modified: cfe/trunk/unittests/Format/FormatTest.cpp > > URL: > > http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=177725&r1=177724&r2=177725&view=diff > > ============================================================================== > > --- cfe/trunk/unittests/Format/FormatTest.cpp (original) > > +++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Mar 22 05:44:43 2013 > > @@ -2067,6 +2067,8 @@ TEST_F(FormatTest, UnderstandsUnaryOpera > > "case -1:\n" > > " break;\n" > > "}"); > > + verifyFormat("#define X -1"); > > + verifyFormat("#define X -kConstant"); > > > > verifyFormat("const NSPoint kBrowserFrameViewPatternOffset = { -5, +3 > > };"); > > verifyFormat("const NSPoint kBrowserFrameViewPatternOffset = { +5, -3 > > };"); > > > > > > _______________________________________________ > > 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
