[PATCH] D43469: [clang-format] Fix text proto extension scope opening detection

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 08:02:41 PST 2018


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 rC325513: [clang-format] Fix text proto extension scope opening detection (authored by krasimir, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43469?vs=134918&id=134921#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43469

Files:
  lib/Format/FormatToken.h
  unittests/Format/FormatTestTextProto.cpp


Index: lib/Format/FormatToken.h
===================================================================
--- lib/Format/FormatToken.h
+++ lib/Format/FormatToken.h
@@ -478,6 +478,7 @@
     if (is(TT_TemplateString) && opensScope())
       return true;
     return is(TT_ArrayInitializerLSquare) ||
+           is(TT_ProtoExtensionLSquare) ||
            (is(tok::l_brace) &&
             (BlockKind == BK_Block || is(TT_DictLiteral) ||
              (!Style.Cpp11BracedListStyle && NestingLevel == 0))) ||
Index: unittests/Format/FormatTestTextProto.cpp
===================================================================
--- unittests/Format/FormatTestTextProto.cpp
+++ unittests/Format/FormatTestTextProto.cpp
@@ -389,6 +389,14 @@
                "    keyyyyyyyyyyyyyy: valuuuuuuuuuuuuuuuuuuuuuuuuue\n"
                "  }\n"
                "}");
+  verifyFormat(
+      "aaaaaaaaaaaaaaa {\n"
+      "  bbbbbb {\n"
+      "    [a.b/cy] {\n"
+      "      eeeeeeeeeeeee: \"The lazy coo cat jumps over the lazy hot dog\"\n"
+      "    }\n"
+      "  }\n"
+      "}");
 }
 
 TEST_F(FormatTestTextProto, NoSpaceAfterPercent) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43469.134921.patch
Type: text/x-patch
Size: 1122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180219/dd96c97e/attachment-0001.bin>


More information about the cfe-commits mailing list