summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r--lib/Transforms/Instrumentation/DebugIR.cpp10
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp15
-rw-r--r--lib/Transforms/Instrumentation/MemorySanitizer.cpp3
3 files changed, 17 insertions, 11 deletions
diff --git a/lib/Transforms/Instrumentation/DebugIR.cpp b/lib/Transforms/Instrumentation/DebugIR.cpp
index 56e60e6984..f2f1738808 100644
--- a/lib/Transforms/Instrumentation/DebugIR.cpp
+++ b/lib/Transforms/Instrumentation/DebugIR.cpp
@@ -352,12 +352,14 @@ private:
}
std::string getTypeName(Type *T) {
- string_ostream OS;
+ std::string TypeName;
+ raw_string_ostream TypeStream(TypeName);
if (T)
- T->print(OS);
+ T->print(TypeStream);
else
- OS << "Printing <null> Type";
- return OS.str();
+ TypeStream << "Printing <null> Type";
+ TypeStream.flush();
+ return TypeName;
}
/// Returns the MDNode that represents type T if it is already created, or 0
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 5af938beae..cfeb62eb1f 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -316,9 +316,11 @@ namespace {
}
ReturnBlock = new GCOVBlock(i++, os);
- string_ostream FnNameLine;
- FnNameLine << getFunctionName(SP) << SP.getLineNumber();
- FuncChecksum = hash_value(FnNameLine.str());
+ std::string FunctionNameAndLine;
+ raw_string_ostream FNLOS(FunctionNameAndLine);
+ FNLOS << getFunctionName(SP) << SP.getLineNumber();
+ FNLOS.flush();
+ FuncChecksum = hash_value(FunctionNameAndLine);
}
~GCOVFunction() {
@@ -335,14 +337,15 @@ namespace {
}
std::string getEdgeDestinations() {
- string_ostream EdgeDestinations;
+ std::string EdgeDestinations;
+ raw_string_ostream EDOS(EdgeDestinations);
Function *F = Blocks.begin()->first->getParent();
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
GCOVBlock &Block = *Blocks[I];
for (int i = 0, e = Block.OutEdges.size(); i != e; ++i)
- EdgeDestinations << Block.OutEdges[i]->Number;
+ EDOS << Block.OutEdges[i]->Number;
}
- return EdgeDestinations.str();
+ return EdgeDestinations;
}
uint32_t getFuncChecksum() {
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index bb88bc00ba..4ca0323807 100644
--- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2424,7 +2424,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
if (PoisonStack && MS.TrackOrigins) {
setOrigin(&I, getCleanOrigin());
- small_string_ostream<2048> StackDescription;
+ SmallString<2048> StackDescriptionStorage;
+ raw_svector_ostream StackDescription(StackDescriptionStorage);
// We create a string with a description of the stack allocation and
// pass it into __msan_set_alloca_origin.
// It will be printed by the run-time if stack-originated UMR is found.