[PATCH] D110359: [clang-format] [NFC] ensure clang-format command-line argument sets up the default left/right qualifier ordering
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 23 12:34:26 PDT 2021
MyDeveloperDay created this revision.
MyDeveloperDay added a reviewer: HazardyKnusperkeks.
MyDeveloperDay added a project: clang-format.
MyDeveloperDay requested review of this revision.
Herald added a project: clang.
When specifying the alignment direction on the command line ensure we set up the default ordering.
Fix spelling mistakes in the command-line argument
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110359
Files:
clang/tools/clang-format/ClangFormat.cpp
Index: clang/tools/clang-format/ClangFormat.cpp
===================================================================
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -106,9 +106,9 @@
cl::cat(ClangFormatCategory));
static cl::opt<std::string> QualifierAlignment(
- "qualifier-aligment",
+ "qualifier-alignment",
cl::desc(
- "If set, overrides the cvqualifier style behavior determined by the "
+ "If set, overrides the qualifier alignment style determined by the "
"QualifierAlignment style flag"),
cl::init(""), cl::cat(ClangFormatCategory));
@@ -418,6 +418,11 @@
.Case("left", FormatStyle::QAS_Left)
.Default(FormatStyle->QualifierAlignment);
+ if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Left)
+ FormatStyle->QualifierOrder = {"const", "volatile", "type"};
+ else if (FormatStyle->QualifierAlignment == FormatStyle::QAS_Right)
+ FormatStyle->QualifierOrder = {"type", "const", "volatile"};
+
if (SortIncludes.getNumOccurrences() != 0) {
if (SortIncludes)
FormatStyle->SortIncludes = FormatStyle::SI_CaseSensitive;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110359.374645.patch
Type: text/x-patch
Size: 1167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210923/3fae453e/attachment-0001.bin>
More information about the cfe-commits
mailing list