[PATCH] D153205: [clang-format] Support block indenting array/struct list initializers

2023-07-05 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/include/clang/Format/Format.h:95-98 /// \warning -/// Note: This currently only applies to parentheses. +/// Note: This currently only applies to parentheses and braced list +/// initializers when ``Cpp11BracedL

[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-05 Thread Owen Pan via Phabricator via cfe-commits
owenpan planned changes to this revision. owenpan added a comment. Yep! After reformating `clang/lib/Format/` and rebuilding clang-format, I got the same warning: WhitespaceManager.cpp:233:45: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]

[PATCH] D153205: [clang-format] Support block indenting array/struct list initializers

2023-07-05 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Do you need to update the current diff to show the net change? For example, the unit tests you added don't show up as a diff right now. Comment at: clang/include/clang/Format/Format.h:95-98 /// \warning -/// Note: This currently only applies

[PATCH] D153579: [clang-format] Fix RAS reference alignment when PAS is left or middle

2023-07-06 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG6b8a9ff7e74f: [clang-format] Fix RAS reference alignment when PAS is left or middle (authored by gedare, committed by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://r

[PATCH] D153585: [clang-format] Fix align consecutive declarations over function pointers

2023-07-06 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa84e0b4bdc99: [clang-format] Fix align consecutive declarations over function pointers (authored by gedare, committed by owenpan). Changed prior to

[PATCH] D153205: [clang-format] Support block indenting array/struct list initializers

2023-07-06 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG413a7cb6e0db: [clang-format] Support block indenting array/struct list initializers (authored by gedare, committed by owenpan). Repository: rG LLV

[PATCH] D153589: [NFC] Initialize pointer fields and remove a needless null check.

2023-07-06 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. The clang-format part LGTM. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153589/new/ https://reviews.llvm.org/D153589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-06 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 537971. owenpan added a comment. This revision is now accepted and ready to land. Don't remove the outermost double parentheses after `if`/`while` if there is an `=` inside. Also rename the options. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D1544

[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-06 Thread Owen Pan via Phabricator via cfe-commits
owenpan marked an inline comment as done. owenpan added a comment. In D154484#4475377 , @MyDeveloperDay wrote: > I reckon you could detect the `=` condition between the matching paren don't > you? Absolutely. Comment at: clang/docs/

[PATCH] D154552: [clang-format] Add note directive generation for docs

2023-07-07 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Can you attach a screenshot of how the new `note` section would look like? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154552/new/ https://reviews.llvm.org/D154552 ___ cfe-comm

[PATCH] D154552: [clang-format] Add note directive generation for docs

2023-07-09 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG9ec5dc694478: [clang-format] Add note directive generation for docs (authored by gedare, committed by owenpan). Repository: rG LLVM Github Monorep

[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 538470. owenpan added a reviewer: sstwcw. owenpan removed a subscriber: sstwcw. owenpan added a comment. Don't treat `(` as `l_paren` if it's followed by `{`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154484/new/ https://reviews.llvm.org/D154484

[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan marked an inline comment as done. owenpan added a comment. In D154484#4483659 , @sstwcw wrote: > Did you forget about GNU statement expressions? > > if (({ > foo(); > bar(); > })) { > } Thanks! CHANGES SINCE LAST ACTIO

[PATCH] D151047: [clang-format] Fix indentation for selective formatting.

2023-07-10 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D151047#4449996 , @Sedeniono wrote: > As suggested by @owenpan, I split the commits differently. The first commit > now contains only the fix + corresponding tests. The second commit contains > refactorings/asserts. How do I

[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-11 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG3a6a0702c2a4: [clang-format] Add an option to remove redundant parentheses (authored by owenpan). Changed prior to commit: https://reviews.llvm.or

[PATCH] D16286: [clang-tidy] Readability check for redundant parenthesis in return expression.

2023-07-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Herald added a subscriber: carlosgalvezp. clang-format can remove some types of redundant parens now. See D154484 . CHANGES SINCE LAST ACTION https://reviews.llvm.org/D16286/new/ https://reviews.llvm.org/D16286 _

[PATCH] D155094: Refactoring and asserts in LevelIndentTracker. (NFC)

2023-07-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:91 void adjustToUnmodifiedLine(const AnnotatedLine &Line) { -unsigned LevelIndent = Line.First->OriginalColumn; -if (static_cast(LevelIndent) - Offset >= 0) - LevelIndent -= Off

[PATCH] D155094: Refactoring and asserts in LevelIndentTracker. (NFC)

2023-07-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:92-96 + unsigned LevelIndent = Line.First->OriginalColumn; + if (static_cast(LevelIndent) - Offset >= 0) +LevelIndent -= Offset; + assert(Line.Level < IndentForLevel.size

[PATCH] D151047: [clang-format] Fix indent for selective formatting.

2023-07-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTestSelective.cpp:641-646 + Style = getLLVMStyle(); + Style.FixNamespaceComments = false; + Code = "namespace ns {\n" + "#define REF(alias) alias alias_var;\n" + "}"; + EXPECT_EQ(Code, for

[PATCH] D155273: [clang-format] Add TypeNames option to disambiguate types/objects

2023-07-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. Herald added projects: All, clang, clang-format. Herald added a subscriber: cfe-commits. Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay. owenpan requested review of this revision. If a non-keyword identifier is found in `TypeNames`, then a `*`, `&

[PATCH] D155273: [clang-format] Add TypeNames option to disambiguate types/objects

2023-07-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:284 + Style.TypeNames.push_back("Class"); + Tokens = annotate("if (Class *obj {getObj()})", Style); + ASSERT_EQ(Tokens.size(), 12u) << Tokens; This test case comes from D1

[PATCH] D145262: [clang-format] Treat AttributeMacros more like attribute macros

2023-07-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.h:231 /// Used e.g. to break like: + /// \code /// functionCall(Parameter, otherCall( Unrelated. Comment at: clang/lib/Format/ContinuationIndenter.h:234

[PATCH] D155358: [clang-format] Correctly annotate overloaded operator function name

2023-07-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. Herald added projects: All, clang, clang-format. Herald added a subscriber: cfe-commits. Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay. owenpan requested review of this revision. The `operator` keyword preceded by a template closer should be anno

[PATCH] D155358: [clang-format] Correctly annotate overloaded operator function name

2023-07-15 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGcc2ff02eaded: [clang-format] Correctly annotate overloaded operator function name (authored by owenpan). Repository: rG LLVM Github Monorepo CHAN

[PATCH] D151047: [clang-format] Fix indent for selective formatting.

2023-07-17 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTestSelective.cpp:657 + Style = getLLVMStyle(); + + Style.IndentPPDirectives = FormatStyle::PPDirectiveIndentStyle::PPDIS_None; Comment at: clang/unittests/Format/Format

[PATCH] D156259: [clang-format] Fix a bug that erroneously placed function arguments on a new line despite all arguments being able to fit on the same line.

2023-08-23 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd06b92391513: [clang-format] Fix a bug that wraps before function arguments (authored by jp4a50, committed by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.l

[PATCH] D158363: [clang-format] Fix segmentation fault when formatting nested namespaces

2023-08-23 Thread Owen Pan via Phabricator via cfe-commits
owenpan requested changes to this revision. owenpan added a comment. This revision now requires changes to proceed. It seems that you forgot to update the diff? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158363/new/ https://reviews.llvm.org/D158

[PATCH] D158697: [clang-format][doc] Correct typos

2023-08-23 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. This revision is now accepted and ready to land. Comment at: clang/docs/ClangFormatStyleOptions.rst:5129 * ``bool AfterControlStatements`` If ``true``, put space between control statement keywords (for/if/w

[PATCH] D154093: [clang-format] Break long string literals in C#, etc.

2023-08-23 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. @sstwcw this patch caused a crash in `FormatTestJS.StringLiteralConcatenation`: Assertion failed: ((!RequiresNullTerminator || BufEnd[0] == 0) && "Buffer is not null terminated!"), function init, file MemoryBuffer.cpp, line 54. Can you revert it if you can reproduce t

[PATCH] D158363: [clang-format] Fix segmentation fault when formatting nested namespaces

2023-08-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:389 auto *ClosingLine = AnnotatedLines.begin() + ClosingLineIndex + 1; - auto OutdentBy = I[

[PATCH] D158571: [clang-format][NFC] Replace !is() with isNot()

2023-08-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 553032. owenpan added a comment. Rebased to 825cec2 and ran `git-clang-format`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158571/new/ https://reviews.llvm.org/D158571 Files

[PATCH] D158571: [clang-format][NFC] Replace !is() with isNot()

2023-08-24 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG91c4db00612b: [clang-format][NFC] Replace !is() with isNot() (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D157963: [clang-format] Annotate constructor/destructor names

2023-08-24 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG0e63f1aacc00: [clang-format] Annotate constructor/destructor names (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D154093: [clang-format] Break long string literals in C#, etc.

2023-08-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D154093#4615948 , @sstwcw wrote: > In the JavaScript tests that I added, it was wrong to use `SmallString`. > Would you prefer me changing it to `string` or expanding the 6 test cases so > we don't need a variable for the st

[PATCH] D158795: Fix AlignArrayOfStructures + Cpp11BracedListStyle=false

2023-08-25 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. > I'm not exactly sure why this function needs to override the Spaces as it > seems to generally already be set to either 0 or 1 according to the other > formatting settings If so, can we address the issue without the "explicit fix"? Comment at: clan

[PATCH] D158805: [clang-format][NFC] Remove extraneous newlines at end of test cases

2023-08-25 Thread Owen Pan via Phabricator via cfe-commits
owenpan marked an inline comment as done. owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:24187 // Newlines are important here. + verifyFormat("FOO(1+2 )", Style); HazardyKnusperkeks wrote: > This. Good catch! Though `verify

[PATCH] D158795: Fix AlignArrayOfStructures + Cpp11BracedListStyle=false

2023-08-25 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/WhitespaceManager.cpp:1247 if (Previous && Previous->isNot(TT_LineComment)) { - Changes[Next->Index].Spaces = 0; + Changes[Next->Index].Spaces = BracePadding; Changes[Next->Index].Ne

[PATCH] D158925: [clang-format][NFC] Skip stability test if input is pre-formatted

2023-08-26 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. Herald added projects: All, clang, clang-format. Herald added a subscriber: cfe-commits. Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay. owenpan requested review of this revision. This shortens the run-time of `FormatTests` by about 10% on average

[PATCH] D158925: [clang-format][NFC] Skip stability test if input is pre-formatted

2023-08-26 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTestBase.h:88 testing::ScopedTrace t(File, Line, ::testing::Message() << Code.str()); -EXPECT_EQ(Expected.str(), - format(Expected, Style, SC_ExpectComplete, Ranges)) -<< "Expect

[PATCH] D158925: [clang-format][NFC] Skip stability test if input is pre-formatted

2023-08-26 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGc8521451708a: [clang-format][NFC] Skip stability test if input is pre-formatted (authored by owenpan). Changed prior to commit: https://reviews.llvm.org/D158925?vs=553714&id=553765#toc Repository: rG

[PATCH] D158947: [clang-format][NFC] Test formatting the input before messing it up

2023-08-26 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. Herald added projects: All, clang, clang-format. Herald added a subscriber: cfe-commits. Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay. owenpan requested review of this revision. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D15

[PATCH] D158795: Fix AlignArrayOfStructures + Cpp11BracedListStyle=false

2023-08-26 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:20888 + " { 7, 5,\"!!\" }\n" + "};\n", + Style); galenelias wrote: > owenpan wrote: > > > This is consistent with basically every

[PATCH] D158795: Fix AlignArrayOfStructures + Cpp11BracedListStyle=false

2023-08-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:20888 + " { 7, 5,\"!!\" }\n" + "};\n", + Style); galenelias wrote: > owenpan wrote: > > galenelias

[PATCH] D157963: [clang-format] Annotate constructor/destructor names

2023-08-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:3135 + if (!Tok) +break; +} When simplifying the function, I forgot that we are in the inner loop here and thus `break` won't exit the outer loop. Repository: rG

[PATCH] D157963: [clang-format] Annotate constructor/destructor names

2023-08-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 554051. owenpan added a comment. Fixed the crash and added a test case in `TokenAnnotatorTest.cpp`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157963/new/ https://reviews.llvm.org/D157963 Files: clang/lib/Format/TokenAnnotator.cpp clang/unit

[PATCH] D158947: [clang-format][NFC] Test formatting the input before messing it up

2023-08-29 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG6982f1fc2e75: [clang-format][NFC] Test formatting the input before messing it up (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158947/

[PATCH] D159051: [clang-format][NFC] Change EXPECT_EQ to verifyFormat or verifyNoChang

2023-08-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:23933 verifyNoChange("FOO(String-ized&Messy+But(: :Still)=Intentional);", Style); - EXPECT_EQ( - "FOO(String-ized&Messy+But\\(: :Still)=Intentional);", - format("FOO(String-ized&Messy+B

[PATCH] D157963: [clang-format] Annotate constructor/destructor names

2023-08-29 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG086305120887: Reland "[clang-format] Annotate constructor/destructor names" (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157963/new/

[PATCH] D147969: Add InsertBraces to ChromiumStyle

2023-08-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. @pbos can you abandon this revision? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147969/new/ https://reviews.llvm.org/D147969 ___ cfe-commits mailing list cfe-commits@lists.llv

[PATCH] D159051: [clang-format][NFC] Change EXPECT_EQ to verifyFormat or verifyNoChang

2023-08-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. rG14feca5d14f1 concludes the cleanup of this gigantic file WRT `EXPECT_EQ`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D159051/new/ https://reviews.l

[PATCH] D159233: [clang-format][NFC] Change duplicate config files to symlinks

2023-08-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. Herald added projects: All, clang, clang-format. Herald added a subscriber: cfe-commits. Herald added reviewers: rymiel, HazardyKnusperkeks, MyDeveloperDay. owenpan requested review of this revision. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D15

[PATCH] D137338: Fix dupe word typos

2023-08-31 Thread Owen Pan via Phabricator via cfe-commits
Herald added a comment. NOTE: Clang-Format Team Automated Review Comment It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test (unless this is an `NFC` or refactoring, adding documentation etc..) Add your unit tests in `c

[PATCH] D158363: [clang-format] Fix segmentation fault when formatting nested namespaces

2023-08-31 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Do you need us to commit it for you? See https://llvm.org/docs/Phabricator.html#committing-someone-s-change-from-phabricator. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158363/new/ https://reviews.llvm.org/D158363

[PATCH] D158795: Fix AlignArrayOfStructures + Cpp11BracedListStyle=false

2023-08-31 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG58c67e724f71: [clang-format] Fix AlignArrayOfStructures + Cpp11BracedListStyle=false (authored by galenelias, committed by owenpan). Changed prior to commit: https://reviews.llvm.org/D158795?vs=553809&i

[PATCH] D158363: [clang-format] Fix segmentation fault when formatting nested namespaces

2023-09-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. We need the name and email you want to use in order to commit the patch for you. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158363/new/ https://reviews.llvm.org/D158363 ___ cf

[PATCH] D159233: [clang-format][NFC] Change duplicate config files to symlinks

2023-09-02 Thread Owen Pan via Phabricator via cfe-commits
owenpan abandoned this revision. owenpan added a comment. It seems that git doesn't recreate symbolic links by default on Windows. (See e.g. `clang/test/Driver/Inputs/CUDA-symlinks/usr/bin/ptxas`.) I'll abandon this patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[PATCH] D158363: [clang-format] Fix segmentation fault when formatting nested namespaces

2023-09-05 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf465a482caa9: [clang-format] Fix segmentation fault when formatting nested namespaces (authored by d0nc1h0t, committed by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https

[PATCH] D135115: [clang-format] update --files help description

2023-09-05 Thread Owen Pan via Phabricator via cfe-commits
Herald added a subscriber: wangpc. Herald added a reviewer: rymiel. Herald added a comment. NOTE: Clang-Format Team Automated Review Comment It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test (unless this is an `NFC` or

[PATCH] D129050: [clang-format] Update documentation

2023-09-05 Thread Owen Pan via Phabricator via cfe-commits
Herald added a subscriber: wangpc. Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan. Herald added a comment. NOTE: Clang-Format Team Automated Review Comment It looks like your clang-format review does not contain any unit tests, please try to ensure all code changes have a unit test

[PATCH] D148131: Avoid unnecessarily aggressive line-breaking when using "LambdaBodyIndentation: OuterScope" with argument bin-packing.

2023-09-06 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. LG with a couple of minor comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:334 + // enabled. + !(Current.is(TT_LambdaLBrace) && Style.BraceWrapping.BeforeLambdaBody) && CurrentState.NoLineB

[PATCH] D135115: [clang-format] update --files help description

2023-09-07 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/docs/ClangFormat.rst:72-73 Used only with --dry-run or -n ---files= - Provide a list of files to run clang-format +--files= - A file containing a list of file

[PATCH] D129050: [clang-format] Update documentation

2023-09-07 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/docs/ClangFormat.rst:20 - $ clang-format -help + $ clang-format --help OVERVIEW: A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. owenpan wrote: > This should be edited in `dump_for

[PATCH] D138263: [clang-format] Supress aligning of trailing namespace comments

2022-11-18 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D138263#3937223 , @HazardyKnusperkeks wrote: > In D138263#3936536 , > @HazardyKnusperkeks wrote: > >> In D138263#3936007 , @owenpan >> wrote

[PATCH] D138263: [clang-format] Supress aligning of trailing namespace comments

2022-11-18 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Something like the following: diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index 87515372046d..3dc5e411df55 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -98,6 +98,8 @@ namespace format {

[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros

2022-11-18 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D137181#3935951 , @owenpan wrote: > In D137181#3935856 , @goldstein.w.n > wrote: > >> I could remove either the `PPDIS_BeforeHash` or `PPDIS_AfterHash` though as >> the they really no

[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros

2022-11-18 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137181/new/ https://reviews.llvm.org/D137181 _

[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros

2022-11-18 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D137181#3938913 , @goldstein.w.n wrote: > Anything left for me todo (can't imagine I have push access). See here . We will need your name and email. Repository:

[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: HazardyKnusperkeks, MyDeveloperDay, rymiel. owenpan added a project: clang-format. Herald added a project: All. owenpan requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Fixes https://gi

[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 476719. owenpan added a comment. Added a test case. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138371/new/ https://reviews.llvm.org/D138371 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unitt

[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros

2022-11-19 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG92bccf5d3d21: [clang-format] Don't use PPIndentWidth inside multi-line macros (authored by goldstein.w.n, committed by owenpan). Repository: rG LL

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-20 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/WhitespaceManager.cpp:1433 // assert((int)C.StartOfTokenColumn >= C.Spaces); - appendIndentText( - ReplacementText, C.Tok->IndentLevel, std::max(0, C.Spaces), - std::max((int)C.StartOfTokenC

[PATCH] D138234: [clang-format] Support new file formatting with vim

2022-11-21 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138234/new/ https://reviews.llvm.org/D138234 _

[PATCH] D138371: [clang-format] Fix a crash due to dereferencing null MatchingParen

2022-11-21 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG4daeb8c73354: [clang-format] Fix a crash due to dereferencing null MatchingParen (authored by owenpan). Repository: rG LLVM Github Monorepo CHANG

[PATCH] D138402: [clang-format] Correctly count a tab's width in a comment

2022-11-21 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTestComments.cpp:736 + "//* 0.2)", + "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth() * 0.2)"); } ``` error: reference to type 'const clang::format::FormatStyle' could no

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-21 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/WhitespaceManager.cpp:1434-1436 + if (Style.UseTab == FormatStyle::UT_Never) { +ReplacementText.append(Spaces, ' '); + } else { HazardyKnusperkeks wrote: > owenpan wrote: > > Doing this

[PATCH] D138402: [clang-format] Correctly count a tab's width in a comment

2022-11-22 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTestComments.cpp:736 + "//* 0.2)", + "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth() * 0.2)"); } HazardyKnusperkeks wrote: > owenpan wrote: > > ``` > > error: reference

[PATCH] D138402: [clang-format] Correctly count a tab's width in a comment

2022-11-22 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTestComments.cpp:736 + "//* 0.2)", + "//\t\t\t\tofMap(message.velocity, 0, 127, 0, ofGetWidth() * 0.2)"); } owenpan wrote: > HazardyKnusperkeks wrote: > > owenpan wrote: > > > ```

[PATCH] D138402: [clang-format] Correctly count a tab's width in a comment

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. Thanks for unstacking it! Comment at: clang/unittests/Format/FormatTestComments.cpp:66-67 const FormatStyle &Style = getLLVMStyle()) { EXPECT_EQ(Code.str(), format(Code, Style)) << "Expected code

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. I ran (on macOS Ventura) the release build of clang-format 8627811 on the entire clang codebase and saw only a 0.12% reduction in runtime, which is what I expected. | | Run 1 | Run 2 |

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. To my surprise, tools/clang/unittests/Format/FormatTests with the patch ran a little bit slower: | | Run 1 | Run 2 | Run 3 | Average | | w/o patch | 2707ms | 2697ms | 2710ms | 2705ms | | w/ patch | 2720ms | 2719ms | 2724ms | 2721ms | CHANGES SINCE LAST

[PATCH] D139029: [clang-format] Don't move comments if AlignTrailingComments: Kind: Leave

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. Please mark comments as done if you have addressed them. Comment at: clang/unittests/Format/FormatTestComments.cpp:3071 +"\n" +"// comment\n", +format("// do not touch\n" --

[PATCH] D139029: [clang-format] Don't move comments if AlignTrailingComments: Kind: Leave

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGad83bead3d42: [clang-format] Don't move comments if AlignTrailingComments: Leave (authored by mairacanal, committed by owenpan). Repository: rG LL

[PATCH] D138358: [clang-format] Match all block braces

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. This wouldn't work for deeply nested loops: $ cat test.cpp for (;;) { for (;;) { for (;;) { a; } } } $ clang-format -style='{RemoveBracesLLVM: true}' test.cpp for (;;) for (;;) for (;;) a; Expected output: for (;

[PATCH] D139257: [clang-format][NFC] Link braces of a block in UnwrappedLineParser

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: HazardyKnusperkeks, MyDeveloperDay, rymiel, klimek. owenpan added a project: clang-format. Herald added a project: All. owenpan requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This inc

[PATCH] D138358: [clang-format] Match all block braces

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Please see D139257 for a different approach. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138358/new/ https://reviews.llvm.org/D138358 ___ cfe

[PATCH] D139257: [clang-format][NFC] Link braces of a block in UnwrappedLineParser

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 479884. owenpan added a comment. Updated `resetOptional()` to make resetting `Optional` more obvious. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139257/new/ https://reviews.llvm.org/D139257 Files: clang/lib/Format/UnwrappedLineParser.cpp cla

[PATCH] D138358: [clang-format] Match all block braces

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D138358#3968759 , @HazardyKnusperkeks wrote: > In D138358#3968610 , @owenpan wrote: > >> Please see D139257 for a different >> approach. > > All my

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. The refactoring `std::max(0, C.Spaces)` part still looks good though, but probably it's not worth it to have a patch just for that. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138378/new/ https://reviews.llvm.org/D138378 _

[PATCH] D66332: [clang-format] Fix the bug that joins template closer and > or >>

2020-03-22 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. The culprit is `AnnotatingParser::parseAngle()` in clang/lib/Format/TokenAnnotator.cpp. This commit merely uncovered it. :) Upon reading a `<` token, `parseAngle()` tries to scan the rest of the line to find a matching `>`. If found, it's given the type `TT_TemplateClos

[PATCH] D146101: [clang-format] Add DesignatedInitializerIndentWidth option.

2023-03-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Please see https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options. Is there a way to fix the issue without adding a new option? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146101/new/ h

[PATCH] D146042: [clang-format] Fix numerous issues with "LambdaBodyIndentation: OuterScope" option

2023-03-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. > The previous implementation of the option involved a hack which corrupted the > parenthesis state stack. Can you link the review (e.g. `Dnn`) of the previous implementation in the summary? > Specifically, this change fixes github issues #55708, #53212, #52846 and

[PATCH] D125171: Add a new clang-format option AlwaysBreakBeforeFunctionParameters

2023-03-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D125171#4193996 , @jrmolin wrote: > In D125171#4167866 , @owenpan wrote: > >> Please see >> https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options. >

[PATCH] D141098: [clang-format][NFC] Set LineEnding to LF in config files

2023-03-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D141098#4192785 , @mehdi_amini wrote: > In D141098#4111809 , @owenpan wrote: > >> Can we just fix the buildbot so that it runs git-clang-format with >> `--binary`? Using clang-format-

[PATCH] D146042: [clang-format] Fix numerous issues with "LambdaBodyIndentation: OuterScope" option

2023-03-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Looks like this patch doesn't put the opening brace at the outerscope for some of the examples from the linked github issues: $ cat .clang-format AllowShortLambdasOnASingleLine: None BraceWrapping: BeforeLambdaBody: true BreakBeforeBraces: Custom LambdaBody

[PATCH] D146101: [clang-format] Add DesignatedInitializerIndentWidth option.

2023-03-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D146101#4201842 , @jp4a50 wrote: > I understand the added complexity and maintenance burden of a new option but > we do meet the 3 criteria listed in your link. > > - it is part of the KJ style guide which is used by the capn

[PATCH] D146284: [clang-format] Annotate noexcept, explicit specifiers as containing expressions

2023-03-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Should we add tests to TokenAnnotatorTest.cpp? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146284/new/ https://reviews.llvm.org/D146284 ___ cfe-commits mailing list cfe-commits

[PATCH] D141811: [clang-format] Allow trailing return types in macros

2023-03-19 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:7989-7990 + verifyFormat("#define MAKE_DEF(NAME) " + "\\\n" + " auto NAME() ->

[PATCH] D143755: [clang-format] Add a space between an overloaded operator and '>'

2023-03-20 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. @kadircet thanks for reporting the crash and reverting the commit. I will fix it and reland the patch. Comment at: clang/lib/Format/TokenAnnotator.cpp:1229 + consumeToken(); +assert(CurrentToken); +auto Previous = CurrentToken-

[PATCH] D146501: [clang-format] Don't format already formatted integer literals

2023-03-21 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, HazardyKnusperkeks, rymiel. owenpan added a project: clang-format. Herald added a project: All. owenpan requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Fixes a bug in `

[PATCH] D146501: [clang-format] Don't format already formatted integer literals

2023-03-22 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D146501#4209026 , @MyDeveloperDay wrote: > Do we have any unit tests for this that we can pump a shed load of examples > at? I would need to make `checkSeparator()` public to add unit tests for it. Even then, the tests woul

<    4   5   6   7   8   9   10   11   12   13   >