[PATCH] D151047: [clang-format] Fix indent for selective formatting.

Sedenion via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 08:20:45 PDT 2023


Sedeniono added inline comments.


================
Comment at: clang/unittests/Format/FormatTestSelective.cpp:643-646
+  Style.FixNamespaceComments = false;
+  Code = "namespace ns {\n"
+         "#define REF(alias) alias alias_var;\n"
+         "}"; // Format this line only
----------------
owenpan wrote:
> Then I'd remove `Style.FixNamespaceComments` as a factor by formatting a non-brace line.
The problem I observed did not trigger by formatting some arbitrary line. It triggered when formatting specifically the line with the closing `}`. Formatting any other line makes therefore no sense. I just tried it again.
`FixNamespaceComments = false` means that the expected result is that the code fragment remains unchanged. With `FixNamespaceComments = true`, the formatter would change it (by adding the `// namespace ns` comment after the brace).

If you are still offended by the test, I will give up and will remove it. There are still the clang rename tests after all that execute the particular code path and uncovered the problem originally.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151047/new/

https://reviews.llvm.org/D151047



More information about the cfe-commits mailing list