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

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

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

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

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

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

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

2024-07-23 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/93140 >From 09bd1f04730f0accad7ce041b0121f716cc7a18d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 01/13] [clang-format] Improve BlockIndent at ColumnLimit Fixes #557

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

2024-07-23 Thread Owen Pan via cfe-commits
owenca wrote: > Fixes #73584 Seems it's not fixed yet: ``` $ cat test.cpp { PyObjectPtr const readinto_method_obj{ PyObject_GetAttrString(input_stream, "readinto")}; } $ clang-format test.cpp { PyObjectPtr const readinto_method_obj{PyObject_GetAttrString(input_stream, "readi

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

2024-07-23 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 09bd1f04730f0accad7ce041b0121f716cc7a18d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 01/12] [clang-format] Improve BlockIndent at ColumnLimit Fixes #557

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

2024-07-23 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 09bd1f04730f0accad7ce041b0121f716cc7a18d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 01/11] [clang-format] Improve BlockIndent at ColumnLimit Fixes #557

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -9337,6 +9337,32 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "\n" ");", Style); + verifyFormat("bool aaa(\n" + "const bool &a, const void *aa\n" + ") const {\n"

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -9337,6 +9337,32 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "\n" ");", Style); + verifyFormat("bool aaa(\n" + "const bool &a, const void *aa\n" + ") const {\n"

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

2024-07-22 Thread Owen Pan via cfe-commits
owenca wrote: Please also add the following: ``` $ git diff TokenAnnotatorTest.cpp diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index c5e8aa72cd2c..4994498c389b 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/un

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -803,6 +803,51 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + auto IsLambdaParameterList = [](const Fo

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -803,6 +803,51 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + auto IsLambdaParameterList = [](const Fo

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -803,6 +803,51 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + auto IsLambdaParameterList = [](const Fo

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -803,6 +803,51 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + auto IsLambdaParameterList = [](const Fo

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -813,10 +858,10 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, // cll( // cll( // caaall(aa, a; - Current.FakeLParen

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

2024-07-22 Thread Owen Pan via cfe-commits
@@ -803,6 +803,51 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + auto IsLambdaParameterList = [](const Fo

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

2024-07-22 Thread Owen Pan via cfe-commits
owenca wrote: You can annotate the lambda l_paren: ``` $ git diff FormatToken.h diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index cc45d5a8c5c1..abcedb66b57c 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -102,6 +102,7 @@ namesp

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

2024-07-18 Thread Gedare Bloom via cfe-commits
gedare wrote: I have another PR lined up to submit but it depends on this one. It would be great if we can get some forward progress @owenca https://github.com/llvm/llvm-project/pull/93140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

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

2024-07-10 Thread Gedare Bloom via cfe-commits
gedare wrote: Rebased to be able to use #97938 https://github.com/llvm/llvm-project/pull/93140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-10 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-07-10 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 6f35c68cff7381453a0bd6a491fee1db6784f42d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/5] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

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

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

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

2024-06-26 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/93140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

2024-06-20 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 27a2da876926d2157ea9f18c5fd71a2e81e097fc Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/4] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

[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 &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[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 &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[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 &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-06-01 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-06-01 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-05-31 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-05-31 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-05-31 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 27a2da876926d2157ea9f18c5fd71a2e81e097fc Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/3] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

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

2024-05-31 Thread Gedare Bloom via cfe-commits
@@ -6157,6 +6157,12 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); } + if (Left.isOneOf(tok::r_paren, TT_TrailingAnnotation) && gedare wrote: yes, it is part of

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

2024-05-27 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-05-27 Thread Björn Schäpers via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

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

2024-05-27 Thread Björn Schäpers via cfe-commits
@@ -6157,6 +6157,12 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); } + if (Left.isOneOf(tok::r_paren, TT_TrailingAnnotation) && HazardyKnusperkeks wrote: Is this

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

2024-05-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 27a2da876926d2157ea9f18c5fd71a2e81e097fc Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/2] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

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

2024-05-22 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 7f5c71efc441083282a5365d245acfe6afcd0dd5 27a2da876926d2157ea9f18c5fd71a2e81e097fc --

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

2024-05-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Gedare Bloom (gedare) Changes Fixes #55731 Fixes #73584 The reported formatting problems were related to ignoring deep nesting of "simple" functions (causing #54808) and to allowing the trailing annotation to become separated fr

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

2024-05-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/93140 Fixes #55731 Fixes #73584 The reported formatting problems were related to ignoring deep nesting of "simple" functions (causing #54808) and to allowing the trailing annotation to become separated from the clos