summaryrefslogtreecommitdiff
path: root/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/MachOObjectFile.cpp')
-rw-r--r--lib/Object/MachOObjectFile.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index 2511a4a3fa..dbfc07270a 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -301,7 +301,7 @@ static unsigned getCPUType(const MachOObjectFile *O) {
static void printRelocationTargetName(const MachOObjectFile *O,
const MachO::any_relocation_info &RE,
- raw_ostream &fmt) {
+ raw_string_ostream &fmt) {
bool IsScattered = O->isRelocationScattered(RE);
// Target of a scattered relocation is an address. In the interest of
@@ -1010,7 +1010,8 @@ MachOObjectFile::getRelocationValueString(DataRefImpl Rel,
unsigned Arch = this->getArch();
- string_ostream fmt;
+ std::string fmtbuf;
+ raw_string_ostream fmt(fmtbuf);
unsigned Type = this->getAnyRelocationType(RE);
bool IsPCRel = this->getAnyRelocationPCRel(RE);
@@ -1173,7 +1174,7 @@ MachOObjectFile::getRelocationValueString(DataRefImpl Rel,
} else
printRelocationTargetName(this, RE, fmt);
- StringRef fmtbuf = fmt.str();
+ fmt.flush();
Result.append(fmtbuf.begin(), fmtbuf.end());
return object_error::success;
}