[PATCH] D25587: Introduce llvm FormatVariadic

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 11:58:31 PDT 2016


zturner updated this revision to Diff 74726.
zturner added a comment.

Changes from previous revisions:

1. Added a `format_provider` for `llvm::iterator_range<T>`.  Fails to compile if there is no known formatter for `T`.  Style options for the `iterator_range` provider allow you to specify the separator as well as the Style options for the underlying type, which get passed through.

2. Added a test demonstrating the use of a format adapter (i.e. the second way to customize formatting behavior) by making it print the negative of whatever number you give.  The example here is trivial, but the idea is just to illustrate that `format_provider` and adapters both work.  In practice you could make a much more complicated adapter.

I think this is done for now until I get some feedback.


https://reviews.llvm.org/D25587

Files:
  include/llvm/ADT/STLExtras.h
  include/llvm/Support/FormatProviders.h
  include/llvm/Support/FormatVariadic.h
  include/llvm/Support/FormatVariadicDetails.h
  include/llvm/Support/NativeFormatting.h
  include/llvm/Support/YAMLTraits.h
  include/llvm/Support/raw_ostream.h
  lib/Support/CMakeLists.txt
  lib/Support/FormatVariadic.cpp
  lib/Support/NativeFormatting.cpp
  lib/Support/raw_ostream.cpp
  unittests/Support/CMakeLists.txt
  unittests/Support/FormatVariadicTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25587.74726.patch
Type: text/x-patch
Size: 71471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161014/2b633301/attachment-0001.bin>


More information about the llvm-commits mailing list