summaryrefslogtreecommitdiff
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 01b4b6f0b0d2..148270795c56 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -50,29 +50,25 @@ template <> struct MappingTraits<FormatStyle::AlignConsecutiveStyle> {
{/*Enabled=*/true, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
/*AlignFunctionDeclarations=*/true,
- /*AlignFunctionPointers=*/false,
- /*PadOperators=*/true}));
+ /*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
IO.enumCase(Value, "AcrossEmptyLines",
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/true, /*AcrossEmptyLines=*/true,
/*AcrossComments=*/false, /*AlignCompound=*/false,
/*AlignFunctionDeclarations=*/true,
- /*AlignFunctionPointers=*/false,
- /*PadOperators=*/true}));
+ /*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
IO.enumCase(Value, "AcrossComments",
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/true, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/true, /*AlignCompound=*/false,
/*AlignFunctionDeclarations=*/true,
- /*AlignFunctionPointers=*/false,
- /*PadOperators=*/true}));
+ /*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
IO.enumCase(Value, "AcrossEmptyLinesAndComments",
FormatStyle::AlignConsecutiveStyle(
{/*Enabled=*/true, /*AcrossEmptyLines=*/true,
/*AcrossComments=*/true, /*AlignCompound=*/false,
/*AlignFunctionDeclarations=*/true,
- /*AlignFunctionPointers=*/false,
- /*PadOperators=*/true}));
+ /*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
// For backward compatibility.
IO.enumCase(Value, "true",
@@ -80,8 +76,7 @@ template <> struct MappingTraits<FormatStyle::AlignConsecutiveStyle> {
{/*Enabled=*/true, /*AcrossEmptyLines=*/false,
/*AcrossComments=*/false, /*AlignCompound=*/false,
/*AlignFunctionDeclarations=*/true,
- /*AlignFunctionPointers=*/false,
- /*PadOperators=*/true}));
+ /*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
IO.enumCase(Value, "false", FormatStyle::AlignConsecutiveStyle({}));
}
@@ -532,6 +527,17 @@ template <> struct MappingTraits<FormatStyle::RawStringFormat> {
}
};
+template <> struct ScalarEnumerationTraits<FormatStyle::ReflowCommentsStyle> {
+ static void enumeration(IO &IO, FormatStyle::ReflowCommentsStyle &Value) {
+ IO.enumCase(Value, "Never", FormatStyle::RCS_Never);
+ IO.enumCase(Value, "IndentOnly", FormatStyle::RCS_IndentOnly);
+ IO.enumCase(Value, "Always", FormatStyle::RCS_Always);
+ // For backward compatibility:
+ IO.enumCase(Value, "false", FormatStyle::RCS_Never);
+ IO.enumCase(Value, "true", FormatStyle::RCS_Always);
+ }
+};
+
template <>
struct ScalarEnumerationTraits<FormatStyle::ReferenceAlignmentStyle> {
static void enumeration(IO &IO, FormatStyle::ReferenceAlignmentStyle &Value) {
@@ -1445,11 +1451,6 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align;
LLVMStyle.AlignArrayOfStructures = FormatStyle::AIAS_None;
LLVMStyle.AlignConsecutiveAssignments = {};
- LLVMStyle.AlignConsecutiveAssignments.AcrossComments = false;
- LLVMStyle.AlignConsecutiveAssignments.AcrossEmptyLines = false;
- LLVMStyle.AlignConsecutiveAssignments.AlignCompound = false;
- LLVMStyle.AlignConsecutiveAssignments.AlignFunctionPointers = false;
- LLVMStyle.AlignConsecutiveAssignments.Enabled = false;
LLVMStyle.AlignConsecutiveAssignments.PadOperators = true;
LLVMStyle.AlignConsecutiveBitFields = {};
LLVMStyle.AlignConsecutiveDeclarations = {};
@@ -1579,7 +1580,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.PPIndentWidth = -1;
LLVMStyle.QualifierAlignment = FormatStyle::QAS_Leave;
LLVMStyle.ReferenceAlignment = FormatStyle::RAS_Pointer;
- LLVMStyle.ReflowComments = true;
+ LLVMStyle.ReflowComments = FormatStyle::RCS_Always;
LLVMStyle.RemoveBracesLLVM = false;
LLVMStyle.RemoveParentheses = FormatStyle::RPS_Leave;
LLVMStyle.RemoveSemicolon = false;