]> granicus.if.org Git - clang/commit
clang-format: Add column layout formatting for braced lists
authorDaniel Jasper <djasper@google.com>
Thu, 22 Aug 2013 15:00:41 +0000 (15:00 +0000)
committerDaniel Jasper <djasper@google.com>
Thu, 22 Aug 2013 15:00:41 +0000 (15:00 +0000)
commitd4a03dbb0bdbd4908375306283cb61813bd8f454
tree03ef42a9242e2da5a4e317853def1d984c2e90db
parent472519660a3b88f5bbde8e5ba13772c903a5034e
clang-format: Add column layout formatting for braced lists

With this patch, braced lists (with more than 3 elements are formatted in a
column layout if possible). E.g.:

  static const uint16_t CallerSavedRegs64Bit[] = {
    X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
    X86::R8,  X86::R9,  X86::R10, X86::R11, 0
  };

Required other changes:
- FormatTokens can now have a special role that contains extra data and can do
  special formattings. A comma separated list is currently the only
  implementation.
- Move penalty calculation entirely into ContinuationIndenter (there was a last
  piece still in UnwrappedLineFormatter).

Review: http://llvm-reviews.chandlerc.com/D1457

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189018 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/CMakeLists.txt
lib/Format/ContinuationIndenter.cpp
lib/Format/ContinuationIndenter.h
lib/Format/Format.cpp
lib/Format/FormatToken.cpp [new file with mode: 0644]
lib/Format/FormatToken.h
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp