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/clang/unittests/Sema/ExternalSemaSourceTest.cpp b/clang/unittests/Sema/ExternalSemaSourceTest.cpp
index 44006e3..842eb83 100644
--- a/clang/unittests/Sema/ExternalSemaSourceTest.cpp
+++ b/clang/unittests/Sema/ExternalSemaSourceTest.cpp
@@ -48,7 +48,7 @@
 public:
   DiagnosticWatcher(StringRef From, StringRef To)
       : Chained(nullptr), FromName(From), ToName("'"), SeenCount(0) {
-    ToName.append(To);
+    ToName.append(std::string(To));
     ToName.append("'");
   }