gedare updated this revision to Diff 537857.
gedare added a comment.
Reorder traits and add comment about backward compatibility.
Herald added a comment.
NOTE: Clang-Format Team Automated Review Comment
It looks like your clang-format review does not contain any unit tests, please
try to ensure all code changes have a unit test (unless this is an `NFC` or
refactoring, adding documentation etc..)
Add your unit tests in `clang/unittests/Format` and you can build with `ninja
FormatTests`. We recommend using the `verifyFormat(xxx)` format of unit tests
rather than `EXPECT_EQ` as this will ensure you change is tolerant to random
whitespace changes (see FormatTest.cpp as an example)
For situations where your change is altering the TokenAnnotator.cpp which can
happen if you are trying to improve the annotation phase to ensure we are
correctly identifying the type of a token, please add a token annotator test in
`TokenAnnotatorTest.cpp`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154550/new/
https://reviews.llvm.org/D154550
Files:
clang/lib/Format/Format.cpp
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -593,9 +593,11 @@
template <> struct
ScalarEnumerationTraits<FormatStyle::ShortWhileForLoopStyle> {
static void enumeration(IO &IO, FormatStyle::ShortWhileForLoopStyle &Value) {
IO.enumCase(Value, "Never", FormatStyle::SWFLS_Never);
- IO.enumCase(Value, "false", FormatStyle::SWFLS_Never);
IO.enumCase(Value, "NonEmpty", FormatStyle::SWFLS_NonEmpty);
IO.enumCase(Value, "All", FormatStyle::SWFLS_All);
+
+ // For backward compatibility.
+ IO.enumCase(Value, "false", FormatStyle::SWFLS_Never);
IO.enumCase(Value, "true", FormatStyle::SWFLS_NonEmpty);
}
};
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -593,9 +593,11 @@
template <> struct ScalarEnumerationTraits<FormatStyle::ShortWhileForLoopStyle> {
static void enumeration(IO &IO, FormatStyle::ShortWhileForLoopStyle &Value) {
IO.enumCase(Value, "Never", FormatStyle::SWFLS_Never);
- IO.enumCase(Value, "false", FormatStyle::SWFLS_Never);
IO.enumCase(Value, "NonEmpty", FormatStyle::SWFLS_NonEmpty);
IO.enumCase(Value, "All", FormatStyle::SWFLS_All);
+
+ // For backward compatibility.
+ IO.enumCase(Value, "false", FormatStyle::SWFLS_Never);
IO.enumCase(Value, "true", FormatStyle::SWFLS_NonEmpty);
}
};
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits