On Fri, Aug 30, 2013 at 3:27 AM, Daniel Jasper <[email protected]> wrote:
> Author: djasper > Date: Fri Aug 30 02:27:13 2013 > New Revision: 189657 > > URL: http://llvm.org/viewvc/llvm-project?rev=189657&view=rev > Log: > clang-format: Don't indent builders relative to "return". > > While this looks kind of nice, it wastes horizontal space and does not > seem to be common in the LLVM codebase. > > Before: > return llvm::StringSwitch<Reference::Kind>(name) > .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR) > .StartsWith(".eh_frame", ORDER_EH_FRAME) > .StartsWith(".init", ORDER_INIT) > .StartsWith(".fini", ORDER_FINI) > .StartsWith(".hash", ORDER_HASH) > .Default(ORDER_TEXT); > > After: > return llvm::StringSwitch<Reference::Kind>(name) > .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR) > .StartsWith(".eh_frame", ORDER_EH_FRAME) > .StartsWith(".init", ORDER_INIT) > .StartsWith(".fini", ORDER_FINI) > .StartsWith(".hash", ORDER_HASH) > .Default(ORDER_TEXT); > This Before/After is backwards, right? It seems opposite of what changed in the test. -- Sean Silva > > Modified: > cfe/trunk/lib/Format/ContinuationIndenter.cpp > cfe/trunk/unittests/Format/FormatTest.cpp > > Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=189657&r1=189656&r2=189657&view=diff > > ============================================================================== > --- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original) > +++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Fri Aug 30 02:27:13 2013 > @@ -460,7 +460,7 @@ unsigned ContinuationIndenter::moveState > } > > // If return returns a binary expression, align after it. > - if (Current.is(tok::kw_return) && !Current.FakeLParens.empty()) > + if (Current.is(tok::kw_return) && startsBinaryExpression(Current)) > State.Stack.back().LastSpace = State.Column + 7; > > // In ObjC method declaration we align on the ":" of parameters, but we > need > > Modified: cfe/trunk/unittests/Format/FormatTest.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=189657&r1=189656&r2=189657&view=diff > > ============================================================================== > --- cfe/trunk/unittests/Format/FormatTest.cpp (original) > +++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Aug 30 02:27:13 2013 > @@ -2841,12 +2841,12 @@ TEST_F(FormatTest, AdaptiveOnePerLineFor > TEST_F(FormatTest, FormatsBuilderPattern) { > verifyFormat( > "return llvm::StringSwitch<Reference::Kind>(name)\n" > - " .StartsWith(\".eh_frame_hdr\", ORDER_EH_FRAMEHDR)\n" > - " .StartsWith(\".eh_frame\", ORDER_EH_FRAME)\n" > - " .StartsWith(\".init\", ORDER_INIT)\n" > - " .StartsWith(\".fini\", ORDER_FINI)\n" > - " .StartsWith(\".hash\", ORDER_HASH)\n" > - " .Default(ORDER_TEXT);\n"); > + " .StartsWith(\".eh_frame_hdr\", ORDER_EH_FRAMEHDR)\n" > + " .StartsWith(\".eh_frame\", ORDER_EH_FRAME)\n" > + " .StartsWith(\".init\", ORDER_INIT)\n" > + " .StartsWith(\".fini\", ORDER_FINI)\n" > + " .StartsWith(\".hash\", ORDER_HASH)\n" > + " .Default(ORDER_TEXT);\n"); > > verifyFormat("return > aaaaaaaaaaaaaaaaa->aaaaa().aaaaaaaaaaaaa().aaaaaa() <\n" > " > aaaaaaaaaaaaaaa->aaaaa().aaaaaaaaaaaaa().aaaaaa();"); > > > _______________________________________________ > 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
