[PATCH] clang-format: Add column layout formatting for braced lists

Daniel Jasper djasper at google.com
Wed Aug 21 04:10:16 PDT 2013


Hi klimek,

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).

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

Files:
  lib/Format/CMakeLists.txt
  lib/Format/ContinuationIndenter.cpp
  lib/Format/ContinuationIndenter.h
  lib/Format/Format.cpp
  lib/Format/FormatToken.cpp
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1457.1.patch
Type: text/x-patch
Size: 21012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130821/22ede32c/attachment.bin>


More information about the cfe-commits mailing list