From d7aa78535c4cfe140e288ef8b656388877a347a3 Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Wed, 18 Feb 2015 03:42:15 +0000 Subject: [PATCH] [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 --- include/llvm/Analysis/LoopAccessAnalysis.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/llvm/Analysis/LoopAccessAnalysis.h b/include/llvm/Analysis/LoopAccessAnalysis.h index 909c47bd4c8..f02b4fc3732 100644 --- a/include/llvm/Analysis/LoopAccessAnalysis.h +++ b/include/llvm/Analysis/LoopAccessAnalysis.h @@ -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 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. -- 2.34.1