diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2019-03-01 00:12:18 +0000 |
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2019-03-01 00:12:18 +0000 |
| commit | 7f514164dfc5b8909cec3dc80aa81f6c86e87732 (patch) | |
| tree | 14ba0120e6f6bda5cea8961399d84c7c88aae717 /clang/lib/Format | |
| parent | ae79f42a2fdd1321430a9266476b66eb932da0c9 (diff) | |
| download | bcm5719-llvm-7f514164dfc5b8909cec3dc80aa81f6c86e87732.tar.gz bcm5719-llvm-7f514164dfc5b8909cec3dc80aa81f6c86e87732.zip | |
[clang-format][TableGen] Don't add spaces around items in square braces.
Summary:
clang-formatting wants to add spaces around items in square braces, e.g. [1, 2] -> [ 1, 2 ]. Based on a quick check [1], it seems like most cases are using the [1, 2] format, so make that the consistent one.
[1] in llvm `.td` files, the regex `\[[^ ]` (bracket followed by not-a-space) shows up ~400 times, but `\[\s[^ ]` (bracket followed by one space and one not-a-space) shows up ~40 times => ~90% uses this format.
Reviewers: djasper, krasimir, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: MyDeveloperDay, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D55964
llvm-svn: 355158
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index d8751a36d7a..1827c4a8b17 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -718,6 +718,11 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { 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; } |

