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.
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
index ef7f82d..ca00837 100644
--- a/llvm/unittests/ADT/TripleTest.cpp
+++ b/llvm/unittests/ADT/TripleTest.cpp
@@ -584,7 +584,7 @@
}
static std::string Join(StringRef A, StringRef B, StringRef C) {
- std::string Str = A;
+ std::string Str = std::string(A);
Str += '-';
Str += B;
Str += '-';
@@ -593,7 +593,7 @@
}
static std::string Join(StringRef A, StringRef B, StringRef C, StringRef D) {
- std::string Str = A;
+ std::string Str = std::string(A);
Str += '-';
Str += B;
Str += '-';