[NFC][tools] Return underlying strings directly instead of OS.str()

This avoids an unnecessary copy required by 'return OS.str()', allowing
instead for NRVO or implicit move. The .str() call (which flushes the
stream) is no longer required since 65b13610a5,
which made raw_string_ostream unbuffered by default.

Differential Revision: https://reviews.llvm.org/D115374
This commit is contained in:
Logan Smith 2021-12-09 15:03:19 -08:00
parent 5276002a89
commit 5336befe8c
3 changed files with 3 additions and 3 deletions

View File

@ -927,5 +927,5 @@ std::string TokenBuffer::dumpForTests() const {
M.EndExpanded);
}
}
return OS.str();
return Dump;
}

View File

@ -263,7 +263,7 @@ std::string syntax::Node::dumpTokens(const SourceManager &SM) const {
OS << " ";
}
});
return OS.str();
return Storage;
}
void syntax::Node::assertInvariants() const {

View File

@ -139,7 +139,7 @@ static std::string OptLLVM(const std::string &IR, CodeGenOpt::Level OLvl) {
Passes.run(*M);
return OS.str();
return outString;
}
// Takes a function and runs it on a set of inputs