diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index b90a5b28577..d3ae9027a7d 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -26,8 +26,9 @@ #include "llvm/iPHINode.h" #include "llvm/iOther.h" #include "llvm/Module.h" -#include "llvm/Analysis/SlotCalculator.h" #include "llvm/SymbolTable.h" +#include "llvm/Analysis/SlotCalculator.h" +#include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" #include "Support/StringExtras.h" #include "Support/STLExtras.h" @@ -474,6 +475,8 @@ public: void writeOperand(const Value *Op, bool PrintType, bool PrintName = true); + const Module* getModule() { return TheModule; } + private : void printModule(const Module *M); void printSymbolTable(const SymbolTable &ST); @@ -1019,7 +1022,7 @@ void CachedWriter::setModule(const Module *M) { delete SC; delete AW; if (M) { SC = new SlotCalculator(M, false); - AW = new AssemblyWriter(Out, *SC, M, 0); + AW = new AssemblyWriter(*Out, *SC, M, 0); } else { SC = 0; AW = 0; } @@ -1040,7 +1043,16 @@ CachedWriter &CachedWriter::operator<<(const Value *V) { case Value::BasicBlockVal: AW->write(cast(V)); break; case Value::FunctionVal: AW->write(cast(V)); break; case Value::GlobalVariableVal: AW->write(cast(V)); break; - default: Out << "getValueType() << ">"; break; + default: *Out << "getValueType() << ">"; break; } return *this; } + +CachedWriter& CachedWriter::operator<<(const Type *X) { + if (SymbolicTypes) { + const Module *M = AW->getModule(); + if (M) WriteTypeSymbolic(*Out, X, M); + return *this; + } else + return *this << (const Value*)X; +}