Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-format: Inserts unwanted newlines in template <typename...> typename class template #93793

Closed
cvigue opened this issue May 30, 2024 · 1 comment · Fixed by #95025
Closed
Assignees
Labels
clang-format duplicate Resolved as duplicate

Comments

@cvigue
Copy link

cvigue commented May 30, 2024

Desired format:

template <template <typename...> typename Xxx,
          template <typename...> typename Yyy,
          typename... T>
class A
{
};

Actual format:

template <template <typename...> typename Xxx,
          template <typename...>
          typename Yyy,
          typename... T>
class A
{
};

My .clang-format:

BasedOnStyle: Microsoft
ColumnLimit: 0
SortIncludes: Never
BreakBeforeBinaryOperators: All
BinPackArguments: False
BinPackParameters: False
LambdaBodyIndentation: OuterScope
IndentCaseBlocks: true
MaxEmptyLinesToKeep: 3
BraceWrapping:
  AfterNamespace: false
  AfterCaseLabel: true
  BeforeLambdaBody: true

Using clang-format 14

@rymiel
Copy link
Member

rymiel commented Jun 10, 2024

Duplicate of #48746

@rymiel rymiel marked this as a duplicate of #48746 Jun 10, 2024
@rymiel rymiel closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2024
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Jun 10, 2024
rymiel added a commit that referenced this issue Jun 22, 2024
…#95025)

In ContinuationIndenter::mustBreak, a break is required between a
template declaration and the function/class declaration it applies to,
if the template declaration spans multiple lines.

However, this also includes template template parameters, which can
cause extra erroneous line breaks in some declarations.

This patch makes template template parameters not be counted as template
declarations.

Fixes #93793
Fixes #48746
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2024
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this issue Jul 9, 2024
…llvm#95025)

In ContinuationIndenter::mustBreak, a break is required between a
template declaration and the function/class declaration it applies to,
if the template declaration spans multiple lines.

However, this also includes template template parameters, which can
cause extra erroneous line breaks in some declarations.

This patch makes template template parameters not be counted as template
declarations.

Fixes llvm#93793
Fixes llvm#48746
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-format duplicate Resolved as duplicate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants