From: Kevin Enderby Date: Thu, 16 Jan 2014 18:43:56 +0000 (+0000) Subject: Tweak the MCExternalSymbolizer to print references to C string literals X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ea32ab98f4eb01b0d2400673f66742344bf0a680;p=oota-llvm.git Tweak the MCExternalSymbolizer to print references to C string literals with raw_ostream's write_escaped() method. For example darwin's otool(1) program that uses the llvm disassembler now produces disassembly like this: leaq 0x7b(%rip), %rdi ## literal pool for: "%f\ntoto\n" and not print the new lines which messes up the output. rdar://15145300 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199407 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/MCExternalSymbolizer.cpp b/lib/MC/MCExternalSymbolizer.cpp index def662777d6..b82229457db 100644 --- a/lib/MC/MCExternalSymbolizer.cpp +++ b/lib/MC/MCExternalSymbolizer.cpp @@ -149,8 +149,11 @@ void MCExternalSymbolizer::tryAddingPcLoadReferenceComment(raw_ostream &cStream, if(ReferenceType == LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr) cStream << "literal pool symbol address: " << ReferenceName; else if(ReferenceType == - LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr) - cStream << "literal pool for: \"" << ReferenceName << "\""; + LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr) { + cStream << "literal pool for: \""; + cStream.write_escaped(ReferenceName); + cStream << "\""; + } else if(ReferenceType == LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref) cStream << "Objc cfstring ref: @\"" << ReferenceName << "\"";