Not sure where you are getting your data from, but e.g. ASTContext.h alone has 4 such cases.
On Tue, May 21, 2013 at 9:05 PM, Richard Smith <[email protected]>wrote: > More data: > > /^ *const;/ has 12 matches in llvm/lib and 0 in clang/lib > /^ *[^(,]*) const;/ has 769 matches in llvm/lib and 221 matches in > clang/lib > > /^ *const {/ has 108 matches in llvm/lib + 2 in include/llvm, 6 matches in > clang/lib + 1 in include/clang > /^ *[^(,]*) const {/ has 1371 matches in llvm/lib + 208 in include/llvm, > 743 matches in clang/lib + 73 in include/clang > > > On Tue, May 21, 2013 at 12:01 PM, Richard Smith <[email protected]>wrote: > >> We should probably turn this off for LLVM style: >> >> /^ *const;/ has only 1 match in include/llvm and 5 matches in >> include/clang. >> /^ *[^(,]*) const;/ has 251 matches in include/llvm and 191 matches in >> include/clang. >> >> >> On Tue, May 21, 2013 at 2:16 AM, Daniel Jasper <[email protected]>wrote: >> >>> Author: djasper >>> Date: Tue May 21 04:16:31 2013 >>> New Revision: 182362 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=182362&view=rev >>> Log: >>> Allow breaking before a trailing const. >>> >>> Before: >>> void someLongFunction( >>> int someLongParameter) const; >>> >>> After: >>> void someLongFunction(int someLongParameter) >>> const; >>> >>> Also slightly cleanup tests. >>> >>> 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=182362&r1=182361&r2=182362&view=diff >>> >>> ============================================================================== >>> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) >>> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue May 21 04:16:31 2013 >>> @@ -1187,7 +1187,7 @@ bool TokenAnnotator::canBreakBefore(cons >>> tok::kw_class, tok::kw_struct) || >>> Right.isOneOf(tok::lessless, tok::arrow, tok::period, >>> tok::colon) || >>> (Left.is(tok::r_paren) && Left.Type != TT_CastRParen && >>> - Right.isOneOf(tok::identifier, tok::kw___attribute)) || >>> + Right.isOneOf(tok::identifier, tok::kw_const, >>> tok::kw___attribute)) || >>> (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || >>> (Left.is(tok::l_square) && !Right.is(tok::r_square)); >>> } >>> >>> Modified: cfe/trunk/unittests/Format/FormatTest.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=182362&r1=182361&r2=182362&view=diff >>> >>> ============================================================================== >>> --- cfe/trunk/unittests/Format/FormatTest.cpp (original) >>> +++ cfe/trunk/unittests/Format/FormatTest.cpp Tue May 21 04:16:31 2013 >>> @@ -1628,12 +1628,6 @@ TEST_F(FormatTest, PutEmptyBlocksIntoOne >>> // Line break tests. >>> >>> >>> //===----------------------------------------------------------------------===// >>> >>> -TEST_F(FormatTest, FormatsFunctionDefinition) { >>> - verifyFormat("void f(int a, int b, int c, int d, int e, int f, int g," >>> - " int h, int j, int f,\n" >>> - " int c, int ddddddddddddd) {}"); >>> -} >>> - >>> TEST_F(FormatTest, FormatsAwesomeMethodCall) { >>> verifyFormat( >>> >>> "SomeLongMethodName(SomeReallyLongMethod(CallOtherReallyLongMethod(\n" >>> @@ -1914,6 +1908,30 @@ TEST_F(FormatTest, BreaksFunctionDeclara >>> " bbbb bbbb);"); >>> } >>> >>> +TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) { >>> + verifyFormat("void someLongFunction(int someLongParameter)\n" >>> + " const;", >>> + getLLVMStyleWithColumns(45)); >>> + >>> + verifyFormat("void aaaaaaaaaaaa(int >>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n" >>> + " LOCKS_EXCLUDED(aaaaaaaaaaaaa);"); >>> + verifyFormat("void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) >>> const\n" >>> + " LOCKS_EXCLUDED(aaaaaaaaaaaaa);"); >>> + verifyFormat("void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) >>> const\n" >>> + " LOCKS_EXCLUDED(aaaaaaaaaaaaa) {}"); >>> + >>> + verifyFormat( >>> + "void aaaaaaaaaaaaaaaaaa()\n" >>> + " __attribute__((aaaaaaaaaaaaaaaaaaaaaaaaa, >>> aaaaaaaaaaaaaaaaaaaaaaa,\n" >>> + " aaaaaaaaaaaaaaaaaaaaaaaaa));"); >>> + verifyFormat("bool >>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" >>> + " __attribute__((unused));"); >>> + verifyFormat( >>> + "bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" >>> + " GUARDED_BY(aaaaaaaaaaaa);"); >>> +} >>> + >>> + >>> TEST_F(FormatTest, BreaksDesireably) { >>> verifyFormat("if (aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa) ||\n" >>> " aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa) ||\n" >>> @@ -2051,24 +2069,6 @@ TEST_F(FormatTest, FormatsBuilderPattern >>> " ->aaaaaaaaaaaaaaaaa();"); >>> } >>> >>> -TEST_F(FormatTest, DoesNotBreakTrailingAnnotation) { >>> - verifyFormat("void aaaaaaaaaaaa(int >>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n" >>> - " LOCKS_EXCLUDED(aaaaaaaaaaaaa);"); >>> - verifyFormat("void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) >>> const\n" >>> - " LOCKS_EXCLUDED(aaaaaaaaaaaaa);"); >>> - verifyFormat("void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) >>> const\n" >>> - " LOCKS_EXCLUDED(aaaaaaaaaaaaa) {}"); >>> - verifyFormat( >>> - "void aaaaaaaaaaaaaaaaaa()\n" >>> - " __attribute__((aaaaaaaaaaaaaaaaaaaaaaaaa, >>> aaaaaaaaaaaaaaaaaaaaaaa,\n" >>> - " aaaaaaaaaaaaaaaaaaaaaaaaa));"); >>> - verifyFormat("bool >>> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" >>> - " __attribute__((unused));"); >>> - verifyFormat( >>> - "bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" >>> - " GUARDED_BY(aaaaaaaaaaaa);"); >>> -} >>> - >>> TEST_F(FormatTest, BreaksAccordingToOperatorPrecedence) { >>> verifyFormat( >>> "if (aaaaaaaaaaaaaaaaaaaaaaaaa ||\n" >>> >>> >>> _______________________________________________ >>> 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
