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/Index/IndexTests.cpp b/clang/unittests/Index/IndexTests.cpp
index 3ccec683..a279f48 100644
--- a/clang/unittests/Index/IndexTests.cpp
+++ b/clang/unittests/Index/IndexTests.cpp
@@ -95,7 +95,7 @@
                              SymbolRoleSet Roles, SourceLocation Loc) override {
     TestSymbol S;
     S.SymInfo = getSymbolInfoForMacro(*MI);
-    S.QName = Name->getName();
+    S.QName = std::string(Name->getName());
     S.WrittenPos = Position::fromSourceLocation(Loc, AST->getSourceManager());
     S.DeclPos = Position::fromSourceLocation(MI->getDefinitionLoc(),
                                              AST->getSourceManager());