14 #ifndef MLIR_SUPPORT_INDENTEDOSTREAM_H_ 15 #define MLIR_SUPPORT_INDENTEDOSTREAM_H_ 18 #include "llvm/Support/raw_ostream.h" 32 StringRef close =
"",
bool indent =
true)
33 : os(os), open(open), close(close), indent(indent) {
47 StringRef open, close;
67 currentIndent += indentSize;
73 currentIndent =
std::max(0, currentIndent - indentSize);
80 atStartOfLine =
false;
86 void write_impl(
const char *ptr,
size_t size)
override;
90 uint64_t current_pos()
const override {
return os.tell(); }
93 static constexpr
int indentSize = 2;
96 int currentIndent = 0;
102 bool atStartOfLine =
true;
109 #endif // MLIR_SUPPORT_INDENTEDOSTREAM_H_ Include the generated interface declarations.
raw_indented_ostream(llvm::raw_ostream &os)
DelimitedScope scope(StringRef open="", StringRef close="", bool indent=true)
Returns DelimitedScope.
raw_indented_ostream & indent()
Increases the indent and returning this raw_indented_ostream.
raw_indented_ostream & os
Simple RAII struct to use to indentation around entering/exiting region.
raw_indented_ostream & printReindented(StringRef str)
Prints a string re-indented to the current indent.
DelimitedScope(raw_indented_ostream &os, StringRef open="", StringRef close="", bool indent=true)
raw_indented_ostream & indent(int with)
Emits whitespace and sets the indentation for the stream.
raw_indented_ostream & unindent()
Decreases the indent and returning this raw_indented_ostream.
raw_ostream subclass that simplifies indention a sequence of code.
static Value max(ImplicitLocOpBuilder &builder, Value value, Value bound)
raw_ostream & getOStream() const
Returns the underlying (unindented) raw_ostream.