Page MenuHomePhabricator

Add stream class raw_abbrev_ostream

Authored by sepavloff on Nov 27 2017, 9:52 AM.



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.

Event Timeline

sepavloff created this revision.Nov 27 2017, 9:52 AM
rnk edited edge metadata.Nov 27 2017, 1:25 PM

I commented on the clang review that I'm not sure this is really a good fit for support.

sepavloff abandoned this revision.Feb 26 2018, 8:42 PM

Using llvm type names is considered a wrong direction.