[LoopAccesses] Make raw_string_ostream local in VectorizationReport

Since VectorizationReport will be part of the result of the analysis it
will be stored in a container.  However, one of its members is a
raw_string_ostream which cannot be copy-constructed.

This makes the raw_string_ostream local to the << operator.

This is part of the patchset that converts LoopAccessAnalysis into an
actual analysis pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229620 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2015-02-18 03:42:15 +00:00
parent 5506e22865
commit d7aa78535c

View File

@ -36,23 +36,22 @@ class SCEV;
/// the user why vectorization did not occur.
class VectorizationReport {
std::string Message;
raw_string_ostream Out;
Instruction *Instr;
public:
VectorizationReport(Instruction *I = nullptr) : Out(Message), Instr(I) {
Out << "loop not vectorized: ";
}
VectorizationReport(Instruction *I = nullptr)
: Message("loop not vectorized: "), Instr(I) {}
template <typename A> VectorizationReport &operator<<(const A &Value) {
raw_string_ostream Out(Message);
Out << Value;
return *this;
}
Instruction *getInstr() { return Instr; }
std::string &str() { return Out.str(); }
operator Twine() { return Out.str(); }
std::string &str() { return Message; }
operator Twine() { return Message; }
/// \brief Emit an analysis note with the debug location from the instruction
/// in \p Message if available. Otherwise use the location of \p TheLoop.