MLIR  15.0.0git
Classes | Public Member Functions | List of all members
mlir::raw_indented_ostream Class Reference

raw_ostream subclass that simplifies indention a sequence of code. More...

#include "mlir/Support/IndentedOstream.h"

+ Inheritance diagram for mlir::raw_indented_ostream:
+ Collaboration diagram for mlir::raw_indented_ostream:

Classes

struct  DelimitedScope
 Simple RAII struct to use to indentation around entering/exiting region. More...
 

Public Member Functions

 raw_indented_ostream (llvm::raw_ostream &os)
 
raw_ostream & getOStream () const
 Returns the underlying (unindented) raw_ostream. More...
 
DelimitedScope scope (StringRef open="", StringRef close="", bool indent=true)
 Returns DelimitedScope. More...
 
raw_indented_ostreamprintReindented (StringRef str)
 Prints a string re-indented to the current indent. More...
 
raw_indented_ostreamindent ()
 Increases the indent and returning this raw_indented_ostream. More...
 
raw_indented_ostreamunindent ()
 Decreases the indent and returning this raw_indented_ostream. More...
 
raw_indented_ostreamindent (int with)
 Emits whitespace and sets the indentation for the stream. More...
 

Detailed Description

raw_ostream subclass that simplifies indention a sequence of code.

Definition at line 23 of file IndentedOstream.h.

Constructor & Destructor Documentation

◆ raw_indented_ostream()

mlir::raw_indented_ostream::raw_indented_ostream ( llvm::raw_ostream &  os)
inlineexplicit

Definition at line 25 of file IndentedOstream.h.

Member Function Documentation

◆ getOStream()

raw_ostream& mlir::raw_indented_ostream::getOStream ( ) const
inline

Returns the underlying (unindented) raw_ostream.

Definition at line 52 of file IndentedOstream.h.

References mlir::raw_indented_ostream::DelimitedScope::os.

◆ indent() [1/2]

raw_indented_ostream& mlir::raw_indented_ostream::indent ( )
inline

◆ indent() [2/2]

raw_indented_ostream& mlir::raw_indented_ostream::indent ( int  with)
inline

Emits whitespace and sets the indentation for the stream.

Definition at line 78 of file IndentedOstream.h.

References indent(), and mlir::raw_indented_ostream::DelimitedScope::os.

◆ printReindented()

raw_indented_ostream & mlir::raw_indented_ostream::printReindented ( StringRef  str)

Prints a string re-indented to the current indent.

Re-indents by removing the leading whitespace from the first non-empty line from every line of the string, skipping over empty lines at the start.

Definition at line 19 of file IndentedOstream.cpp.

References min(), and print().

Referenced by mlir::detail::Parser::parseCommaSeparatedListUntil(), scope(), mlir::tblgen::ExtraClassDeclaration::writeDeclTo(), and mlir::tblgen::ExtraClassDeclaration::writeDefTo().

◆ scope()

DelimitedScope mlir::raw_indented_ostream::scope ( StringRef  open = "",
StringRef  close = "",
bool  indent = true 
)
inline

◆ unindent()

raw_indented_ostream& mlir::raw_indented_ostream::unindent ( )
inline

The documentation for this class was generated from the following files: