[PATCH] D137409: [clang-format][NFCish] Alphabetical sort Format.(h|pp)

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 12:49:27 PST 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:23323
                              "WhitespaceSensitiveMacros: ['FOO', 'BAR']")));
-  std::vector<std::string> NonDefaultWhiteSpaceMacros{"FOO", "BAR"};
+  std::vector<std::string> NonDefaultWhiteSpaceMacros =
+      Style9->WhitespaceSensitiveMacros;
----------------
MyDeveloperDay wrote:
> related?
Sadly yes.
Because `WhiteSensitiveMacros` were not handled in `operator==` we basically tested nothing here.
When I wrote the tests I assumed (and still think it should be that way) that `WhiteSensitiveMacros` would only contain what is posted in the `.clang-format`. But that's not the case, the vector gets filled with whatever `getLLVMStyle()` does and then overwrites them in order, extending when there is not enough room.

That will hold for all `std::vector`s and so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137409



More information about the cfe-commits mailing list