llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.29k stars 11.68k forks source link

clang-format ignores `clang-format off` #106983

Open bersbersbers opened 1 month ago

bersbersbers commented 1 month ago

Format this code with SeparateDefinitionBlocks: Always:

class X {
  // clang-format off
#pragma warning(suppress : 4373)
  void foo() {}
  // clang-format on
};

Result:

class X {
  // clang-format off
#pragma warning(suppress : 4373)
  void foo() {}

  // clang-format on
};

https://clang-format-configurator.site/, v18.1.3

llvmbot commented 1 month ago

@llvm/issue-subscribers-bug

Author: None (bersbersbers)

Format this code with `SeparateDefinitionBlocks: Always`: ```cpp class X { // clang-format off #pragma warning(suppress : 4373) void foo() {} // clang-format on }; ``` Result: ```cpp class X { // clang-format off #pragma warning(suppress : 4373) void foo() {} // clang-format on }; ``` https://clang-format-configurator.site/, v18.1.3