[PATCH] D40506: Add stream class raw_abbrev_ostream

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 09:52:50 PST 2017


sepavloff created this revision.
Herald added a subscriber: mgorny.

This class allows to mark regions in input data that may be replaced
by SHA1 hash or truncated if the number of symbols in that region exceeds
specified limit.

The new class supports two modes, transparent and abbreviating. In the
transparent mode the class behaves like usual stream, sending all input to
internal buffer. In the abbreviating mode it counts number of symbols in
input data. If the number is less than the specified limit, the input data
go to the buffer as in transparent mode. If the number exceeds the limit,
the input is replaced either by its hash or by truncated value.

The class is intended to be used for building object names or messages,
which may be arbitrary long. For instance, type names in IR may contain
template parameter names for template specializations. In some real life
cases these names can become really huge. By replacing long template
parameter sequence with a hash value, the type name remains compact and
still can identify the type across translation units.


https://reviews.llvm.org/D40506

Files:
  include/llvm/Support/raw_abbrev_ostream.h
  lib/Support/CMakeLists.txt
  lib/Support/raw_abbrev_ostream.cpp
  unittests/Support/CMakeLists.txt
  unittests/Support/raw_abbrev_ostream_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40506.124408.patch
Type: text/x-patch
Size: 21181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/8cb7a69c/attachment.bin>


More information about the llvm-commits mailing list