diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2020-01-28 20:23:46 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2020-01-28 23:25:25 +0100 |
commit | adcd02683856c30ba6f349279509acecd90063df (patch) | |
tree | 7b5927ef2ecab1618842183fac5ebe848f5832dd /clang/unittests/Tooling/CompilationDatabaseTest.cpp | |
parent | 5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 (diff) | |
download | llvm-adcd02683856c30ba6f349279509acecd90063df.zip llvm-adcd02683856c30ba6f349279509acecd90063df.tar.gz llvm-adcd02683856c30ba6f349279509acecd90063df.tar.bz2 |
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.
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 56ebadc..cc948b8 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -87,11 +87,11 @@ TEST(JSONCompilationDatabase, GetAllFiles) { std::vector<std::string> expected_files; SmallString<16> PathStorage; llvm::sys::path::native("//net/dir/file1", PathStorage); - expected_files.push_back(PathStorage.str()); + expected_files.push_back(std::string(PathStorage.str())); llvm::sys::path::native("//net/dir/file2", PathStorage); - expected_files.push_back(PathStorage.str()); + expected_files.push_back(std::string(PathStorage.str())); llvm::sys::path::native("//net/file1", PathStorage); - expected_files.push_back(PathStorage.str()); + expected_files.push_back(std::string(PathStorage.str())); EXPECT_EQ(expected_files, getAllFiles("[{\"directory\":\"//net/dir\"," "\"command\":\"command\"," @@ -654,7 +654,7 @@ struct MemCDB : public CompilationDatabase { std::vector<std::string> getAllFiles() const override { std::vector<std::string> Result; for (const auto &Entry : Entries) - Result.push_back(Entry.first()); + Result.push_back(std::string(Entry.first())); return Result; } }; @@ -682,7 +682,7 @@ protected: llvm::sys::path::native(File); llvm::SmallString<64> Result; llvm::sys::path::append(Result, Dir, File); - return Result.str(); + return std::string(Result.str()); } MemCDB::EntryMap Entries; @@ -723,7 +723,7 @@ protected: Proxy.consume_front(llvm::sys::path::get_separator()); llvm::SmallString<32> Result = Proxy; llvm::sys::path::native(Result, llvm::sys::path::Style::posix); - return Result.str(); + return std::string(Result.str()); } }; |