[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95634)

2024-06-16 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/95634 >From 1c4ab4a5fd869de44795abd48bbaa43176e7275e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 14 Jun 2024 23:36:58 -0700 Subject: [PATCH 1/4] [clang-format] Handle AttributeMacro before access modifiers

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95634)

2024-06-16 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/95634 >From 1c4ab4a5fd869de44795abd48bbaa43176e7275e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 14 Jun 2024 23:36:58 -0700 Subject: [PATCH 1/3] [clang-format] Handle AttributeMacro before access modifiers

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95634)

2024-06-15 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/95634 >From 1c4ab4a5fd869de44795abd48bbaa43176e7275e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 14 Jun 2024 23:36:58 -0700 Subject: [PATCH 1/2] [clang-format] Handle AttributeMacro before access modifiers

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95503)

2024-06-15 Thread Owen Pan via cfe-commits
@@ -57,7 +57,10 @@ class LevelIndentTracker { /// Update the indent state given that \p Line is going to be formatted /// next. void nextLine(const AnnotatedLine ) { -Offset = getIndentOffset(*Line.First); +const auto *Tok = Line.First; +if

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95634)

2024-06-15 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/95634 Closes #95094. >From 1c4ab4a5fd869de44795abd48bbaa43176e7275e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Fri, 14 Jun 2024 23:36:58 -0700 Subject: [PATCH] [clang-format] Handle AttributeMacro before access

[clang] [clang-format] Add DiagHandler parameter to format::getStyle() (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler parameter to format::getStyle() (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler parameter to format::getStyle() (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/91317 >From c1e0ad6ee57a95fa4321bbe91aa754167da9fb3b Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 7 May 2024 12:27:29 +0200 Subject: [PATCH 1/3] [clang-format] Add DiagHandler for getStyle function It

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/91317 >From c1e0ad6ee57a95fa4321bbe91aa754167da9fb3b Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 7 May 2024 12:27:29 +0200 Subject: [PATCH 1/2] [clang-format] Add DiagHandler for getStyle function It

[clang] [clang-format] Don't over-indent comment below unbraced body (PR #95354)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95354 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style =

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style =

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -1452,6 +1452,35 @@ TEST(ConfigParseTest, GetStyleOfSpecificFile) { ASSERT_EQ(*Style, getGoogleStyle()); } +TEST(ConfigParseTest, GetStyleOutput) { +// With output +::testing::internal::CaptureStderr(); +llvm::vfs::InMemoryFileSystem FS; +auto Style =

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; - owenca wrote: Sorry! We do

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-14 Thread Owen Pan via cfe-commits
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; - auto applyChildFormatTexts =

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-13 Thread Owen Pan via cfe-commits
@@ -1269,10 +1269,17 @@ class AnnotatingParser { if (CurrentToken && CurrentToken->is(tok::less)) { CurrentToken->setType(TT_TemplateOpener); next(); - if (!parseAngle()) + TemplateDeclarationDepth++; + if (!parseAngle()) { +

[clang] [clang-format] Handle AttributeMacro before access modifiers (PR #95503)

2024-06-13 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/95503 Closes #95094. >From 6684ed759ce118bb28e9da22be51bcfece2a1909 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Thu, 13 Jun 2024 21:25:08 -0700 Subject: [PATCH] [clang-format] Handle AttributeMacro before access

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-12 Thread Owen Pan via cfe-commits
owenca wrote: @Erich-Reitz you were on the right track. See #95354. https://github.com/llvm/llvm-project/pull/94776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't over-indent comment below unbraced body (PR #95354)

2024-06-12 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/95354 Fixes #45002. >From 02f1731d57d40e51605f667c8a0b1223b159e645 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 12 Jun 2024 22:04:17 -0700 Subject: [PATCH] [clang-format] Don't overindent comment below unbraced

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-12 Thread Owen Pan via cfe-commits
@@ -1269,10 +1269,17 @@ class AnnotatingParser { if (CurrentToken && CurrentToken->is(tok::less)) { CurrentToken->setType(TT_TemplateOpener); next(); - if (!parseAngle()) + TemplateDeclarationDepth++; + if (!parseAngle()) { +

[clang] [clang-format] Fix a bug in annotating lambda l_square (PR #95084)

2024-06-12 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in annotating lambda l_square (PR #95084)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -1591,6 +1591,12 @@ TEST_F(TokenAnnotatorTest, UnderstandsLambdas) { EXPECT_TOKEN(Tokens[15], tok::arrow, TT_TrailingReturnArrow); EXPECT_TOKEN(Tokens[17], tok::l_brace, TT_LambdaLBrace); + Tokens = annotate("auto l = [] -> struct S { return {}; };");

[clang] [clang-format] Fix a bug in annotating lambda l_square (PR #95084)

2024-06-11 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/95084 >From b89f8a5bcbf525d779565219951359162655929e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 11 Jun 2024 01:32:32 -0700 Subject: [PATCH 1/2] [clang-format] Fix a bug in annotating lambda l_square Fixes

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
https://github.com/owenca deleted https://github.com/llvm/llvm-project/pull/95025 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -584,6 +584,23 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { EXPECT_TOKEN(Tokens[20], tok::greater, TT_BinaryOperator); } +TEST_F(TokenAnnotatorTest, UnderstandsTemplateTemplateParameters) { + auto Tokens = annotate("template typename X,\n" +

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -584,6 +584,23 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { EXPECT_TOKEN(Tokens[20], tok::greater, TT_BinaryOperator); } +TEST_F(TokenAnnotatorTest, UnderstandsTemplateTemplateParameters) { + auto Tokens = annotate("template typename X,\n" +

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -584,6 +584,23 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { EXPECT_TOKEN(Tokens[20], tok::greater, TT_BinaryOperator); } +TEST_F(TokenAnnotatorTest, UnderstandsTemplateTemplateParameters) { + auto Tokens = annotate("template typename X,\n" +

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -1269,10 +1269,17 @@ class AnnotatingParser { if (CurrentToken && CurrentToken->is(tok::less)) { CurrentToken->setType(TT_TemplateOpener); next(); - if (!parseAngle()) + TemplateDeclarationDepth++; + if (!parseAngle()) { +

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -1269,10 +1269,17 @@ class AnnotatingParser { if (CurrentToken && CurrentToken->is(tok::less)) { CurrentToken->setType(TT_TemplateOpener); next(); - if (!parseAngle()) + TemplateDeclarationDepth++; + if (!parseAngle()) { +

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -127,7 +127,7 @@ class AnnotatingParser { SmallVector ) : Style(Style), Line(Line), CurrentToken(Line.First), AutoFound(false), IsCpp(Style.isCpp()), LangOpts(getFormattingLangOpts(Style)), -Keywords(Keywords), Scopes(Scopes) { +

[clang] [clang-format] Don't count template template parameter as declaration (PR #95025)

2024-06-11 Thread Owen Pan via cfe-commits
@@ -584,6 +584,23 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { EXPECT_TOKEN(Tokens[20], tok::greater, TT_BinaryOperator); } +TEST_F(TokenAnnotatorTest, UnderstandsTemplateTemplateParameters) { + auto Tokens = annotate("template typename X,\n" +

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-11 Thread Owen Pan via cfe-commits
owenca wrote: @mydeveloperday requested it. See https://github.com/llvm/llvm-project/pull/91317#pullrequestreview-2095010527. There are calls to `getStyle()` in `ConfigParseTest.cpp`. Maybe add a test there? https://github.com/llvm/llvm-project/pull/91317

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-11 Thread Owen Pan via cfe-commits
owenca wrote: > Am I right that no one has a major issue with the patch? So fixing the > "const" issue and adding a unit test will let that in? Can you add a unit test? https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list

[clang] [clang-format] Fix a bug in annotating lambda l_square (PR #95084)

2024-06-11 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/95084 Fixes #95072. >From b89f8a5bcbf525d779565219951359162655929e Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 11 Jun 2024 01:32:32 -0700 Subject: [PATCH] [clang-format] Fix a bug in annotating lambda l_square

[clang] [clang-format] Fix a bug in indenting lambda trailing arrows (PR #94560)

2024-06-10 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94560 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in indenting lambda trailing arrows (PR #94560)

2024-06-10 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/94560 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in indenting lambda trailing arrows (PR #94560)

2024-06-10 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/94560 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] fix incorrectly indents lambda trailing return (PR #94560)

2024-06-09 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/94560 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-06-09 Thread Owen Pan via cfe-commits
owenca wrote: > See [#93635 > (comment)](https://github.com/llvm/llvm-project/issues/93635#issuecomment-2138778128). @khei4 maybe an `enum` for `SpaceInEmptyBraces` with `Always`, `Never`, and `Custom`. (IMO `Leave` doesn't make sense.) With `Custom`, a list of boolean suboptions e.g.

[clang] [clang-format] add an option to insert a space only for non-code block empty braces, not for empty parentheses (PR #93634)

2024-06-09 Thread Owen Pan via cfe-commits
@@ -1864,7 +1894,11 @@ FormatStyle getWebKitStyle() { Style.ObjCSpaceAfterProperty = true; Style.PointerAlignment = FormatStyle::PAS_Left; Style.SpaceBeforeCpp11BracedList = true; - Style.SpaceInEmptyBlock = true; + Style.SpaceInEmptyBraces = FormatStyle::SIEBO_Custom;

[clang] [clang-format] fix incorrectly indents lambda trailing return (PR #94560)

2024-06-09 Thread Owen Pan via cfe-commits
owenca wrote: > Technically also applies to attributes applied to the return type of the > lambda, i.e. > > ``` > int main() { > very_long_function_name_yes_it_is_really_long( > // also happens with constexpr specifier > [](auto n) [[attribute]] > -> std::enable_if_t< >

[clang] [clang-format] fix incorrectly indents lambda trailing return (PR #94560)

2024-06-09 Thread Owen Pan via cfe-commits
@@ -22858,6 +22858,36 @@ TEST_F(FormatTest, FormatsLambdas) { " //\n" "});"); + FormatStyle LLVMStyle = getLLVMStyleWithColumns(60); + + verifyFormat("int main() {\n" + " very_long_function_name_yes_it_is_really_long(\n" + "

[clang] [clang-format] fix incorrectly indents lambda trailing return (PR #94560)

2024-06-09 Thread Owen Pan via cfe-commits
@@ -1457,6 +1457,11 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState ) { !Current.isOneOf(tok::colon, tok::comment)) { return ContinuationIndent; } + if (Current.is(TT_TrailingReturnArrow) && + Previous.isOneOf(tok::kw_noexcept,

[clang] [clang-format] fix incorrectly indents lambda trailing return (PR #94560)

2024-06-09 Thread Owen Pan via cfe-commits
@@ -22858,6 +22858,36 @@ TEST_F(FormatTest, FormatsLambdas) { " //\n" "});"); + FormatStyle LLVMStyle = getLLVMStyleWithColumns(60); + + verifyFormat("int main() {\n" + " very_long_function_name_yes_it_is_really_long(\n" + "

[clang] [clang-format] fix incorrectly indents lambda trailing return (PR #94560)

2024-06-09 Thread Owen Pan via cfe-commits
@@ -22858,6 +22858,36 @@ TEST_F(FormatTest, FormatsLambdas) { " //\n" "});"); + FormatStyle LLVMStyle = getLLVMStyleWithColumns(60); + + verifyFormat("int main() {\n" + " very_long_function_name_yes_it_is_really_long(\n" + "

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-09 Thread Owen Pan via cfe-commits
owenca wrote: This patch formats ``` void f() { if (foo) bar(); // Comment #if BAZ baz(); #endif } ``` to ``` void f() { if (foo) bar(); // Comment #if BAZ baz(); #endif } ``` The trailing comment shouldn't be wrapped. https://github.com/llvm/llvm-project/pull/94776

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -796,6 +796,24 @@ TEST_F(FormatTestComments, ParsesCommentsAdjacentToPPDirectives) { format("namespace {}\n /* Test */#define A")); } + +TEST_F(FormatTestComments, DeIdentsCommentBeforeIfdefAfterBracelessIf) { + EXPECT_EQ("void f() {\n"

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -338,6 +338,9 @@ class UnwrappedLineParser { // `decltype(auto)`. bool IsDecltypeAutoFunction = false; + // Current nesting depth within unbraced codeblocks. owenca wrote: ```suggestion // Nesting depth of unbraced body of a control statement. ```

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -4811,8 +4813,11 @@ void UnwrappedLineParser::readToken(int LevelDifference) { (!Style.isVerilog() || Keywords.isVerilogPPDirective(*Tokens->peekNextToken())) && FirstNonCommentOnLine) { - distributeComments(Comments, FormatTok); -

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/94776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -796,6 +796,44 @@ TEST_F(FormatTestComments, ParsesCommentsAdjacentToPPDirectives) { format("namespace {}\n /* Test */#define A")); } +TEST_F(FormatTestComments, DeIdentsCommentBeforeIfdefAfterBracelessIf) { + verifyFormat("void f() {\n" +

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
@@ -4828,7 +4833,10 @@ void UnwrappedLineParser::readToken(int LevelDifference) { PPBranchLevel > 0) { Line->Level += PPBranchLevel; } - flushComments(isOnNewLine(*FormatTok)); + + if (!UnbracedBodyDepth) owenca wrote:

[clang] [clang-format] Fix bad comment indentation before ifdef after braceless if (PR #94776)

2024-06-08 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: What happens if the comment is unindented, with and without an empty line below it? https://github.com/llvm/llvm-project/pull/94776 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-06-06 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/92617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format][NFC] Remove an else after a return statement (PR #94548)

2024-06-06 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in `AlignAfterOpenBracket: DontAlign` (PR #94561)

2024-06-06 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format][NFC] Remove an else after a return statement (PR #94548)

2024-06-06 Thread Owen Pan via cfe-commits
owenca wrote: It means "No Functional Change". See [here](https://llvm.org/docs/Lexicon.html#n). https://github.com/llvm/llvm-project/pull/94548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-format][NFC] Remove an else after a return statement (PR #94548)

2024-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/94548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] remove redundant else statement (PR #94548)

2024-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/94548 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix a bug in `AlignAfterOpenBracket: DontAlign` (PR #94561)

2024-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/94561 Fixes #94555. >From f5a4cd0df1df390166adb8400e21894a0f2db18f Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Wed, 5 Jun 2024 19:18:19 -0700 Subject: [PATCH] [clang-format] Fix a bug in `AlignAfterOpenBracket:

[clang] [clang-format] Don't format comments in SkipMacroDefinitionBody (PR #94425)

2024-06-05 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94425 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Don't format comments in SkipMacroDefinitionBody (PR #94425)

2024-06-04 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/94425 Fixes #94326. >From 7e4c3e6b5b77085f795d6ccdfbf7279e32741b16 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Tue, 4 Jun 2024 21:10:14 -0700 Subject: [PATCH] [clang-format] Don't format comments in

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -3945,20 +3945,23 @@ const char *DefaultFallbackStyle = "LLVM"; llvm::ErrorOr> loadAndParseConfigFile(StringRef ConfigFile, llvm::vfs::FileSystem *FS, - FormatStyle *Style, bool AllowUnknownOptions) { + FormatStyle *Style, bool

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -4026,12 +4030,13 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; + auto diagHandlerOrDropHandling = +

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -4026,12 +4030,13 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; + auto diagHandlerOrDropHandling = +

[clang] [clang-format] Allow open brace with trailing comment (no line break) (PR #89956)

2024-06-04 Thread Owen Pan via cfe-commits
owenca wrote: > @owenca Re. draft status: I thought a draft would be a better way (less > presumptuous, more tentative suggestion) to present one particular solution, > while acknowledging the possibility of alternatives. If that's not really the > way a draft is used or if it's more of a

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-06-04 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Do we need all these new test cases? If yes, consider moving the test (and other `ConfigurableSpacesIn...` tests) to a separate file. https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -4681,23 +4695,30 @@ struct FormatStyle { bool InEmptyParentheses; /// Put a space in parentheses not covered by preceding options. /// \code -///true: false: -///t f( Deleted & ) & = delete; vs. t f(Deleted

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -1175,8 +1176,8 @@ template <> struct MappingTraits { (SpacesInParentheses || SpaceInEmptyParentheses || SpacesInConditionalStatement || SpacesInCStyleCastParentheses)) { if (SpacesInParentheses) { -// set all options except InCStyleCasts and

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-06-04 Thread Owen Pan via cfe-commits
@@ -4650,10 +4650,23 @@ struct FormatStyle { /// # Should be declared this way: /// SpacesInParens: Custom /// SpacesInParensOptions: + /// ExceptDoubleParentheses: false /// InConditionalStatements: true /// Other: true /// \endcode struct

[clang] [clang-format] Add SpacesInParensOption for filtering repeated parens (PR #77522)

2024-06-04 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Allow open brace with trailing comment (no line break) (PR #89956)

2024-06-03 Thread Owen Pan via cfe-commits
owenca wrote: IMO breaking before a trailing comment is a bug. Can we fix it without adding an option? If not, we should add one (e.g. `BreakBeforeTrailingComment`) instead of using `AlignTrailingComments`. https://github.com/llvm/llvm-project/pull/89956

[clang] [clang-format] Allow open brace with trailing comment (no line break) (PR #89956)

2024-06-03 Thread Owen Pan via cfe-commits
owenca wrote: > > Ping > > Your PR is a draft, otherwise it would have been auto tagged and reviewers > would be informed. @GertyP can you remove the Draft status? https://github.com/llvm/llvm-project/pull/89956 ___ cfe-commits mailing list

[clang] [clang-format] Handle AttributeMacros in parseRecord() (PR #94189)

2024-06-03 Thread Owen Pan via cfe-commits
owenca wrote: > As noted in the issue, I think it should also keep working without the > attribute macro. (I'd be fine with the all upper case is a macro heuristic.) See https://github.com/llvm/llvm-project/issues/94184#issuecomment-2146557923. https://github.com/llvm/llvm-project/pull/94189

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Owen Pan via cfe-commits
@@ -4026,12 +4030,13 @@ Expected getStyle(StringRef StyleName, StringRef FileName, // Reset possible inheritance Style.InheritsParentConfig = false; - auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; + auto diagHandlerOrDropHandling = +

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Owen Pan via cfe-commits
https://github.com/owenca commented: Can you call `parseConfiguration()` instead of `getStyle()` in QtCreator while the user is entering code? It seems inefficient to call `getStyle()` all the time. https://github.com/llvm/llvm-project/pull/91317

[clang] [clang-format] Add DiagHandler for getStyle function (PR #91317)

2024-06-03 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle AttributeMacros in parseRecord() (PR #94189)

2024-06-03 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94189 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] f4a7f81 - [clang-format][doc] Minor cleanup

2024-06-03 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-06-03T01:04:05-07:00 New Revision: f4a7f81a914ca8aceddd9b7a71e36bb0828ae052 URL: https://github.com/llvm/llvm-project/commit/f4a7f81a914ca8aceddd9b7a71e36bb0828ae052 DIFF: https://github.com/llvm/llvm-project/commit/f4a7f81a914ca8aceddd9b7a71e36bb0828ae052.diff

[clang] [clang-format] Handle AttributeMacros in parseRecord() (PR #94189)

2024-06-03 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/94189 Fixes #94184. >From 45c818098c1eedd72b82e9b5362538e2781698ab Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Mon, 3 Jun 2024 00:40:18 -0700 Subject: [PATCH] [clang-format] Handle AttributeMacros in parseRecord()

[clang] d7d2d4f - [clang-format] Fix documentation build error

2024-06-02 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-06-02T18:03:12-07:00 New Revision: d7d2d4f53fc79b4b58e8d8d08151b577c3699d4a URL: https://github.com/llvm/llvm-project/commit/d7d2d4f53fc79b4b58e8d8d08151b577c3699d4a DIFF: https://github.com/llvm/llvm-project/commit/d7d2d4f53fc79b4b58e8d8d08151b577c3699d4a.diff

[clang] 2fbc9f2 - [clang-format][doc] Clean up quotes, etc.

2024-06-02 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-06-02T16:45:17-07:00 New Revision: 2fbc9f217e5fe8db8444a87dbd7138a768b8aa85 URL: https://github.com/llvm/llvm-project/commit/2fbc9f217e5fe8db8444a87dbd7138a768b8aa85 DIFF: https://github.com/llvm/llvm-project/commit/2fbc9f217e5fe8db8444a87dbd7138a768b8aa85.diff

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-02 Thread Owen Pan via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState , bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It would

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-02 Thread Owen Pan via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState , bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It would

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-02 Thread Owen Pan via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState , bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It would

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/88265 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Allow raw string literals in C as an extension (PR #88265)

2024-06-02 Thread Owen Pan via cfe-commits
@@ -3850,6 +3850,7 @@ LangOptions getFormattingLangOpts(const FormatStyle ) { // the sequence "<::" will be unconditionally treated as "[:". // Cf. Lexer::LexTokenInternal. LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; + LangOpts.RawStringLiterals = LexingStd

[clang] f06f016 - [clang-format][NFC] Add missing parens of __attribute in unit tests

2024-06-02 Thread Owen Pan via cfe-commits
Author: Owen Pan Date: 2024-06-02T12:44:40-07:00 New Revision: f06f0164199d4a968d8336937cd5ef2c05946d8d URL: https://github.com/llvm/llvm-project/commit/f06f0164199d4a968d8336937cd5ef2c05946d8d DIFF: https://github.com/llvm/llvm-project/commit/f06f0164199d4a968d8336937cd5ef2c05946d8d.diff

[clang] [clang-format] Handle attributes before lambda return arrow (PR #94119)

2024-06-02 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/94119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle attributes before lambda return arrow (PR #94119)

2024-06-01 Thread Owen Pan via cfe-commits
owenca wrote: > Do we want a token annotator test? The bug was in the unwrapped line parser, but it doesn't hurt to add an annotator test. https://github.com/llvm/llvm-project/pull/94119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-format] Handle attributes before lambda return arrow (PR #94119)

2024-06-01 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/94119 >From 0ef24a51b4f831c49efe956662764f0b2c2cca61 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 1 Jun 2024 12:53:08 -0700 Subject: [PATCH 1/2] [clang-format] Handle attributes before lambda return arrow Fixes

[clang] [clang-format] Handle attributes before lambda return arrow (PR #94119)

2024-06-01 Thread Owen Pan via cfe-commits
https://github.com/owenca created https://github.com/llvm/llvm-project/pull/94119 Fixes #92657. >From 0ef24a51b4f831c49efe956662764f0b2c2cca61 Mon Sep 17 00:00:00 2001 From: Owen Pan Date: Sat, 1 Jun 2024 12:53:08 -0700 Subject: [PATCH] [clang-format] Handle attributes before lambda return

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-31 Thread Owen Pan via cfe-commits
owenca wrote: We should backport it to 18.1.7 IMO. See #93034 and #93958. WDYT @mydeveloperday @HazardyKnusperkeks? https://github.com/llvm/llvm-project/pull/92214 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-31 Thread Owen Pan via cfe-commits
owenca wrote: /cherry-pick https://github.com/llvm/llvm-project/commit/8fe39e64c0ef0a1aefce3c1187c5822343caeedd https://github.com/llvm/llvm-project/pull/92214 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang-format] Don't always break before << between string literals (PR #92214)

2024-05-31 Thread Owen Pan via cfe-commits
https://github.com/owenca milestoned https://github.com/llvm/llvm-project/pull/92214 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Insert a space between a keyword and a literal (PR #93632)

2024-05-30 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/93632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add option to remove leading blank lines (PR #91221)

2024-05-30 Thread Owen Pan via cfe-commits
owenca wrote: Please refer to e3eca335940251308c8990c8880341002e74b9c1 for grouping/deprecating existing options with a new one. https://github.com/llvm/llvm-project/pull/91221 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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