This is an archive of the discontinued LLVM Phabricator instance.

[Alignment][NFC] Allow to print alignment to raw_ostream
AbandonedPublic

Authored by gchatelet on Apr 3 2020, 6:01 AM.

Details

Reviewers
courbet
Summary

This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Diff Detail

Event Timeline

gchatelet created this revision.Apr 3 2020, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2020, 6:01 AM

I'd rather have every user forced to think whether they want to use the value or its internal (log) representation, e.g. .p2align vs MIR format. If only for debug, then:

#ifndef NDEBUG
std::string Align::DebugStr() const {
  return "Align(" + value + ")";
}
#endif

WDYT ?

gchatelet abandoned this revision.Apr 3 2020, 6:32 AM

I'd rather have every user forced to think whether they want to use the value or its internal (log) representation, e.g. .p2align vs MIR format. If only for debug, then:

#ifndef NDEBUG
std::string Align::DebugStr() const {
  return "Align(" + value + ")";
}
#endif

WDYT ?

Sounds good to me, I was not absolutely convinced either.
The main motivation was indeed debugging for upcoming patches. I think it's better to resort on a DebugStr function then.