[PATCH] D69764: [clang-format] Add Left/Right Const fixer capability

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 10 06:41:44 PDT 2021


HazardyKnusperkeks added a comment.

First off, I think it should be configured in a different way, to prepare the path for also formatting static, inline, etc.

If this is kept there should be tests on what happens if there is const or volatile more than once in the string list, and when there are typos. Should there be a command line warning on a typo or an unsupported identifier is in the list?



================
Comment at: clang/lib/Format/Format.cpp:2890-2892
+    if (Style.CVQualifierAlignment == FormatStyle::CVQAS_Left) {
+      std::reverse(Order.begin(), Order.end());
+    }
----------------



================
Comment at: clang/lib/Format/Format.cpp:2896
+    // will be out of scope at construction.
+    for (std::string CVQualifier : Order) {
+      if (CVQualifier == "const") {
----------------
I don't know if we should remove the braces here too.

But the loop should use references or StringRef, not copied strings.


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

https://reviews.llvm.org/D69764



More information about the cfe-commits mailing list