@@ -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
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/97938
None
>From eb53318b3c5dec2452c4a0d5aed7944ebdd99380 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sat, 6 Jul 2024 22:21:26 -0700
Subject: [PATCH] [clang-format][NFC] Annotate function decl l_paren
---
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/97787
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/97787
Fixes #97539.
>From 73d92b38268e5b44d6ed7e6ac9219267003cc7fb Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Thu, 4 Jul 2024 21:39:38 -0700
Subject: [PATCH] [clang-format] Skip block commented out includes when
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/93439
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed 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
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/77522
>From 4a7489251b842da778dd839bd5af3db12ba0fe0b Mon Sep 17 00:00:00 2001
From: Gedare Bloom
Date: Mon, 17 Jul 2023 18:24:30 -0600
Subject: [PATCH 1/5] Add SpaceInParensOption ExceptDoubleParentheses
This change
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/96801
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
owenca wrote:
> This patch was initially part of
> [9267f8f](https://github.com/llvm/llvm-project/commit/9267f8f19a2e502ef5a216c0d52b352b3699d399).
> I neglected to check the server builds before I added it. It broke clangd.
> Jie Fu fixed the problem in
>
https://github.com/owenca approved this pull request.
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
https://github.com/owenca approved this pull request.
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
@@ -17203,6 +17238,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("SomeType *__attribute__((attr)) *a = NULL;", Spaces);
verifyFormat("void __attribute__((naked)) foo(int bar)", Spaces);
verifyFormat("void f( ) __attribute__((asdf));", Spaces);
+
@@ -17125,6 +17125,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("SomeType *__attribute__((attr)) *a = NULL;", Spaces);
verifyFormat("void __attribute__((naked)) foo(int bar)", Spaces);
verifyFormat("void f() __attribute__((asdf));", Spaces);
+
@@ -17159,6 +17176,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("SomeType *__attribute__( ( attr ) ) *a = NULL;", Spaces);
verifyFormat("void __attribute__( ( naked ) ) foo( int bar )", Spaces);
verifyFormat("void f() __attribute__( ( asdf ) );",
@@ -17310,6 +17362,63 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces);
+
+ // Check
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
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/96396
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca approved this pull request.
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
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/96271
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/96271
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/96271
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/96271
None
>From 44eec3e8d4bec1de03428d42dce98a998f282825 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Thu, 20 Jun 2024 19:38:38 -0700
Subject: [PATCH] [clang-format] Annotate r_paren before braced list as
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/96128
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/96128
>From 420cde9e46d8eb3f3043d18cf78fbaef0f89ccbb Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Wed, 19 Jun 2024 18:07:56 -0700
Subject: [PATCH] [clang-format[NFC] Clean up
AnnotatingParser::rParenEndsCast()
---
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/96128
None
>From 04618d27f9ebd045dfae5bfc341056c483fab0d1 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Wed, 19 Jun 2024 18:07:56 -0700
Subject: [PATCH] [clang-format[NFC] Clean up
AnnotatingParser::rParenEndsCast()
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/96026
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3180,6 +3180,18 @@ TEST_F(TokenAnnotatorTest, FunctionTryBlock) {
EXPECT_TOKEN(Tokens[36], tok::l_brace, TT_FunctionLBrace);
}
+TEST_F(TokenAnnotatorTest, TypenameMacro) {
+ auto Style = getLLVMStyle();
+ Style.TypenameMacros.push_back("STRUCT");
+
+ auto Tokens =
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/96026
Closes #95418.
>From cc4cd4d9e7eea3ba670a29a053d18739b40058ab Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Tue, 18 Jun 2024 22:29:53 -0700
Subject: [PATCH] [clang-format] Correctly annotate l_brace after
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95878
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca updated
https://github.com/llvm/llvm-project/pull/95878
>From 299924c9f9485e7a784ffedcb6ec4fbccf5ad6f7 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 17 Jun 2024 21:13:10 -0700
Subject: [PATCH 1/2] [clang-format] Handle function try block with
ctor-initializer
@@ -45,6 +45,9 @@ TEST_F(FormatTest, FormatsGlobalStatementsAt0) {
verifyFormat("\nint i;", " \n\t \v \f int i;");
verifyFormat("int i;\nint j;", "int i; int j;");
verifyFormat("int i;\nint j;", "int i;\n int j;");
+ auto Style = getLLVMStyle();
@@ -21947,6 +21950,10 @@ TEST_F(FormatTest, HandlesUTF8BOM) {
verifyFormat("\xef\xbb\xbf");
verifyFormat("\xef\xbb\xbf#include ");
verifyFormat("\xef\xbb\xbf\n#include ");
+ auto Style = getLLVMStyle();
owenca wrote:
Ditto.
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/91221
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/91221
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/95878
Fixes #58987.
Fixes #95679.
>From 299924c9f9485e7a784ffedcb6ec4fbccf5ad6f7 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 17 Jun 2024 21:13:10 -0700
Subject: [PATCH] [clang-format] Handle function try block
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/95873
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/95873
Adpated from polly-check-format.
>From ab2a61d1939f4be4551949e979fd43b9e11c5c49 Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Mon, 17 Jun 2024 18:49:22 -0700
Subject: [PATCH] [clang-format][NFC] Add CMake target
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95727
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca created
https://github.com/llvm/llvm-project/pull/95727
None
>From ec9b902518ef09d77e8b32777032a852d33476fd Mon Sep 17 00:00:00 2001
From: Owen Pan
Date: Sun, 16 Jun 2024 17:47:56 -0700
Subject: [PATCH] [clang-format][NFC] Add
FormatToken::isAccessSpecifierKeyword()
Author: Owen Pan
Date: 2024-06-16T14:56:02-07:00
New Revision: 527e7328607ea0a55855e53a59c5030a7d07a554
URL:
https://github.com/llvm/llvm-project/commit/527e7328607ea0a55855e53a59c5030a7d07a554
DIFF:
https://github.com/llvm/llvm-project/commit/527e7328607ea0a55855e53a59c5030a7d07a554.diff
https://github.com/owenca closed 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
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95634
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/95703
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/95503
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/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/5] [clang-format] Handle AttributeMacro before access
modifiers
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
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
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
@@ -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
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
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
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
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
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
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
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
@@ -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 =
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
@@ -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 =
@@ -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 =
@@ -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
@@ -4027,12 +4031,10 @@ Expected getStyle(StringRef StyleName,
StringRef FileName,
// Reset possible inheritance
Style.InheritsParentConfig = false;
- auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {};
-
auto applyChildFormatTexts =
@@ -1269,10 +1269,17 @@ class AnnotatingParser {
if (CurrentToken && CurrentToken->is(tok::less)) {
CurrentToken->setType(TT_TemplateOpener);
next();
- if (!parseAngle())
+ TemplateDeclarationDepth++;
+ if (!parseAngle()) {
+
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
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
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
@@ -1269,10 +1269,17 @@ class AnnotatingParser {
if (CurrentToken && CurrentToken->is(tok::less)) {
CurrentToken->setType(TT_TemplateOpener);
next();
- if (!parseAngle())
+ TemplateDeclarationDepth++;
+ if (!parseAngle()) {
+
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
@@ -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 {}; };");
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
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
@@ -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"
+
@@ -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"
+
@@ -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"
+
@@ -1269,10 +1269,17 @@ class AnnotatingParser {
if (CurrentToken && CurrentToken->is(tok::less)) {
CurrentToken->setType(TT_TemplateOpener);
next();
- if (!parseAngle())
+ TemplateDeclarationDepth++;
+ if (!parseAngle()) {
+
@@ -1269,10 +1269,17 @@ class AnnotatingParser {
if (CurrentToken && CurrentToken->is(tok::less)) {
CurrentToken->setType(TT_TemplateOpener);
next();
- if (!parseAngle())
+ TemplateDeclarationDepth++;
+ if (!parseAngle()) {
+
@@ -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) {
+
@@ -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"
+
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
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
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
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
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
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
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
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.
@@ -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;
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<
>
@@ -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"
+ "
@@ -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,
@@ -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"
+ "
@@ -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"
+ "
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
@@ -796,6 +796,24 @@ TEST_F(FormatTestComments,
ParsesCommentsAdjacentToPPDirectives) {
format("namespace {}\n /* Test */#define A"));
}
+
+TEST_F(FormatTestComments, DeIdentsCommentBeforeIfdefAfterBracelessIf) {
+ EXPECT_EQ("void f() {\n"
@@ -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.
```
@@ -4811,8 +4813,11 @@ void UnwrappedLineParser::readToken(int LevelDifference)
{
(!Style.isVerilog() ||
Keywords.isVerilogPPDirective(*Tokens->peekNextToken())) &&
FirstNonCommentOnLine) {
- distributeComments(Comments, FormatTok);
-
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
@@ -796,6 +796,44 @@ TEST_F(FormatTestComments,
ParsesCommentsAdjacentToPPDirectives) {
format("namespace {}\n /* Test */#define A"));
}
+TEST_F(FormatTestComments, DeIdentsCommentBeforeIfdefAfterBracelessIf) {
+ verifyFormat("void f() {\n"
+
@@ -4828,7 +4833,10 @@ void UnwrappedLineParser::readToken(int LevelDifference)
{
PPBranchLevel > 0) {
Line->Level += PPBranchLevel;
}
- flushComments(isOnNewLine(*FormatTok));
+
+ if (!UnbracedBodyDepth)
owenca wrote:
1 - 100 of 1303 matches
Mail list logo