Skip to content
Snippets Groups Projects
Commit 8aa64488 authored by Mehdi Amini's avatar Mehdi Amini
Browse files

Use llvm::raw_string_ostream instead of std::stringstream (NFC)

As a side effect, this avoid having to call .data() on the StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283416 91177308-0d34-0410-b5e6-96231b3b80d8
parent 76767b5a
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ CompilationDatabase::~CompilationDatabase() {}
std::unique_ptr<CompilationDatabase>
CompilationDatabase::loadFromDirectory(StringRef BuildDirectory,
std::string &ErrorMessage) {
std::stringstream ErrorStream;
llvm::raw_string_ostream ErrorStream(ErrorMessage);
for (CompilationDatabasePluginRegistry::iterator
It = CompilationDatabasePluginRegistry::begin(),
Ie = CompilationDatabasePluginRegistry::end();
......@@ -49,9 +49,8 @@ CompilationDatabase::loadFromDirectory(StringRef BuildDirectory,
if (std::unique_ptr<CompilationDatabase> DB =
Plugin->loadFromDirectory(BuildDirectory, DatabaseErrorMessage))
return DB;
ErrorStream << It->getName().data() << ": " << DatabaseErrorMessage << "\n";
ErrorStream << It->getName() << ": " << DatabaseErrorMessage << "\n";
}
ErrorMessage = ErrorStream.str();
return nullptr;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment