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] Macro formatting regression 19.1.6 vs 19.1.7 #123179

Closed
chegoryu opened this issue Jan 16, 2025 · 3 comments · Fixed by #123279
Closed

[clang-format] Macro formatting regression 19.1.6 vs 19.1.7 #123179

chegoryu opened this issue Jan 16, 2025 · 3 comments · Fixed by #123279
Assignees

Comments

@chegoryu
Copy link

For the following code:

template<typename Writer>
void write_to(Writer& writer, const FieldHeader& field_header) {
#define WRITE_MESSAGE(type) \
  { \
    case FieldType::type: { \
      writer.value(#type); \
      writer.key("Message").start_object(); \
      write_to(writer, cast_to<type>(field_header)); \
      writer.finish_object(); \
      return; \
    } \
  }
}
Ubuntu clang-format version 19.1.7 (++20250114103238+cd708029e0b2-1~exp1~20250114103342.77)

Produces

template<typename Writer>
void write_to(Writer& writer, const FieldHeader& field_header) {
#define WRITE_MESSAGE(type) \
  {case FieldType::type: {writer.value(#type); \
  writer.key("Message").start_object(); \
  write_to(writer, cast_to<type>(field_header)); \
  writer.finish_object(); \
  return; \
  } \
  }
}

But

Ubuntu clang-format version 19.1.6 (++20241217110052+657e03f8625c-1~exp1~20241217110110.73)

Does not change the file

clang-format-19 file.cpp --dump-config: https://pastebin.com/7vebyX6j

@llvmbot
Copy link
Member

llvmbot commented Jan 16, 2025

@llvm/issue-subscribers-clang-format

Author: None (chegoryu)

For the following code: ```cpp template<typename Writer> void write_to(Writer& writer, const FieldHeader& field_header) { #define WRITE_MESSAGE(type) \ { \ case FieldType::type: { \ writer.value(#type); \ writer.key("Message").start_object(); \ write_to(writer, cast_to<type>(field_header)); \ writer.finish_object(); \ return; \ } \ } } ```
Ubuntu clang-format version 19.1.7 (++20250114103238+cd708029e0b2-1~exp1~20250114103342.77)

Produces

template&lt;typename Writer&gt;
void write_to(Writer&amp; writer, const FieldHeader&amp; field_header) {
#define WRITE_MESSAGE(type) \
  {case FieldType::type: {writer.value(#type); \
  writer.key("Message").start_object(); \
  write_to(writer, cast_to&lt;type&gt;(field_header)); \
  writer.finish_object(); \
  return; \
  } \
  }
}

But

Ubuntu clang-format version 19.1.6 (++20241217110052+657e03f8625c-1~exp1~20241217110110.73)

Does not change the file

clang-format-19 file.cpp --dump-config: https://pastebin.com/7vebyX6j

@owenca owenca self-assigned this Jan 16, 2025
@owenca owenca added the regression:19 Regression in 19 release label Jan 16, 2025
@owenca owenca added this to the LLVM 19.X Release milestone Jan 16, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in LLVM Release Status Jan 16, 2025
owenca added a commit to owenca/llvm-project that referenced this issue Jan 17, 2025
@owenca owenca closed this as completed in a7bca18 Jan 18, 2025
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in LLVM Release Status Jan 18, 2025
@owenca
Copy link
Contributor

owenca commented Jan 18, 2025

/cherry-pick a7bca18

@llvmbot
Copy link
Member

llvmbot commented Jan 18, 2025

/pull-request #123439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants