[PATCH] D55964: [clang-format][TableGen] Don't add spaces around items in square braces.

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 28 16:12:50 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC355158: [clang-format][TableGen] Don't add spaces around items in square braces. (authored by rupprecht, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55964?vs=188765&id=188807#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55964/new/

https://reviews.llvm.org/D55964

Files:
  lib/Format/Format.cpp
  unittests/Format/FormatTestTableGen.cpp


Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -718,6 +718,11 @@
   LLVMStyle.StatementMacros.push_back("Q_UNUSED");
   LLVMStyle.StatementMacros.push_back("QT_REQUIRE_VERSION");
 
+  // Defaults that differ when not C++.
+  if (Language == FormatStyle::LK_TableGen) {
+    LLVMStyle.SpacesInContainerLiterals = false;
+  }
+
   return LLVMStyle;
 }
 
Index: unittests/Format/FormatTestTableGen.cpp
===================================================================
--- unittests/Format/FormatTestTableGen.cpp
+++ unittests/Format/FormatTestTableGen.cpp
@@ -51,5 +51,9 @@
                "               \"very long help string\">;\n");
 }
 
+TEST_F(FormatTestTableGen, NoSpacesInSquareBracketLists) {
+  verifyFormat("def flag : Flag<[\"-\", \"--\"], \"foo\">;\n");
+}
+
 } // namespace format
 } // end namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55964.188807.patch
Type: text/x-patch
Size: 927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190301/bf3457dc/attachment.bin>


More information about the cfe-commits mailing list