From: mydeveloperday Date: Thu, 30 Apr 2020 10:05:02 +0000 (+0100) Subject: [clang-format] Correct the AfterControlStatement configuration option output style X-Git-Tag: llvmorg-12-init~7368 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=573322694ad332c1cf3e7b27afe002fd46f561f7;p=platform%2Fupstream%2Fllvm.git [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 --- 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); } };