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

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

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

2017-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 120085. 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

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

2017-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 120084. Typz added a comment. rebase https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h lib/Format/FormatTokenLexer.cpp lib/Format/FormatTokenLexer.h

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. > My question is: if CanBreak is false, we currently don't call > breakProtrudingToken. So either we do something very wrong in that case > (which might be true, but I'd like to understand why) or we should be able > to just calculate the penalty by not breaking anything

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

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

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

2017-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D37813#876227, @klimek wrote: > I think instead of introducing more and more special cases of macros we might > want to handle, we should instead allow specifying macro productions globally. what do you mean? Do you mean to group all the macro

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-20 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. This cannot be implemented where we currently call breakProtrudingToken(), since this function starts by 'creating' the BreakableToken and dealing with meany corner cases: so this should be done before in any case. But the code at the end of breakProtrudingToken() is

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 115830. Typz added a comment. Remove `Reflow` from LineState, and perform the decision again during reconstruction phase. https://reviews.llvm.org/D33589 Files: lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. > I am still trying to get to the bottom of this assertion, any hint where to > look for? OK, got it. The issue is that we will actually need to run the wrapping 3 times when DryRun = false : call reflowProtrudingToken() twice with DryRun=true to find out the better

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D33589#875039, @djasper wrote: > I think doing the computation twice is fine. Or at least, I'd need a test > case where it actually shows substantial overhead before doing what you are > doing here. Understand that creating more States and

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. For one thing, we need to update the state to store the "decision" of the reflowing mode, which is performed only in DryRun=true mode, to avoid doing the computation multiple times. Apart from this, the decision is conceptually internal to breakProtrudingToken(). But the

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

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 115802. 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

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

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 115801. Typz marked 5 inline comments as done. Typz added a comment. Add tests. Replace sorted list with hashtable. https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h

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

2017-09-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/FormatTokenLexer.cpp:642 tok::pp_define) && -std::find(ForEachMacros.begin(), ForEachMacros.end(), - FormatTok->Tok.getIdentifierInfo()) != ForEachMacros.end()) { - FormatTok->Type =

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

2017-09-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Other macros are used to declare namespaces, and should thus be handled similarly. This is the case for crpcut's TESTSUITE macro, or for unittest-cpp's SUITE macro: TESTSUITE(Foo) { TEST(MyFirstTest) { assert(0); } } // TESTSUITE(Foo) This patch deals

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

2017-09-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 115057. Typz added a comment. Split diff: handle only statements in here, namespace macros will be moved to another one. https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h

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

2017-09-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 115054. Typz marked 2 inline comments as done. Typz added a comment. Fix review comments, before splitting the commit. https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h

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

2017-09-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 8 inline comments as done. Typz added inline comments. Comment at: lib/Format/NamespaceEndCommentsFixer.cpp:155 const FormatToken *NamespaceTok = AnnotatedLines[StartLineIndex]->First; - // Detect "(inline)? namespace" in the beginning of a line. - if

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 115051. Typz added a comment. Reorder the functions to minimize diff. https://reviews.llvm.org/D33589 Files: lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-09-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:1339 +unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken , +LineState , djasper wrote: > Can you create a patch

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

2017-09-12 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 114783. Typz added a comment. Rebase to master to fix merge issue https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h lib/Format/FormatTokenLexer.cpp lib/Format/FormatTokenLexer.h

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

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

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

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

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

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

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-07-28 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 108651. Typz added a comment. Rebase https://reviews.llvm.org/D33589 Files: lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp Index:

[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] 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=108598#toc Repository: rL LLVM

[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 : 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:

[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

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

2017-07-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 107841. Typz marked 4 inline comments as done. Typz added a comment. Address review comments https://reviews.llvm.org/D35557 Files: lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp

[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] D33440: clang-format: better handle statement and namespace macros

2017-07-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. t>>! In https://reviews.llvm.org/D33440#812645, @djasper wrote: > So, there are two things in this patch: Statement macros and namespace > macros. Lets break this out and handle them individually. They really aren't > related that much. Indeed, the only "relation" is the

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

2017-07-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. Allow merging short case labels when they actually end with a comment (like a comment after the ``break``) and when followed by switch-level comments (e.g. aligned with next case): switch(a) { case 0: break; // comment at end of

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

2017-07-18 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 107030. Typz marked an inline comment as done. Typz added a comment. Add more tests https://reviews.llvm.org/D35483 Files: lib/Format/UnwrappedLineParser.cpp lib/Format/UnwrappedLineParser.h unittests/Format/NamespaceEndCommentsFixerTest.cpp Index:

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

2017-07-17 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. The current code would return an incorrect value when a preprocessor directive is present immediately after the opening brace: this causes the nanespace end comment fixer to break in some places, for exemple it would not add the

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-07-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 106442. Typz added a comment. Move code out of optimizer, directly into ContinuationIndenter::breakProtrudingToken(), to minimize impact on performance. Comment reflowing of breakable items which break the limit will be slightly slower, since we now consider

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-07-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 2 inline comments as done. Typz added inline comments. Comment at: lib/Format/UnwrappedLineFormatter.cpp:723 FormatDecision LastFormat = Node->State.NextToken->Decision; if (LastFormat == FD_Unformatted || LastFormat == FD_Continue) +

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-07-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/UnwrappedLineFormatter.cpp:723 FormatDecision LastFormat = Node->State.NextToken->Decision; if (LastFormat == FD_Unformatted || LastFormat == FD_Continue) +addNextStateToQueue(Penalty, Node,

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

2017-07-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D33440 ___ 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-07-12 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I renamed the option to `AlignAfterOperator`, is it acceptable now? (I also thought of `UnindentOperator`, but I think it is better to keep the notion of alignment) Note that this style is used in multiple open-source projects: Skia , parts of QtCreator

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

2017-07-12 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 106221. Typz marked 3 inline comments as done. Typz added a comment. Rename option to AlignAfterOperator https://reviews.llvm.org/D32478 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

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

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

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

[PATCH] D34395: clang-format: add options to merge empty record body

2017-06-30 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL306874: clang-format: add options to merge empty record body (authored by Typz). Repository: rL LLVM https://reviews.llvm.org/D34395 Files: cfe/trunk/include/clang/Format/Format.h

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-30 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL306868: clang-format: Do not binpack initialization lists (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D34238?vs=103057=104914#toc Repository: rL LLVM

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

2017-06-29 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: include/clang/Format/Format.h:167 +/// \endcode +OAS_StrictAlign, + }; djasper wrote: > The name is not intuitive. I don't think this is any more or less strict than > the other version. It is a bit stricter in

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

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

[PATCH] D34395: clang-format: add options to merge empty record body

2017-06-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103939. Typz added a comment. Merge `SplitEmptyClass/Struct/Union` options into a single `SplitEmptyRecord` option. https://reviews.llvm.org/D34395 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h

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

2017-06-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103937. Typz added a comment. Fix typo https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h lib/Format/FormatTokenLexer.cpp lib/Format/FormatTokenLexer.h

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

2017-06-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103935. Typz added a comment. Complete refactor to make the processing much more generic https://reviews.llvm.org/D33440 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h lib/Format/FormatTokenLexer.cpp

[PATCH] D34395: clang-format: add options to merge empty record body

2017-06-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I don't know if some style would want different styles, and I agree with you on principle; but since the brace wrapping is already configured for each kind of record, I choose to keep things consistent and have flags for each kind of record. But I can merge the options,

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-06-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D33589#789002, @alexfh wrote: > why do we want to make an exception for comments and not for regular code? This is not an exception for comments: the `PenaltyExcessCharacter` is used whenever the code is longer than the `ColumnLimit`, and used

[PATCH] D34395: clang-format: add options to merge empty record body

2017-06-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D34395 ___ 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-06-23 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. ping? https://reviews.llvm.org/D32478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D34238: clang-format: Do not binpack initialization lists

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

[PATCH] D34399: clang-format: introduce InlineOnly short function style

2017-06-21 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL305912: clang-format: introduce InlineOnly short function style (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D34399?vs=103357=103370#toc Repository: rL LLVM

[PATCH] D34399: clang-format: introduce InlineOnly short function style

2017-06-21 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103357. Typz marked an inline comment as done. Typz added a comment. Fix according to review comments https://reviews.llvm.org/D34399 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/TokenAnnotator.cpp

[PATCH] D34399: clang-format: introduce InlineOnly short function style

2017-06-21 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 3 inline comments as done. Typz added inline comments. Comment at: include/clang/Format/Format.h:234 + bool allowEmptyFunctionsOnASingleLine() const { + return AllowShortFunctionsOnASingleLine >= ShortFunctionStyle::SFS_Empty; djasper wrote:

[PATCH] D34395: clang-format: add options to merge empty record body

2017-06-20 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103202. Typz added a comment. Enable merging records for Mozilla style https://reviews.llvm.org/D34395 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/FormatToken.h lib/Format/UnwrappedLineFormatter.cpp

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

2017-06-20 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103195. Typz added a comment. Rebase & fix indentation when newline is inserted after return or equal. https://reviews.llvm.org/D32478 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h

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

2017-06-20 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked 7 inline comments as done. Typz added a comment. This style is used in the Skia project. https://reviews.llvm.org/D32478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D34399: clang-format: introduce InlineOnly short function style

2017-06-20 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added subscribers: rengolin, klimek. This is the same as Inline, except it does not imply all empty functions are merged: with this style, empty functions are merged only if they also match the 'inline' criteria (i.e. defined in a class). This is helpful to

[PATCH] D34395: clang-format: add options to merge empty record body

2017-06-20 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. This patch introduces a few extra BraceWrapping options, similar to `SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g. class, struct, union and namespace): - SplitEmptyClass - SplitEmptyStruct - SplitEmptyUnion -

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103057. Typz added a comment. Fix indentation https://reviews.llvm.org/D34238 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestJava.cpp Index: unittests/Format/FormatTestJava.cpp

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103056. Typz added a comment. Fix case where the content fits on a line, by wrapping after each comma, like this: static int types[] = { 0, 1, 2, }; https://reviews.llvm.org/D34238 Files:

[PATCH] D33491: clang-format: Fix C99 designated initializers corner cases

2017-06-19 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL305696: clang-format: Fix C99 designated initializers corner cases (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D33491?vs=103018=103041#toc Repository: rL LLVM

[PATCH] D33491: clang-format: Fix C99 designated initializers corner cases

2017-06-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: unittests/Format/FormatTest.cpp:1526 + verifyFormat("const struct A a = {[0] = 1, [1] = 2};"); + verifyFormat("const struct A a = {[1] = a,\n" + "[2] = b,\n" djasper

[PATCH] D33491: clang-format: Fix C99 designated initializers corner cases

2017-06-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 103018. Typz marked 2 inline comments as done. Typz edited the summary of this revision. Typz added a comment. Fix review comments https://reviews.llvm.org/D33491 Files: lib/Format/ContinuationIndenter.cpp lib/Format/FormatToken.h

[PATCH] D33491: clang-format: Fix C99 designated initializers corner cases

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

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-06-19 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. @krasimir, @alexfh : can I get some feedback? This patch solves a practical problem, i.e. allowing the comment to overflow a bit without triggering a reflow [according to the priorities which are in config, obviously]. It may not always provide the "best" wrapping, but as

[PATCH] D33823: [clang-format] Support sorting using declarations

2017-06-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments. Comment at: lib/Format/UsingDeclarationsSorter.cpp:66 + } + return HasIdentifier && Tok && Tok->isOneOf(tok::semi, tok::comma); +} could also be followed by an assignment, in case of type alias: using foo = bar::foo;

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102809. Typz added a comment. fix indent https://reviews.llvm.org/D34238 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102808. Typz marked an inline comment as done. Typz added a comment. remove special case after assignment https://reviews.llvm.org/D34238 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp

[PATCH] D33491: clang-format: Fix C99 designated initializers corner cases

2017-06-16 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102803. Typz added a comment. Fix incorrect labelling as ObjCMethodExpr https://reviews.llvm.org/D33491 Files: lib/Format/ContinuationIndenter.cpp lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp Index:

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-15 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102672. Typz added a comment. fix unit tests https://reviews.llvm.org/D34238 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestComments.cpp Index: unittests/Format/FormatTestComments.cpp

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-15 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D34238#781224, @malcolm.parsons wrote: > Some people write > > auto x = std::map{ >{ 0, "foo fjakfjaklf kljj" }, >{ 1, "bar fjakfjaklf kljj" }, >{ 2, "stuff fjakfjaklf kljj" }, >}; This case (and

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-15 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. This patch is probably not complete, though it works fine in all situations I could think of: nested initializers, "short" statement (properly merged), column layout is still performed when needed... static int types[] = { SourcePrivate::registerTypes(),

[PATCH] D34238: clang-format: Do not binpack initialization lists

2017-06-15 Thread Francois Ferrand via Phabricator via cfe-commits
Typz created this revision. Herald added a subscriber: klimek. This patch tries to avoid binpacking when initializing lists/arrays, to allow things like: static int types[] = { registerType1(), registerType2(), registerType3(), }; std::map x = { {

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-06-14 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. @krasimir : ping https://reviews.llvm.org/D33589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2017-06-14 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL305384: clang-format: Add CompactNamespaces option (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D32480?vs=102528=102531#toc Repository: rL LLVM

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

2017-06-14 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102528. Typz marked an inline comment as done. Typz added a comment. Move tests that add or fix namespace end comments to NamespaceEndCommentsFixerTest.cpp https://reviews.llvm.org/D32480 Files: include/clang/Format/Format.h lib/Format/Format.cpp

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

2017-06-14 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102525. Typz added a comment. Make tests more readable https://reviews.llvm.org/D32480 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/NamespaceEndCommentsFixer.cpp lib/Format/UnwrappedLineFormatter.cpp

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

2017-06-13 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 102346. Typz added a comment. - make "compacted" namespaces always add at most one level of indentation - compact only namespaces which both start and end on consecutive lines https://reviews.llvm.org/D32480 Files: include/clang/Format/Format.h

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

2017-06-13 Thread Francois Ferrand via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL305272: clang-format: add option to merge empty function body (authored by Typz). Changed prior to commit: https://reviews.llvm.org/D33447?vs=100420=102294#toc Repository: rL LLVM

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

2017-06-12 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] D33447: clang-format: add option to merge empty function body

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

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

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

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

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

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

2017-06-06 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. So how do I proceed? 1. Keep the CompactNamespace option, and make "compacted" namespaces always add at most one level of indentation 2. Or assume that this can only ever usefully work with the behavior of NI_None and add an additional enum value NI_Compact. And should

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-06-06 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D33589#769893, @krasimir wrote: > I think that what you're trying to solve is not practically that important, > is unlikely to improve the handling of comments, and will add a lot of > complexity. Not sure the 'approach' I have in this patch

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

2017-05-31 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. That will be slightly more complicated to check, esp. we will need to keep track of the matching-closing-brace (currently only the matching-opening-brace) is stored. But I can try to update the patch in that direction, if that is the consensus.

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-05-30 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 100698. Typz marked an inline comment as done. Typz added a comment. fix code & tests https://reviews.llvm.org/D33589 Files: lib/Format/ContinuationIndenter.cpp lib/Format/ContinuationIndenter.h lib/Format/FormatToken.cpp lib/Format/FormatToken.h

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-05-30 Thread Francois Ferrand via Phabricator via cfe-commits
Typz marked an inline comment as done. Typz added inline comments. Comment at: unittests/Format/FormatTest.cpp:8571 +"*/", +format("int a; /* first line second line third line */", Style)); +} Typz wrote: > This is not working as

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

2017-05-30 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] D33447: clang-format: add option to merge empty function body

2017-05-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 100420. Typz marked 2 inline comments as done. Typz added a comment. fix indent & rename option to SplitEmptyFunctionBody https://reviews.llvm.org/D33447 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/UnwrappedLineFormatter.cpp

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

2017-05-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 100412. Typz added a comment. move option to BraceWrapping https://reviews.llvm.org/D33447 Files: include/clang/Format/Format.h lib/Format/Format.cpp lib/Format/UnwrappedLineFormatter.cpp unittests/Format/FormatTest.cpp Index:

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

2017-05-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. > Ah damn. Didn't think about the precedences. What I wanted was for the > highest level to have a one char operator, e.g. > > bool a = aa // > << // > | c; > Almost, but not quite: bool a = aa // << //

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

2017-05-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. In https://reviews.llvm.org/D33447#765610, @djasper wrote: > I think it's just wrong that WebKit inherits this. The style guide explicitly > says that this is wrong: > > MyOtherClass::MyOtherClass() : MySuperClass() {} I think this exemple applies to constructors only.

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

2017-05-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. Nop, it's formatted like this: bool a = aa // == // && c; bool a = aa // == // + c; https://reviews.llvm.org/D32478 ___ cfe-commits mailing list

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

2017-05-26 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment. I actually don't know how, but it still manages somehow : I rebuilt this exact patch to ensure I gave you the correct output. And the same behavior can be seen in the test cases, where the operator with highest precedence is aligned with the equal sign.

<    1   2   3   4   >