summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-26 22:52:05 +0000
committerAlp Toker <alp@nuanti.com>2014-06-26 22:52:05 +0000
commit8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d (patch)
tree7da91c52380a71a92a895b0c172ae28b83fb6011 /lib/Transforms
parenteca517deaa890b1658ed0452704f398ce80e47b8 (diff)
downloadllvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.gz
llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.bz2
llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.xz
Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Instrumentation/DebugIR.cpp10
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp15
-rw-r--r--lib/Transforms/Instrumentation/MemorySanitizer.cpp3
-rw-r--r--lib/Transforms/ObjCARC/ObjCARCOpts.cpp9
-rw-r--r--lib/Transforms/Utils/ASanStackFrameLayout.cpp3
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp36
6 files changed, 44 insertions, 32 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.
diff --git a/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
index 744fb24048..dd4dd50f0b 100644
--- a/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
+++ b/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
@@ -835,7 +835,8 @@ static MDString *AppendMDNodeToSourcePtr(unsigned NodeId,
// of line at the module level and to provide a very simple format
// encoding the information herein. Both of these makes it simpler to
// parse the annotations by a simple external program.
- string_ostream os;
+ std::string Str;
+ raw_string_ostream os(Str);
os << "(" << Inst->getParent()->getParent()->getName() << ",%"
<< Inst->getName() << ")";
@@ -848,7 +849,8 @@ static MDString *AppendMDNodeToSourcePtr(unsigned NodeId,
Hash = cast<MDString>(Node->getOperand(0));
}
} else if (Argument *Arg = dyn_cast<Argument>(Ptr)) {
- string_ostream os;
+ std::string str;
+ raw_string_ostream os(str);
os << "(" << Arg->getParent()->getName() << ",%" << Arg->getName()
<< ")";
Hash = MDString::get(Arg->getContext(), os.str());
@@ -858,7 +860,8 @@ static MDString *AppendMDNodeToSourcePtr(unsigned NodeId,
}
static std::string SequenceToString(Sequence A) {
- string_ostream os;
+ std::string str;
+ raw_string_ostream os(str);
os << A;
return os.str();
}
diff --git a/lib/Transforms/Utils/ASanStackFrameLayout.cpp b/lib/Transforms/Utils/ASanStackFrameLayout.cpp
index 42fd398d5f..cce016aafd 100644
--- a/lib/Transforms/Utils/ASanStackFrameLayout.cpp
+++ b/lib/Transforms/Utils/ASanStackFrameLayout.cpp
@@ -65,7 +65,8 @@ ComputeASanStackFrameLayout(SmallVectorImpl<ASanStackVariableDescription> &Vars,
Vars[i].Alignment = std::max(Vars[i].Alignment, kMinAlignment);
std::stable_sort(Vars.begin(), Vars.end(), CompareVars);
- small_string_ostream<2048> StackDescription;
+ SmallString<2048> StackDescriptionStorage;
+ raw_svector_ostream StackDescription(StackDescriptionStorage);
StackDescription << NumVars;
Layout->FrameAlignment = std::max(Granularity, Vars[0].Alignment);
SmallVector<uint8_t, 64> &SB(Layout->ShadowBytes);
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 2338d296cc..cb8a41dbea 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -212,23 +212,24 @@ class LoopVectorizationCostModel;
/// Optimization analysis message produced during vectorization. Messages inform
/// the user why vectorization did not occur.
class Report {
- string_ostream Message;
+ std::string Message;
+ raw_string_ostream Out;
Instruction *Instr;
public:
- Report(Instruction *I = nullptr) : Instr(I) {
- Message << "loop not vectorized: ";
+ Report(Instruction *I = nullptr) : Out(Message), Instr(I) {
+ Out << "loop not vectorized: ";
}
template <typename A> Report &operator<<(const A &Value) {
- Message << Value;
+ Out << Value;
return *this;
}
Instruction *getInstr() { return Instr; }
- StringRef str() { return Message.str(); }
- operator Twine() { return Message.str(); }
+ std::string &str() { return Out.str(); }
+ operator Twine() { return Out.str(); }
};
/// InnerLoopVectorizer vectorizes loops which contain only one basic
@@ -502,17 +503,18 @@ static void setDebugLocFromInst(IRBuilder<> &B, const Value *Ptr) {
#ifndef NDEBUG
/// \return string containing a file name and a line # for the given loop.
static std::string getDebugLocString(const Loop *L) {
- if (!L)
- return std::string();
-
- string_ostream OS;
- const DebugLoc LoopDbgLoc = L->getStartLoc();
- if (!LoopDbgLoc.isUnknown())
- LoopDbgLoc.print(L->getHeader()->getContext(), OS);
- else
- // Just print the module name.
- OS << L->getHeader()->getParent()->getParent()->getModuleIdentifier();
- return OS.str();
+ std::string Result;
+ if (L) {
+ raw_string_ostream OS(Result);
+ const DebugLoc LoopDbgLoc = L->getStartLoc();
+ if (!LoopDbgLoc.isUnknown())
+ LoopDbgLoc.print(L->getHeader()->getContext(), OS);
+ else
+ // Just print the module name.
+ OS << L->getHeader()->getParent()->getParent()->getModuleIdentifier();
+ OS.flush();
+ }
+ return Result;
}
#endif