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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to