[PATCH] D79020: [clang-format] Correct the AfterControlStatement configuration option output style
Duncan Barber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 10:11:39 PDT 2020
duncan-llvm created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
duncan-llvm edited the summary of this revision.
duncan-llvm added a reviewer: MyDeveloperDay.
duncan-llvm added a project: clang-format.
Due to the order in which the enum cases were defined the old options which were retained for backwards compatibility were being preferred over the new options when printing with the --dump-config option.
I wasn't sure where this stood in regard to tests - I couldn't find anything testing the enum/string conversions in this direction, so if I've missed something please point me in the right direction and I'll add something.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79020
Files:
clang/lib/Format/Format.cpp
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -195,11 +195,13 @@
static void
enumeration(IO &IO,
FormatStyle::BraceWrappingAfterControlStatementStyle &Value) {
- IO.enumCase(Value, "false", FormatStyle::BWACS_Never);
- IO.enumCase(Value, "true", FormatStyle::BWACS_Always);
IO.enumCase(Value, "Never", FormatStyle::BWACS_Never);
IO.enumCase(Value, "MultiLine", FormatStyle::BWACS_MultiLine);
IO.enumCase(Value, "Always", FormatStyle::BWACS_Always);
+
+ // For backward compatibility.
+ IO.enumCase(Value, "false", FormatStyle::BWACS_Never);
+ IO.enumCase(Value, "true", FormatStyle::BWACS_Always);
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79020.260674.patch
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200428/a456a2b1/attachment.bin>
More information about the cfe-commits
mailing list