Add indented raw_ostream class
authorJacques Pienaar <jpienaar@google.com>
Sat, 3 Oct 2020 15:53:43 +0000 (08:53 -0700)
committerJacques Pienaar <jpienaar@google.com>
Sat, 3 Oct 2020 15:53:43 +0000 (08:53 -0700)
commit78530ce65375fa02bc96019e5cc9d73db8adaca4
treef49f5551d67d438e3178b22b0b4b74da4c1c01e5
parent7feafa0286f1f5e059d70a9a9f4168f32db3b444
Add indented raw_ostream class

Class simplifies keeping track of the indentation while emitting. For every new line the current indentation is simply prefixed (if not at start of line, then it just emits as normal). Add a simple Region helper that makes it easy to have the C++ scope match the emitted scope.

Use this in op doc generator and rewrite generator.

Differential Revision: https://reviews.llvm.org/D84107
mlir/include/mlir/Support/IndentedOstream.h [new file with mode: 0644]
mlir/lib/Support/CMakeLists.txt
mlir/lib/Support/IndentedOstream.cpp [new file with mode: 0644]
mlir/tools/mlir-tblgen/CMakeLists.txt
mlir/tools/mlir-tblgen/OpDocGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp
mlir/unittests/Support/CMakeLists.txt [new file with mode: 0644]
mlir/unittests/Support/IndentedOstreamTest.cpp [new file with mode: 0644]