diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2004-04-28 15:30:33 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2004-04-28 15:30:33 +0000 |
commit | 3f98def80174e887443a930357bd8da28b1a58a2 (patch) | |
tree | b0314a5b79bd89ca9bb68ea4c2a2ba7c6e3bee3e /include/llvm/Assembly | |
parent | 3707241f315b63b2dc380e0a1be5522bfd58b8d5 (diff) | |
download | external_llvm-3f98def80174e887443a930357bd8da28b1a58a2.zip external_llvm-3f98def80174e887443a930357bd8da28b1a58a2.tar.gz external_llvm-3f98def80174e887443a930357bd8da28b1a58a2.tar.bz2 |
* Add ability to get and set the output stream
* New feature: outputting a Type* as symbolic, controlled via the stream
similarly to sending std::hex to change number format
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13226 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Assembly')
-rw-r--r-- | include/llvm/Assembly/CachedWriter.h | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/include/llvm/Assembly/CachedWriter.h b/include/llvm/Assembly/CachedWriter.h index a216736..0808600 100644 --- a/include/llvm/Assembly/CachedWriter.h +++ b/include/llvm/Assembly/CachedWriter.h @@ -30,12 +30,20 @@ class AssemblyWriter; // Internal private class class CachedWriter { AssemblyWriter *AW; SlotCalculator *SC; + bool SymbolicTypes; public: - std::ostream &Out; + std::ostream *Out; + + enum TypeWriter { + SymTypeOn, + SymTypeOff + }; + public: - CachedWriter(std::ostream &O = std::cout) : AW(0), SC(0), Out(O) { } + CachedWriter(std::ostream &O = std::cout) + : AW(0), SC(0), SymbolicTypes(false), Out(&O) { } CachedWriter(const Module *M, std::ostream &O = std::cout) - : AW(0), SC(0), Out(O) { + : AW(0), SC(0), SymbolicTypes(false), Out(&O) { setModule(M); } ~CachedWriter(); @@ -66,22 +74,26 @@ public: inline CachedWriter &operator<<(const Constant *X) { return *this << (const Value*)X; } - inline CachedWriter &operator<<(const Type *X) { - return *this << (const Value*)X; - } - inline CachedWriter &operator<<(const PointerType *X) { - return *this << (const Value*)X; - } + CachedWriter &operator<<(const Type *X); + inline CachedWriter &operator<<(const PointerType *X); inline CachedWriter &operator<<(std::ostream &(&Manip)(std::ostream &)) { - Out << Manip; return *this; + *Out << Manip; return *this; } template<class X> inline CachedWriter &operator<<(const X &v) { - Out << v; + *Out << v; return *this; } + + inline CachedWriter &operator<<(enum TypeWriter tw) { + SymbolicTypes = (tw == SymTypeOn); + return *this; + } + + inline std::ostream& getStream() { return *Out; } + inline void setStream(std::ostream &os) { Out = &os; } }; } // End llvm namespace |