This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324896: [clang-format] Fix comment indentation in text 
protos (authored by krasimir, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43194

Files:
  cfe/trunk/lib/Format/ContinuationIndenter.cpp
  cfe/trunk/unittests/Format/FormatTestTextProto.cpp


Index: cfe/trunk/lib/Format/ContinuationIndenter.cpp
===================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp
@@ -200,6 +200,7 @@
     // global scope.
     State.Stack.back().AvoidBinPacking = true;
     State.Stack.back().BreakBeforeParameter = true;
+    State.Stack.back().AlignColons = false;
   }
 
   // The first token has already been indented and thus consumed.
Index: cfe/trunk/unittests/Format/FormatTestTextProto.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTestTextProto.cpp
+++ cfe/trunk/unittests/Format/FormatTestTextProto.cpp
@@ -313,5 +313,17 @@
       "  text: 
\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasaaaaaaaaaa\"\n"
       "}");
 }
+
+TEST_F(FormatTestTextProto, KeepsCommentsIndentedInList) {
+  verifyFormat("aaaaaaaaaa: 100\n"
+               "bbbbbbbbbbbbbbbbbbbbbbbbbbb: 200\n"
+               "# Single line comment for stuff here.\n"
+               "cccccccccccccccccccccccc: 3849\n"
+               "# Multiline comment for stuff here.\n"
+               "# Multiline comment for stuff here.\n"
+               "# Multiline comment for stuff here.\n"
+               "cccccccccccccccccccccccc: 3849");
+}
+
 } // end namespace tooling
 } // end namespace clang


Index: cfe/trunk/lib/Format/ContinuationIndenter.cpp
===================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp
@@ -200,6 +200,7 @@
     // global scope.
     State.Stack.back().AvoidBinPacking = true;
     State.Stack.back().BreakBeforeParameter = true;
+    State.Stack.back().AlignColons = false;
   }
 
   // The first token has already been indented and thus consumed.
Index: cfe/trunk/unittests/Format/FormatTestTextProto.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTestTextProto.cpp
+++ cfe/trunk/unittests/Format/FormatTestTextProto.cpp
@@ -313,5 +313,17 @@
       "  text: \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasaaaaaaaaaa\"\n"
       "}");
 }
+
+TEST_F(FormatTestTextProto, KeepsCommentsIndentedInList) {
+  verifyFormat("aaaaaaaaaa: 100\n"
+               "bbbbbbbbbbbbbbbbbbbbbbbbbbb: 200\n"
+               "# Single line comment for stuff here.\n"
+               "cccccccccccccccccccccccc: 3849\n"
+               "# Multiline comment for stuff here.\n"
+               "# Multiline comment for stuff here.\n"
+               "# Multiline comment for stuff here.\n"
+               "cccccccccccccccccccccccc: 3849");
+}
+
 } // end namespace tooling
 } // end namespace clang
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to