From 573322694ad332c1cf3e7b27afe002fd46f561f7 Mon Sep 17 00:00:00 2001 From: mydeveloperday Date: Thu, 30 Apr 2020 11:05:02 +0100 Subject: [PATCH] [clang-format] Correct the AfterControlStatement configuration option output style Summary: 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. Reviewers: MyDeveloperDay Reviewed By: MyDeveloperDay Patch By: duncan-llvm Subscribers: cfe-commits Tags: #clang, #clang-format Differential Revision: https://reviews.llvm.org/D79020 --- clang/lib/Format/Format.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 737e502..872f7009 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -195,11 +195,13 @@ struct ScalarEnumerationTraits< 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); } }; -- 2.7.4