diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-04 08:18:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-04 08:18:47 +0000 |
commit | 3eac1ed5c28f6fd3b670f996e71709c6b16ab9d6 (patch) | |
tree | 7a1e02b4ab0f3430a5094b2a99982ba04ddb2194 /lib/Target/PIC16/PIC16DebugInfo.cpp | |
parent | 2ef7d86653f6a913948b533c525e1e3098485ab4 (diff) | |
download | external_llvm-3eac1ed5c28f6fd3b670f996e71709c6b16ab9d6.zip external_llvm-3eac1ed5c28f6fd3b670f996e71709c6b16ab9d6.tar.gz external_llvm-3eac1ed5c28f6fd3b670f996e71709c6b16ab9d6.tar.bz2 |
Momentous day: remove the "O" member from AsmPrinter. Now all
"asm printering" happens through MCStreamer. This also
Streamerizes PIC16 debug info, which escaped my attention.
This removes a leak from LLVMTargetMachine of the 'legacy'
output stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100327 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/PIC16DebugInfo.cpp')
-rw-r--r-- | lib/Target/PIC16/PIC16DebugInfo.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/Target/PIC16/PIC16DebugInfo.cpp b/lib/Target/PIC16/PIC16DebugInfo.cpp index a223540..5d86329 100644 --- a/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -18,10 +18,10 @@ #include "llvm/GlobalVariable.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Support/DebugLoc.h" -#include "llvm/Support/FormattedStream.h" #include "llvm/ADT/SmallString.h" - +#include "llvm/ADT/StringExtras.h" using namespace llvm; /// PopulateDebugInfo - Populate the TypeNo, Aux[] and TagName from Ty. @@ -267,7 +267,8 @@ void PIC16DbgInfo::ChangeDebugLoc(const MachineFunction &MF, /// void PIC16DbgInfo::SwitchToLine(unsigned Line, bool IsInBeginFunction) { if (CurLine == Line) return; - if (!IsInBeginFunction) O << "\n\t.line " << Line << "\n"; + if (!IsInBeginFunction) + OS.EmitRawText("\n\t.line " + Twine(Line)); CurLine = Line; } @@ -286,7 +287,7 @@ void PIC16DbgInfo::EndFunction(const MachineFunction &MF) { void PIC16DbgInfo::EndModule(Module &M) { if (! EmitDebugDirectives) return; EmitVarDebugInfo(M); - if (CurFile != "") O << "\n\t.eof"; + if (CurFile != "") OS.EmitRawText(StringRef("\n\t.eof")); } /// EmitCompositeTypeElements - Emit debug information for members of a @@ -410,22 +411,26 @@ void PIC16DbgInfo::EmitFunctEndDI(const Function *F, unsigned Line) { /// void PIC16DbgInfo::EmitAuxEntry(const std::string VarName, int Aux[], int Num, std::string TagName) { - O << "\n\t.dim " << VarName << ", 1" ; + std::string Tmp; // TagName is emitted in case of structure/union objects. - if (TagName != "") - O << ", " << TagName; + if (!TagName.empty()) Tmp += ", " + TagName; + for (int i = 0; i<Num; i++) - O << "," << (Aux[i] && 0xff); + Tmp += "," + utostr(Aux[i] && 0xff); + + OS.EmitRawText("\n\t.dim " + Twine(VarName) + ", 1" + Tmp); } /// EmitSymbol - Emit .def for a symbol. Value is offset for the member. /// -void PIC16DbgInfo::EmitSymbol(std::string Name, short Class, unsigned short - Type, unsigned long Value) { - O << "\n\t" << ".def "<< Name << ", type = " << Type << ", class = " - << Class; +void PIC16DbgInfo::EmitSymbol(std::string Name, short Class, + unsigned short Type, unsigned long Value) { + std::string Tmp; if (Value > 0) - O << ", value = " << Value; + Tmp = ", value = " + utostr(Value); + + OS.EmitRawText("\n\t.def " + Twine(Name) + ", type = " + utostr(Type) + + ", class = " + utostr(Class) + Tmp); } /// EmitVarDebugInfo - Emit debug information for all variables. @@ -447,14 +452,13 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) { PopulateDebugInfo(Ty, TypeNo, HasAux, Aux, TagName); // Emit debug info only if type information is availaible. if (TypeNo != PIC16Dbg::T_NULL) { - O << "\n\t.type " << VarName << ", " << TypeNo; + OS.EmitRawText("\t.type " + Twine(VarName) + ", " + Twine(TypeNo)); short ClassNo = getStorageClass(DIGV); - O << "\n\t.class " << VarName << ", " << ClassNo; - if (HasAux) + OS.EmitRawText("\t.class " + Twine(VarName) + ", " + Twine(ClassNo)); + if (HasAux) EmitAuxEntry(VarName, Aux, PIC16Dbg::AuxSize, TagName); } } - O << "\n"; } /// SwitchToCU - Switch to a new compilation unit. @@ -470,8 +474,9 @@ void PIC16DbgInfo::SwitchToCU(MDNode *CU) { if ( FilePath == CurFile ) return; // Else, close the current one and start a new. - if (CurFile != "") O << "\n\t.eof"; - O << "\n\t.file\t\"" << FilePath << "\"\n" ; + if (CurFile != "") + OS.EmitRawText(StringRef("\t.eof")); + OS.EmitRawText("\n\t.file\t\"" + Twine(FilePath) + "\""); CurFile = FilePath; CurLine = 0; } @@ -480,6 +485,6 @@ void PIC16DbgInfo::SwitchToCU(MDNode *CU) { /// void PIC16DbgInfo::EmitEOF() { if (CurFile != "") - O << "\n\t.EOF"; + OS.EmitRawText(StringRef("\t.EOF")); } |