[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 11:29:37 PST 2019


rupprecht updated this revision to Diff 188765.
rupprecht added a comment.

Rebase after NFC commit rC355123 <https://reviews.llvm.org/rC355123>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D55964

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


Index: clang/unittests/Format/FormatTestTableGen.cpp
===================================================================
--- clang/unittests/Format/FormatTestTableGen.cpp
+++ clang/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
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/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;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55964.188765.patch
Type: text/x-patch
Size: 963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190228/063de92c/attachment-0001.bin>


More information about the cfe-commits mailing list