aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/ConfigParseTest.cpp
diff options
context:
space:
mode:
authorIuri Chaer <ichaer@splunk.com>2024-10-12 03:14:09 +0100
committerGitHub <noreply@github.com>2024-10-11 19:14:09 -0700
commit0fba8381d2a71ff440fdf0ae30d59a0bf07fea75 (patch)
tree48ab20e147c4f8bb3745500176ec5728f3685ec9 /clang/unittests/Format/ConfigParseTest.cpp
parent1c28f3113377da218d67dc76aa0876b6250ceb6a (diff)
downloadllvm-0fba8381d2a71ff440fdf0ae30d59a0bf07fea75.zip
llvm-0fba8381d2a71ff440fdf0ae30d59a0bf07fea75.tar.gz
llvm-0fba8381d2a71ff440fdf0ae30d59a0bf07fea75.tar.bz2
[clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (#96804)
* Convert `ReflowComments` from boolean into a new `enum` which can take on the value `RCS_Never`, `RCS_IndentOnly`, or `RCS_Always`. The first one is equivalent to the old `false`, the third one is `true`, and the middle one means that multiline comments should only have their indentation corrected, which is what Doxygen users will want. * Preserve backward compatibility while parsing `ReflowComments`.
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r--clang/unittests/Format/ConfigParseTest.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index 9abb8a1..318f08c 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -183,7 +183,6 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
CHECK_PARSE_BOOL(ObjCSpaceAfterProperty);
CHECK_PARSE_BOOL(ObjCSpaceBeforeProtocolList);
CHECK_PARSE_BOOL(Cpp11BracedListStyle);
- CHECK_PARSE_BOOL(ReflowComments);
CHECK_PARSE_BOOL(RemoveBracesLLVM);
CHECK_PARSE_BOOL(RemoveSemicolon);
CHECK_PARSE_BOOL(SkipMacroDefinitionBody);
@@ -381,6 +380,16 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE("PointerBindsToType: Middle", PointerAlignment,
FormatStyle::PAS_Middle);
+ Style.ReflowComments = FormatStyle::RCS_Always;
+ CHECK_PARSE("ReflowComments: Never", ReflowComments, FormatStyle::RCS_Never);
+ CHECK_PARSE("ReflowComments: IndentOnly", ReflowComments,
+ FormatStyle::RCS_IndentOnly);
+ CHECK_PARSE("ReflowComments: Always", ReflowComments,
+ FormatStyle::RCS_Always);
+ // For backward compatibility:
+ CHECK_PARSE("ReflowComments: false", ReflowComments, FormatStyle::RCS_Never);
+ CHECK_PARSE("ReflowComments: true", ReflowComments, FormatStyle::RCS_Always);
+
Style.Standard = FormatStyle::LS_Auto;
CHECK_PARSE("Standard: c++03", Standard, FormatStyle::LS_Cpp03);
CHECK_PARSE("Standard: c++11", Standard, FormatStyle::LS_Cpp11);