[PATCH] D35557: clang-format: merge short case labels with trailing comments

2017-07-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: unittests/Format/FormatTest.cpp:912 + " break;\n" + "}", + Style); krasimir wrote: > I'd suggest adding more cases here, like: > ``` >"case 6: /* comment */ x = 1;

[PATCH] D35483: clang-format: fix block OpeningLineIndex around preprocessor

2017-07-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 107843. Typz marked 3 inline comments as done. Typz added a comment. Address review commentsx https://reviews.llvm.org/D35483 Files: lib/Format/UnwrappedLineParser.cpp lib/Format/UnwrappedLineParser.h unittests/Format/NamespaceEndCommentsFixerTest.cpp I

[PATCH] D35483: clang-format: fix block OpeningLineIndex around preprocessor

2017-07-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/UnwrappedLineParser.cpp:464 + for (const auto &i : PPStack) { +hash_combine(h, i.Kind); +hash_combine(h, i.Line); krasimir wrote: > When I patch this, I get an `UnwrappedLineParser.cpp:457:16 error: impl

[PATCH] D35483: clang-format: fix block OpeningLineIndex around preprocessor

2017-07-28 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL309369: clang-format: fix block OpeningLineIndex around preprocessor (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D35483?vs=107843&id=108598#toc Repository: rL LLVM https://

[PATCH] D35557: clang-format: merge short case labels with trailing comments

2017-07-28 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL309370: clang-format: merge short case labels with trailing comments (authored by Typz). Repository: rL LLVM https://reviews.llvm.org/D35557 Files: cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp

[PATCH] D42684: clang-format: Allow optimizer to break template declaration.

2018-01-30 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Typz added reviewers: krasimir, djasper, klimek. Introduce ``PenaltyBreakTemplateDeclaration`` to control the penalty, and change ``AlwaysBreakTemplateDeclarations`` to an enum with 3 modes: - ``None`` for automatic (e.g. penalty based) wrapping of template declaratio

[PATCH] D42684: clang-format: Allow optimizer to break template declaration.

2018-01-30 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 131946. Typz added a comment. fix commit message Repository: rC Clang https://reviews.llvm.org/D42684 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp lib/Format/TokenAnnotator.cpp unittests/Format/For

[PATCH] D42729: clang-format: Fix formatting of function blocks followed by semicolon

2018-01-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Typz added reviewers: krasimir, djasper, klimek. In some case, the heuristic used to identify the type of blocks (in UnwrappedLineParser) mistakens a Block for a BracedInit, when the TokenAnnotator eventually finds (correclty) that this is a function declaration. This

[PATCH] D42729: clang-format: Fix formatting of function body followed by semicolon

2018-01-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 132130. Typz added a comment. update commit message Repository: rC Clang https://reviews.llvm.org/D42729 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp ===

[PATCH] D42729: clang-format: Fix formatting of function body followed by semicolon

2018-01-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1911 + if (Next && Next->is(tok::l_brace) && Next->BlockKind == BK_BracedInit) + Next->BlockKind = BK_Block; +} this may actually not be enough in all cases: to completely mat

[PATCH] D42729: clang-format: Fix formatting of function body followed by semicolon

2018-01-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. There are actually other cases, e.g. with macros "containing" the semicolon: void abort() { FOO() BAR() }; gets reformatted to this (still wrong with this patch, but the space after the parenthesis is added): void abort(){ FOO() BAR() }; And also this one (

[PATCH] D42729: clang-format: Fix formatting of function body followed by semicolon

2018-01-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D42729#993159, @djasper wrote: > I think this case is not important enough to fix. Please tell users to just > delete the useless semicolon. I would agree if were simple to spot: but often this may manifest itself only with a missing space bet

[PATCH] D42684: clang-format: Allow optimizer to break template declaration.

2018-01-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 132198. Typz added a comment. Force wrap after multi-line template declaration Repository: rC Clang https://reviews.llvm.org/D42684 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp lib/Format/TokenAnnota

[PATCH] D42684: clang-format: Allow optimizer to break template declaration.

2018-02-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 132341. Typz added a comment. If the template declaration spans multiple lines, force wrap before the function/class declaration Repository: rC Clang https://reviews.llvm.org/D42684 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.c

[PATCH] D42787: clang-format: do not add extra indent when wrapping last parameter

2018-02-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Typz added reviewers: krasimir, djasper, klimek. There should be no extra indent when wrapping only the expression used as last argument. This is consistent with the behavior when the first (and only) argument's expression is wrapped. foo(a, bb +

[PATCH] D42787: clang-format: do not add extra indent when wrapping last parameter

2018-02-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I doubt this particular was intentional, esp. since this case never happens in the tests. I think it is more a side-effect of the (general) indent in "fake" parenthesis. Here is an exemple: Before this change: foo(a, bb + c);

[PATCH] D42787: clang-format: do not add extra indent when wrapping last parameter

2018-02-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. > You might doubt it, but having written the code I can tell you that it's the > case. Ok, you win :-) > I see the argument why this indentation is not necessary in exactly the case > where the last parameter is multi-line and not wrapped to a new line itself: > You alwa

[PATCH] D42729: clang-format: Fix formatting of function body followed by semicolon

2018-02-01 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. > I don't think cases where there is only a semicolon-less macro are > particularly frequent/important either. You probably could even add a > semicolon in those cases, right? How frequent are such cases in your > codebase? Either way, they aren't fixed by this patch, so t

[PATCH] D33440: clang-format: better handle statement macros

2018-02-05 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 132837. Typz added a comment. Use StatementMacro detection to improve brace type detection heuristics (in UnwrappedLineParser::calculateBraceTypes). https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/Fo

[PATCH] D37813: clang-format: better handle namespace macros

2018-02-05 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 132838. Typz added a comment. rebase https://reviews.llvm.org/D37813 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h lib/Format/FormatTokenLexer.cpp lib/Format/NamespaceEndCommentsFixer.cpp lib/Format/TokenAnnota

[PATCH] D32524: [clang-format] Fix MatchingOpeningBlockLineIndex computation

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I tried to add some test, but could not find a simple way: I could not find any 'parser' tests from which to start, and I don't see with current master how this can be an issue (though it becomes an issue with some of other patches). Any hint how to implement some test? h

[PATCH] D32524: [clang-format] Fix MatchingOpeningBlockLineIndex computation

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99136. Typz added a comment. Reformat and remove unneeded comment https://reviews.llvm.org/D32524 Files: lib/Format/UnwrappedLineParser.cpp Index: lib/Format/UnwrappedLineParser.cpp === --- li

[PATCH] D32525: [clang-format] Add SpaceBeforeColon option

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D32525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32480: [clang-format] Add BinPackNamespaces option

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D32480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32477: [clang-format] Allow customizing the penalty for breaking assignment

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D32477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32479: [clang-format] Add BreakConstructorInitializersBeforeColon option

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D32479 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32479: [clang-format] Add BreakConstructorInitializersBeforeColon option

2017-05-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Or would it be better to replace (i.e. deprecate) the BreakConstructorInitializersBeforeComma option with a multiple choice option, as suggested here: http://clang-developers.42468.n3.nabble.com/clang-format-Proposal-for-a-new-style-for-constructor-and-initializers-line-bre

[PATCH] D32480: [clang-format] Add BinPackNamespaces option

2017-05-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: include/clang/Format/Format.h:153 + /// \endcode + bool AllowSemicolonAfterNamespace; + djasper wrote: > While I am not entirely opposed to this feature, I think it should be a > separate patch. I totally agree, which is

[PATCH] D33282: clang-format: fix prefix for doxygen comments after member

2017-05-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. Doxygen supports putting documentation blocks after member, by adding an additional < marker in the comment block. This patch makes sure this marker is used in lines which are introduced by breaking the comment. int foo; ///< Some v

[PATCH] D33285: clang-format: do not reflow bullet lists

2017-05-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. This patch prevents reflowing bullet lists in block comments. It handles all lists supported by doxygen and markdown, e.g. bullet lists starting with '-', '*', '+', as well as numbered lists starting with -# or a number followed by a

[PATCH] D32524: [clang-format] Fix MatchingOpeningBlockLineIndex computation

2017-05-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I don't have commit access, can someone please commit this patch? https://reviews.llvm.org/D32524 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32478: [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

2017-05-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. we are using this style at our company, not sure if it is used elsewhere; I will check. however, it seems to me that this behavior does not match the name of the option : AlignOperands does not align the operands anymore when BreakBeforeBinaryOperators is set... so, for t

[PATCH] D32478: [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

2017-05-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: unittests/Format/FormatTest.cpp:2476 "bool value = a\n" - " + a\n" - " + aa

[PATCH] D33282: clang-format: fix prefix for doxygen comments after member

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I don't have commit access, can someone please commit this patch? https://reviews.llvm.org/D33282 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D32477: [clang-format] Allow customizing the penalty for breaking assignment

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99415. Typz added a comment. Add test to verify the option actually has some effect https://reviews.llvm.org/D32477 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp Index: unitte

[PATCH] D33314: clang-format: Add option to remove semicolon at end of namespace

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. This option allows cleaning up namespace declaration, by removing the extra semicolon after namespace closing brace. https://reviews.llvm.org/D33314 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/Namespa

[PATCH] D32480: [clang-format] Add BinPackNamespaces option

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99421. Typz added a comment. clang-format: Add CompactNamespaces option - Change option name to CompactNamespaces - Clarify & test behavior when wrapping is needed - Separate from the 'remove semicolon' patch https://reviews.llvm.org/D32480 Files: include/c

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 2 inline comments as done. Typz added inline comments. Comment at: include/clang/Format/Format.h:153 + /// \endcode + bool AllowSemicolonAfterNamespace; + Typz wrote: > djasper wrote: > > While I am not entirely opposed to this feature, I think it s

[PATCH] D33314: clang-format: Add option to remove semicolon at end of namespace

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Is this not the same reasoning as the whole NamespaceEndCommentsFixer? https://reviews.llvm.org/D33314 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33285: clang-format: do not reflow bullet lists

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked an inline comment as done. Typz added inline comments. Comment at: lib/Format/BreakableToken.cpp:313 + // Numbered lists may also start with a number followed by '.' + static const char *kNumberedListPattern = "^[0-9]+\\. "; + hasSpecialMeaningPrefix = hasSpecialMe

[PATCH] D33285: clang-format: do not reflow bullet lists

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99427. Typz added a comment. - Use static regex to avoid recreating it each time - Add more tests https://reviews.llvm.org/D33285 Files: lib/Format/BreakableToken.cpp unittests/Format/FormatTestComments.cpp Index: unittests/Format/FormatTestComments.cpp =

[PATCH] D32525: [clang-format] Add SpaceBeforeColon option

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I checked the code of POCO, and it indeed follows this convention (though there does not seem to be any C++11 for loop indeed). We also use this style at our company. > Also see my comment. I could not find your comment... can you please re-post? > It's very hard to even

[PATCH] D32524: [clang-format] Fix MatchingOpeningBlockLineIndex computation

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Indeed, I don't have commit access. But I was wondering if I should not get it, to simplify landing the patches after review. I read http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access about this, but I am still wondering what is considered a "track record of

[PATCH] D33285: clang-format: do not reflow bullet lists

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 3 inline comments as done. Typz added inline comments. Comment at: lib/Format/BreakableToken.cpp:313 + // Numbered lists may also start with a number followed by '.' + static const char *kNumberedListPattern = "^[0-9]+\\. "; + hasSpecialMeaningPrefix = hasSpecialMe

[PATCH] D33285: clang-format: do not reflow bullet lists

2017-05-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99436. Typz marked an inline comment as done. Typz added a comment. Limit to 2 digits and not break before a matching numbered list sequence followed by a fullstop, to avoid interpreting numbers at the end of sentence as numbered bullets (and thus preventing re

[PATCH] D33314: clang-format: Add option to remove semicolon at end of namespace

2017-05-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I stumbled on the issue when working on the CompactNamespaces option, where the extra semicolon prevents merging the closing braces. There was an easy fix, which guaranteed that the closing braces would be properly merged, so I went for it

[PATCH] D32479: [clang-format] Add BreakConstructorInitializersBeforeColon option

2017-05-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99553. Typz added a comment. Deprecate BreakConstructorInitializersBeforeComma and replace it with a more generic BreakConstructorInitializers option. https://reviews.llvm.org/D32479 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp

[PATCH] D32478: [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

2017-05-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D32478#758258, @djasper wrote: > When you say "this doesn't happen in tests", do you mean this never happens > when there are parentheses around the expression? By 'test' I meant 'conditional construct' : it happens when there are parentheses

[PATCH] D33314: clang-format: Add option to remove semicolon at end of namespace

2017-05-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz abandoned this revision. Typz added a comment. ATM, in the presence of semicolons, the closing braces will simply not be merged : i will check if I can handle this case easily (in the CompactNamespaces patch), and I'll abandon this one for now. https://reviews.llvm.org/D33314 _

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99575. Typz marked 11 inline comments as done. Typz edited the summary of this revision. Typz added a comment. update for review comments https://reviews.llvm.org/D32480 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/NamespaceEndCo

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: include/clang/Format/Format.h:358 + /// \endcode + bool BinPackNamespaces; + djasper wrote: > Typz wrote: > > djasper wrote: > > > This is not bin packing at all. Maybe CompactNamespaces? Or > > > SingleLineNamespaces? >

[PATCH] D32477: clang-format: Allow customizing the penalty for breaking assignment

2017-05-22 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL303534: clang-format: Allow customizing the penalty for breaking assignment (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D32477?vs=99415&id=99720#toc Repository: rL LLVM htt

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-22 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: include/clang/Format/Format.h:358 + /// \endcode + bool BinPackNamespaces; + djasper wrote: > Typz wrote: > > djasper wrote: > > > Typz wrote: > > > > djasper wrote: > > > > > This is not bin packing at all. Maybe Compact

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-22 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Merging the 2 options is definitely a "safe" option, as it prevents ensures only the most obvious behavior is accessible. However, it has significant (IMO) drawbacks: - "Compact" is a not an namespace indentation type, this will make the option quite confusing - If indent

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-22 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99763. Typz added a comment. Remove dependency on https://reviews.llvm.org/D33314 https://reviews.llvm.org/D32480 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/NamespaceEndCommentsFixer.cpp lib/Format/UnwrappedLineFormatter.cpp

[PATCH] D33285: clang-format: do not reflow bullet lists

2017-05-22 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL303556: clang-format: do not reflow bullet lists (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D33285?vs=99436&id=99764#toc Repository: rL LLVM https://reviews.llvm.org/D3328

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99854. Typz marked 5 inline comments as done. Typz added a comment. respond to review comments https://reviews.llvm.org/D32479 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp lib/Format/TokenAnnotator.cpp

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:196 + FormatStyle::BCIS_AfterColonAndComma) && + (State.Column + State.Line->Last->TotalLength - Previous.TotalLength > + getColumnLimit(State) || djasper wrote:

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99856. Typz added a comment. Add missing doc for BreakConstructorInitializers https://reviews.llvm.org/D32479 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp lib/Format/TokenAnnotator.cpp unittests/Forma

[PATCH] D32478: [clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: unittests/Format/FormatTest.cpp:2476 "bool value = a\n" - " + a\n" - " + aa

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Just to be clear: as it is, the patch does not implement what you describe, both on the 'indent' side (as expected, we are discussing it), but also on the "merging" of braces side. Consecutive namespace opening are merged on one side; and consecutive namespace closing are

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D32480#761859, @krasimir wrote: > This change should also adapt NamespaceEndCommentFixer to respect the new > option and not introduce/remove/change the comments unexpectedly. This should be handled already (pending further changes to the patch

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 6 inline comments as done. Typz added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:196 + FormatStyle::BCIS_AfterColonAndComma) && + (State.Column + State.Line->Last->TotalLength - Previous.TotalLength > + getColumnLimit(Sta

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99886. Typz marked 3 inline comments as done. Typz added a comment. Refactor to avoid duplicating code, and fix typo in test. https://reviews.llvm.org/D32479 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp

[PATCH] D32525: [clang-format] Add SpaceBeforeColon option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D32525#760710, @djasper wrote: > Then you also (accidentally?) change the spacing in dict literals. However, > the latter is already controlled by SpacesInContainerLiterals. not really accidentally: I want the space on the 'outside' of dict lit

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 99887. Typz added a comment. Cleanup according to review comment https://reviews.llvm.org/D32479 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.

[PATCH] D32479: clang-format: Introduce BreakConstructorInitializers option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:196 + FormatStyle::BCIS_AfterColonAndComma) && + (State.Column + State.Line->Last->TotalLength - Previous.TotalLength > + getColumnLimit(State) || djasper wrote:

[PATCH] D32480: clang-format: Add CompactNamespaces option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D32480#761862, @krasimir wrote: > In any case, adding a namespace end comment to a line closing multiple > namespaces is super confusing for me: what does the comment refer to: the > inner one, the outer one, or both? > `}} // namespace A::B`

[PATCH] D32525: [clang-format] Add SpaceBeforeColon option

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Indeed, so this is why :-) https://reviews.llvm.org/D32525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D33440: clang-format: properly handle Q_UNUSED and QT_REQUIRE_VERSION

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. These macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new line, and not get merged with the next line. void foo(int a, int b) { Q_UNUSED(a)

[PATCH] D33447: clang-format: add option to merge empty function body

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. This option supplements the AllowShortFunctionsOnASingleLine flag, to merge empty function body at the beginning of the line: e.g. when the function is not short-enough and breaking braces after function. int f() {} https://revi

[PATCH] D33447: clang-format: add option to merge empty function body

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: unittests/Format/FormatTest.cpp:6029 + + //TODO: this case does not work, not sure if there is reason... + MergeEmptyOnly.BreakBeforeBraces = FormatStyle::BS_Custom; When testing this patch, I found a bug when `AllowShort

[PATCH] D33447: clang-format: add option to merge empty function body

2017-05-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: include/clang/Format/Format.h:158 + /// + bool AllowEmptyFunctionBodyOnASingleLine; + maybe this should be a nested option inside BraceWrapping? or this should be donc implicit when breaking after function (BraceWrappin

<    1   2   3   4