[PATCH] D66384: [clang-format] Fix a bug that joins template closer and =

2019-08-18 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:6631 + verifyFormat("a = 1;", Style); + verifyFormat("a >>= 1;", Style); Quuxplusone wrote: > Actually, could you add a test case specif

[PATCH] D66384: [clang-format] Fix a bug that joins template closer and =

2019-08-18 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL369214: [clang-format] Fix a bug that joins template closer and = (authored by owenpan, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: ht

[PATCH] D67395: [clang-format] Apply BAS_AlwaysBreak to C++11 braced lists

2019-09-10 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: sammccall, MyDeveloperDay, klimek. Herald added a project: clang. Herald added a subscriber: cfe-commits. owenpan added a reviewer: djasper. See PR18455 and this message

[PATCH] D67395: [clang-format] Apply BAS_AlwaysBreak to C++11 braced lists

2019-09-10 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL371571: [clang-format] Apply BAS_AlwaysBreak to C++11 braced lists (authored by owenpan, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: h

[PATCH] D67888: [clang-format] NFC clang-format the clang-format unit tests

2019-09-22 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. I suppose the .clang-format file you used only had `BasedOnStyle: LLVM` in it. Did you run clang-format the second time to ensure that the formatted file was stable? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67888/new/ https://reviews.llvm.org/D67888 __

[PATCH] D67888: [clang-format] NFC clang-format the clang-format unit tests

2019-09-23 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. Thanks! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67888/new/ https://reviews.llvm.org/D67888 ___ cfe-commits mailing list cfe-comm

[PATCH] D68767: [clang-format] NFC - Move functionality into functions to help code structure

2019-10-11 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/tools/clang-format/ClangFormat.cpp:245 +// Returns an invalid BOM +static const char *hasInValidBOM(StringRef BufStr) { + // Check to see if the buffer has a UTF Byte Order Mark (BOM). owenpan wrote: > This code w

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Thank you for taking care of this! When I fixed a bug in this part of the code last time, I had to do it in both files. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68914/new/ https://reviews.llvm.org/D68914 _

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/include/clang/Basic/SourceManager.h:232 +// nullptr +static const char *getInvalidBOM(StringRef BufStr); }; Can you make the parameter `const`? Comment at: clang/lib/Basic/SourceManage

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/include/clang/Basic/SourceManager.h:232 +// nullptr +static const char *getInvalidBOM(StringRef BufStr); }; klimek wrote: > owenpan wrote: > > Can you make the parameter `const`? > StringRef is inherentl

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Here are some `const StringRef &` examples . CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68914/new/ https://reviews.llvm.org/D68914 ___

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. I did a quick search of the LLVM code base and found dozens of `const StringRef &`, including the `Twine` API . CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68914/new/ https:

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-17 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Thanks for clearing it up! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68914/new/ https://reviews.llvm.org/D68914 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-23 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 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68914/new/ https://reviews.llvm.org/D68914 ___ cfe-commits mailing list cfe-commits

[PATCH] D132719: [clang-format] Rework removeBraces() in Format.cpp

2022-08-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/Format.cpp:1914 - assert(Token->isOneOf(tok::l_brace, tok::r_brace)); - assert(Token->Previous || Token == Line->First); - const FormatToken *Next = Token->Next; owenpan wrote:

[PATCH] D132719: [clang-format] Rework removeBraces() in Format.cpp

2022-08-27 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG44a06b51b2ce: [clang-format] Rework removeBraces() in Format.cpp (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132719/new/ https://re

[PATCH] D132805: [clang-format] Fix a bug in removing braces for the LLVM style

2022-08-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, HazardyKnusperkeks, curdeius. 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. When an l_brac

[PATCH] D132762: [clang-format] Allow `throw` to be a keyword in front of casts

2022-08-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. We should add a test case for `TT_CastRParen` in `clang/unittests/Format/TokenAnnotatorTest.cpp`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132762/new/ https://reviews.llvm.org/D132762

[PATCH] D132805: [clang-format] Fix a bug in removing braces for the LLVM style

2022-08-28 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 rGf00f2b3e8d40: [clang-format] Fix a bug in removing braces for the LLVM style (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES S

[PATCH] D132762: [clang-format] Allow `throw` to be a keyword in front of casts

2022-08-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. In D132762#3756072 , @rymiel wrote: > Add a few token annotator tests Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132762/new/ https://rev

[PATCH] D132905: [clang-format] Fix a bug in inserting braces at trailing comments

2022-08-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, HazardyKnusperkeks, curdeius. 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. If the style w

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2375-2378 +const FormatToken *Prev = PrevToken; +if (Prev->is(tok::r_square) && (Prev = Prev->getPreviousNonComment()) && +Prev->is(tok::l_square) && (Prev = Prev->getPreviousNonComment

[PATCH] D132911: [clang-format] Fix annotating when deleting array of pointers

2022-08-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. Please mark https://reviews.llvm.org/D132911#inline-1279832 as done. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132911/new/ https://reviews.llvm.org/D132911 __

[PATCH] D132905: [clang-format] Fix a bug in inserting braces at trailing comments

2022-08-30 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGbc10ab8da1b5: [clang-format] Fix a bug in inserting braces at trailing comments (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132905/n

[PATCH] D133093: [clang-format] Fix a bug in merging blocks with a wrapped l_brace

2022-08-31 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: HazardyKnusperkeks, MyDeveloperDay, curdeius. 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. When the openi

[PATCH] D133093: [clang-format] Fix a bug in merging blocks with a wrapped l_brace

2022-09-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:716 +auto IsCtrlStmt = [](const auto &Line) { + return Line.First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while, + tok::kw_do, tok::kw_for, TT_ForEac

[PATCH] D123450: [clang-format] Parse Verilog if statements

2022-09-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2592 - if (FormatTok->is(tok::l_brace)) { + if (Keywords.isBlockBegin(*FormatTok, Style)) { FormatTok->setFinalizedType(TT_ControlStatementLBrace); This is likely the cul

[PATCH] D133087: [clang-format][NFC][Docs] fix wrong example of warping class definitions

2022-09-02 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133087/new/ https://reviews.llvm.org/D133087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[PATCH] D123450: [clang-format] Parse Verilog if statements

2022-09-02 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/FormatToken.h:1550 + bool isBlockBegin(const FormatToken &Tok, const FormatStyle &Style) const { +return Tok.is(TT_MacroBlockBegin) || + (Style.isVerilog() ? isVerilogBegin(Tok) : Tok.is(tok::l_brace)); --

[PATCH] D123450: [clang-format] Parse Verilog if statements

2022-09-02 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2592 - if (FormatTok->is(tok::l_brace)) { + if (Keywords.isBlockBegin(*FormatTok, Style)) { FormatTok->setFinalizedType(TT_ControlStatementLBrace); owenpan wrote: > This

[PATCH] D133093: [clang-format] Fix a bug in merging blocks with a wrapped l_brace

2022-09-02 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG92d8738c3844: [clang-format] Fix a bug in merging blocks with a wrapped l_brace (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133093/n

[PATCH] D133571: [clang-format] Introduce NoFallThrough option into AllowShortCaseLabelsOnASingleLine

2022-09-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:567 return Style.AllowShortCaseLabelsOnASingleLine - ? tryMergeShortCaseLabels(I, E, Limit) + ? tryMergeShortCaseLabels(I, E, Limit, PreviousLine, Style)

[PATCH] D133589: [clang-format] JSON formatting add new option for controlling newlines in json arrays

2022-09-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:4405-4408 if (Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && !Right.is(tok::r_square)) { - return true; + if (Right.is(tok::l_brace)) +return true; ---

[PATCH] D133635: [clang-format] Don't insert braces for loops with a null statement

2022-09-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, curdeius, HazardyKnusperkeks. 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 is a work

[PATCH] D133589: [clang-format] JSON formatting add new option for controlling newlines in json arrays

2022-09-12 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/TokenAnnotator.cpp:4403-4404 +// Always break after a JSON array opener based on BreakArrays. if (Left.is(TT_ArrayInitializerLSqua

[PATCH] D133635: [clang-format] Don't insert braces for loops with a null statement

2022-09-12 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D133635#378 , @MyDeveloperDay wrote: > Can't tell you how much I love this `InsertBraces` feature @owenpan, I work > for a team (with a large code base) that uses them all the time, and we are > catching missing braces

[PATCH] D133635: [clang-format] Don't insert braces for loops with a null statement

2022-09-12 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG5889ed83a0ff: [clang-format] Don't insert braces for loops with a null statement (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133635/

[PATCH] D133647: [clang-format] Parse the else part of `#if 0`

2022-09-13 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. Thanks! Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1128 +// If the first branch is unreachable, set the BranchIndex to 1. This way +// the next branch it

[PATCH] D133635: [clang-format] Don't insert braces for loops with a null statement

2022-09-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:25370 + "#if 0\n" + " if (a) {\n" + "#else\n" sstwcw wrote: > Can you confirm that there is supposed to be only one space here while there

[PATCH] D129926: [clang-format] Handle constructor invocations after new operator in C# correct

2022-09-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D129926#3769542 , @curdeius wrote: > @eoanermine, please provide your name and email address for the commit > message. We can use "Danil Sidoruk " as I did in d8d331bc9710

[PATCH] D156370: [clang-format] Fix bug with parsing of function/variable names.

2023-11-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:-2224 if (PreviousNotConst->is(tok::r_paren) && -PreviousNotConst->is(TT_TypeDeclarationParen)) { +(PreviousNotConst->isOneOf(TT_TypeDeclaration

[PATCH] D154755: [clang-format] Fix formatting of if statements with BlockIndent

2023-11-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ContinuationIndenter.cpp:773-792 if ((Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak || Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent) && (Previous.isOneOf(tok::l_paren, TT_Te

[PATCH] D154755: [clang-format] Fix formatting of if statements with BlockIndent

2023-11-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:25814-25824 + " if (quitelongname < alsolongname ||\n" + " anotherevenlongername <=\n" + " thisreallyreallyreallyreallyreallyreallylongername

[PATCH] D156360: [clang-format] Support function and overloaded operator SpacesInParensOption

2023-11-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:3970-4009 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { if (Right.is(TT_CastRParen) || (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) { return Style.Spa

[PATCH] D155529: [clang-format] Add SpaceInParensOption for __attribute__ keyword

2023-11-09 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. In D155529#4509686 , @MyDeveloperDay wrote: > We should never make assumptions about what people do/don't use > If you have this you ha

[PATCH] D156370: [clang-format] Fix bug with parsing of function/variable names.

2023-11-13 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa852869398af: [clang-format] Fix a bug in parsing function/variable names (authored by gedare, committed by owenpan). Changed prior to commit: https://reviews.llvm.org/D156370?vs=558061&id=558088#toc R

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-11-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Thank you for your patience! There are still a few comments not done from the previous round. In D150083#4655528 , @owenpan wrote: > See also D153228 . Would this patch have a similar performan

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-11-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. BTW, it may be simpler and more efficient to use a set (e.g. `llvm::SmallSet`) for `Indices`, especially if we don't need/want to handle duplicate attributes that have a value. (See D150083#inline-1551778 .) CHANGES SIN

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-11-22 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 except the final nits. Comment at: clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp:48 +const FormatToken *BeginTok, const FormatToken *EndTok) const { + // I

[PATCH] D71659: [clang-format] Added new option to allow setting spaces before and after the operator

2023-10-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan commandeered this revision. owenpan edited reviewers, added: Luis; removed: owenpan. Herald added a project: All. Herald added reviewers: rymiel, HazardyKnusperkeks. Herald added a comment. NOTE: Clang-Format Team Automated Review Comment Your review contains a change to clang/include/cla

[PATCH] D126132: [clang-format] Fix a crash on lambda trailing return type

2023-10-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Herald added a reviewer: rymiel. In D126132#3546767 , @HazardyKnusperkeks wrote: > One should define what is the difference between `TT_LambdaArrow` and > `TT_TrailingReturnArrow`. But if there is a difference, then the lambda

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-10-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D150083#4655479 , @jaredgrubb wrote: > Should I open a GitHub issue for this patch? That'd be great. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150083/new/ https://reviews.llvm.org/D150083 _

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-10-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. See also D153228 . Comment at: clang/include/clang/Format/Format.h:3204 + /// \warning + /// Setting this option to ``true`` could lead to incorrect code formatting + /// due to clang-format's lack of complete sema

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-10-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp:104 + // for missing values. + auto sortIndex = [&](const StringRef &needle) -> unsigned { +auto i = SortOrderMap.find(needle); owenpan wrote: > owenpan wrote: >

[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes

2023-10-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp:184 + for (AnnotatedLine *Line : AnnotatedLines) { +if (!Line->Affected || Line->InPPDirective) + continue; Why not `InPPDirective`? CHANGES SINCE LAST ACT

[PATCH] D128607: [clang-format] NFC Fix uninitialized memory problem

2022-06-26 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added a comment. Can you remove NFC? IMO, fixing a memory error is not NFC. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128607/new/ https://reviews.llvm.org/D128607

[PATCH] D128574: [clang-format] Quit analyzing solution space for large state count

2022-06-26 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG664ce34e81d9: [clang-format] Quit analyzing solution space for large state count (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128574/

[PATCH] D128709: [clang-format] Handle Verilog attributes

2022-06-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1466-1471 + } else if (FormatTok->is(tok::l_paren)) { +const FormatToken *Next = Tokens->peekNextToken(); +if (Next && Next->is(tok::star)) + parseParens(); +

[PATCH] D128713: [clang-format] Handle Verilog user-defined primitives

2022-06-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:3968 + !Right.isOneOf(tok::r_paren, tok::semi)) || +(Right.is(TT_VerilogTableItem) && !Left.is(tok::l_paren))) { + const FormatToken *Next = Right.g

[PATCH] D123450: [clang-format] Parse Verilog if statements

2022-07-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. `clang/docs/ClangFormatStyleOptions.rst` was out of sync because `dump_format_style.py` had not been run. Fixed in cc55d97 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://

[PATCH] D129057: [clang-format] Break on AfterColon only if not followed by comment

2022-07-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, HazardyKnusperkeks, curdeius. 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. Break after a

[PATCH] D129057: [clang-format] Break on AfterColon only if not followed by comment

2022-07-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 442016. owenpan added a comment. Handle `PackContructorInitializers: NextLine` and address review comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129057/new/ https://reviews.llvm.org/D129057 Files: clang/lib/Format/ContinuationIndenter.cp

[PATCH] D129057: [clang-format] Break on AfterColon only if not followed by comment

2022-07-04 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D129057#3627748 , @curdeius wrote: > LGTM. Thanks for addressing my comments. Thank you for your quick review and good comments as always! Comment at: clang/unittests/Format/FormatTest.cpp:7136

[PATCH] D129057: [clang-format] Break on AfterColon only if not followed by comment

2022-07-04 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 rG47bdf53a5dba: [clang-format] Break on AfterColon only if not followed by comment (authored by owenpan). Repository: rG LLVM Github Monorepo CHANG

[PATCH] D129064: [clang-format] Avoid crash in LevelIndentTracker.

2022-07-04 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:69-70 } else { - IndentForLevel.resize(Line.Level + 1); + if (IndentForLevel.size() < Line.Level + 1) +IndentForLevel.resize(Line.Level + 1); Indent = getIndent(Li

[PATCH] D129105: [clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker

2022-07-04 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: curdeius, HazardyKnusperkeks, MyDeveloperDay. 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. Repository:

[PATCH] D129064: [clang-format] Avoid crash in LevelIndentTracker.

2022-07-05 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:62-70 while (IndentForLevel.size() <= Line.Level) IndentForLevel.push_back(-1); if (Line.InPPDirective) { unsigned IndentWidth = (Style.PPIndentWidth >= 0) ?

[PATCH] D129105: [clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker

2022-07-05 Thread Owen Pan via Phabricator via cfe-commits
owenpan updated this revision to Diff 442427. owenpan added a comment. Use `resize()` instead of `insert()`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129105/new/ https://reviews.llvm.org/D129105 Files: clang/lib/Format/UnwrappedLineFormatter.cpp Index: clang/lib/Format/Unwrapp

[PATCH] D129105: [clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker

2022-07-05 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:82-83 +if (Size <= Line.Level) + IndentForLevel.insert(IndentForLevel.end(), Line.Level - Size + 1, +UnknownIndent ? -1 : Indent); } Haz

[PATCH] D129311: [clang-format] Update return code

2022-07-07 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/tools/clang-format/git-clang-format:202 +return print_diff(old_tree, new_tree) elif opts.diffstat: +return print_diffstat(old_tree, new_tree) Comment at: clang/tools/clang-format/git-

[PATCH] D129105: [clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker

2022-07-07 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGc84d29acbfa6: [clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129105/n

[PATCH] D129348: [clang-format] Fix an assertion failure on -lines=0:n

2022-07-08 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: curdeius, HazardyKnusperkeks, MyDeveloperDay. 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. Also fixed the

[PATCH] D129348: [clang-format] Fix an assertion failure on -lines=0:n

2022-07-08 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 rG615f838f7380: [clang-format] Fix an assertion failure on -lines=0:n (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D122301: [clang-format] Fix invalid code generation with comments in lambda

2022-03-23 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf74413d16345: [clang-format] Fix invalid code generation with comments in lambda (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122301/

[PATCH] D121757: [clang-format] Take out common code for parsing blocks

2022-03-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2707-2708 + if (FormatTok->is(tok::l_brace)) { +CompoundStatementIndenter Indenter(this, Style, Line->Level); +FormatToken *LeftBrace = FormatTok; +parseBlock(); You

[PATCH] D121756: [clang-format] Clean up code looking for if statements

2022-03-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D121756#3398165 , @sstwcw wrote: > It turned out this patch does change behavior. > > - while ( > - FormatTok->isOneOf(tok::identifier, tok::kw_requires, > tok::coloncolon)) { > + while (FormatTok->isOneOf(tok::id

[PATCH] D121757: [clang-format] Take out common code for parsing blocks

2022-03-25 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D121757#3406814 , @sstwcw wrote: > I tried formatting the files in `clang-formatted-files.txt`. Besides the > files in the list that get changed when formatted with the program built from > `main`, none gets changed when I fo

[PATCH] D121757: [clang-format] Take out common code for parsing blocks

2022-03-25 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D121757#3407539 , @owenpan wrote: > In D121757#3406814 , @sstwcw wrote: > >> I tried formatting the files in `clang-formatted-files.txt`. Besides the >> files in the list that get chan

[PATCH] D122548: [clang-format] Don't format qualifiers in PPDirective

2022-03-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, curdeius, HazardyKnusperkeks. 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 #54513 <

[PATCH] D122468: [clang-format] Fix SeparateDefinitionBlocks breaking up function-try-block.

2022-03-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. We can refactor by extending `_verifyFormat()` instead of adding a new function. Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:46 const FormatStyle &Style = getLLVMStyle(),

[PATCH] D122548: [clang-format] Don't format qualifiers in PPDirective

2022-03-28 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGeee536dd3185: [clang-format] Don't format qualifiers in PPDirective (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122548/new/ https:/

[PATCH] D121757: [clang-format] Take out common code for parsing blocks NFC

2022-03-29 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D121757#3415402 , @sstwcw wrote: > I ran check-clang after formatting the entire code base with the new version. > It turned out it did break some tests. It seems to be because it messed up > these comments. > > diff --gi

[PATCH] D122756: [clang-format] Fix a crash in qualifier alignment

2022-03-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, curdeius, HazardyKnusperkeks. 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. Related to #54

[PATCH] D121756: [clang-format] Clean up code looking for if statements NFC

2022-03-31 Thread Owen Pan via Phabricator via cfe-commits
owenpan requested changes to this revision. owenpan added inline comments. This revision now requires changes to proceed. Comment at: clang/lib/Format/TokenAnnotator.cpp:252-256 +} else if (OpeningParen.isConditionLParen(/*IncludeFor=*/false) || + (OpeningParen.

[PATCH] D121756: [clang-format] Clean up code looking for if statements NFC

2022-04-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:252-256 +} else if (OpeningParen.isConditionLParen(/*IncludeFor=*/false) || + (OpeningParen.Previous && +OpeningParen.Previous->isOneOf(TT_BinaryOperator, tok::l_paren

[PATCH] D122756: [clang-format] Fix a crash in qualifier alignment

2022-04-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan closed this revision. owenpan added a comment. rG492cb7bf9164 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122756/new/ https://reviews.llvm.org/D122756 ___

[PATCH] D121757: [clang-format] Take out common code for parsing blocks NFC

2022-04-05 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/D121757/new/ https://reviews.llvm.org/D121757 _

[PATCH] D130411: [clang-format] Fix a hang when formatting C# $@ string literals

2022-07-25 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 rG0ffb3dd33ee1: [clang-format] Fix a hang when formatting C# $@ string literals (authored by owenpan). Changed prior to commit: https://reviews.llvm

[PATCH] D129311: [clang-format] Update return code

2022-07-26 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. Thanks for the explanations! LGTM. Comment at: clang/tools/clang-format/git-clang-format:539-540 # filter. - subprocess.check_call(['git', 'diff', '--diff-filter=M', ol

[PATCH] D129311: [clang-format] Fix the return code of git-clang-format

2022-07-27 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf9a2f6b6aecf: [clang-format] Fix the return code of git-clang-format (authored by sridhar_gopinath, committed by owenpan). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://review

[PATCH] D130108: git-clang-format: format index not worktree when using --staged

2022-07-28 Thread Owen Pan via Phabricator via cfe-commits
owenpan added reviewers: owenpan, curdeius, HazardyKnusperkeks, MyDeveloperDay, sridhar_gopinath. owenpan added a comment. Can you open an issue at https://github.com/llvm/llvm-project/issues? See https://github.com/llvm/llvm-project/issues/56736 for an example. Repository: rG LLVM Github Mo

[PATCH] D131360: [clang-format] Fixes crash in QualifierOrder

2022-08-07 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. It seems rG492cb7bf9164 also fixed this. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131360/new/ https://reviews.llvm.org/D131360 ___ cfe-commi

[PATCH] D130108: git-clang-format: format index not worktree when using --staged

2022-08-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/tools/clang-format/git-clang-format:182-194 new_tree = run_clang_format_and_save_to_tree(changed_lines, revision=commits[1], b

[PATCH] D130108: git-clang-format: format index not worktree when using --staged

2022-08-09 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. Please mark review comments as done if you have addressed them. Comment at: clang/tools/clang-format/git-clang-format:401 + # Copy the environment, because the files have

[PATCH] D130108: git-clang-format: format index not worktree when using --staged

2022-08-10 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG3f801e07fa82: [clang-format] git-clang-format --staged should format the index (authored by Gergely Meszaros , committed by owenpan). Repository: rG LLVM Github Monorepo

[PATCH] D106112: [clang-format] Break an unwrapped line at a K&R C parameter decl

2021-07-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: djasper, klimek, MyDeveloperDay, curdeius, HazardyKnusperkeks. owenpan added a project: clang-format. owenpan requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Break an unwrapped line b

[PATCH] D106112: [clang-format] Break an unwrapped line at a K&R C parameter decl

2021-07-17 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. In D106112#2883301 , @curdeius wrote: > Looks okay, but I was wondering if we don't want to guard all K&R-related > changes behind e.g. ```Standard: Cpp78``, so as not to possibly introduce > strange bugs in newer modes. > It ma

[PATCH] D106112: [clang-format] Break an unwrapped line at a K&R C parameter decl

2021-07-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 rG9da70ab3d43c: [clang-format] Break an unwrapped line at a K&R C parameter decl (authored by owenpan). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D120774: [clang-format] Handle builtins in constraint expression

2022-03-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:3163 +case tok::identifier: default: HazardyKnusperkeks wrote: > HazardyKnusperkeks wrote: > > owenpan wrote: > > > cjdb wrote: > > > > owenpan wrote: > > > > > Do we s

[PATCH] D121352: [clang-format] Handle "// clang-format off" for RemoveBracesLLVM

2022-03-09 Thread Owen Pan via Phabricator via cfe-commits
owenpan created this revision. owenpan added reviewers: MyDeveloperDay, curdeius, HazardyKnusperkeks. 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. Repository:

<    1   2   3   4   5   6   7   8   9   10   >