From adcd02683856c30ba6f349279509acecd90063df Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 28 Jan 2020 20:23:46 +0100 Subject: Make llvm::StringRef to std::string conversions explicit. This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up. --- llvm/lib/Support/GraphWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/GraphWriter.cpp') diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp index c689a81..214a903 100644 --- a/llvm/lib/Support/GraphWriter.cpp +++ b/llvm/lib/Support/GraphWriter.cpp @@ -86,7 +86,7 @@ std::string llvm::createGraphFilename(const Twine &Name, int &FD) { } errs() << "Writing '" << Filename << "'... "; - return Filename.str(); + return std::string(Filename.str()); } // Execute the graph viewer. Return true if there were errors. @@ -147,7 +147,7 @@ static const char *getProgramName(GraphProgram::Name program) { bool llvm::DisplayGraph(StringRef FilenameRef, bool wait, GraphProgram::Name program) { - std::string Filename = FilenameRef; + std::string Filename = std::string(FilenameRef); std::string ErrMsg; std::string ViewerPath; GraphSession S; -- cgit v1.1