]> granicus.if.org Git - clang/commitdiff
clang-format: Stop old options from overriding new options
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Sun, 28 Jun 2015 14:52:34 +0000 (14:52 +0000)
committerBirunthan Mohanathas <birunthan@mohanathas.com>
Sun, 28 Jun 2015 14:52:34 +0000 (14:52 +0000)
Summary: Depends on D10785.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D10786

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240909 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp

index 36ede0c7c7b61d0f2cfe9fe902793b0cf6d77dcc..6a8a8480823fbaef6e15127167379306ea1c71c6 100644 (file)
@@ -169,6 +169,16 @@ template <> struct MappingTraits<FormatStyle> {
       }
     }
 
+    // For backward compatibility.
+    if (!IO.outputting()) {
+      IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment);
+      IO.mapOptional("IndentFunctionDeclarationAfterType",
+                     Style.IndentWrappedFunctionNames);
+      IO.mapOptional("PointerBindsToType", Style.PointerAlignment);
+      IO.mapOptional("SpaceAfterControlStatementKeyword",
+                     Style.SpaceBeforeParens);
+    }
+
     IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset);
     IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket);
     IO.mapOptional("AlignConsecutiveAssignments",
@@ -217,8 +227,6 @@ template <> struct MappingTraits<FormatStyle> {
                    Style.ExperimentalAutoDetectBinPacking);
     IO.mapOptional("ForEachMacros", Style.ForEachMacros);
     IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels);
-    IO.mapOptional("IndentFunctionDeclarationAfterType",
-                   Style.IndentWrappedFunctionNames);
     IO.mapOptional("IndentWidth", Style.IndentWidth);
     IO.mapOptional("IndentWrappedFunctionNames",
                    Style.IndentWrappedFunctionNames);
@@ -257,14 +265,6 @@ template <> struct MappingTraits<FormatStyle> {
     IO.mapOptional("Standard", Style.Standard);
     IO.mapOptional("TabWidth", Style.TabWidth);
     IO.mapOptional("UseTab", Style.UseTab);
-
-    // For backward compatibility.
-    if (!IO.outputting()) {
-      IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment);
-      IO.mapOptional("PointerBindsToType", Style.PointerAlignment);
-      IO.mapOptional("SpaceAfterControlStatementKeyword",
-                     Style.SpaceBeforeParens);
-    }
   }
 };