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/tools/llvm-exegesis/PerfHelperTest.cpp b/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp
index 7ff256f..5332b84 100644
--- a/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp
@@ -30,8 +30,8 @@
   Measure(
       makeArrayRef(SingleEvent),
       [&](const PerfEvent &Event, int64_t Value) {
-        CallbackEventName = Event.name();
-        CallbackEventNameFullyQualifed = Event.getPfmEventString();
+        CallbackEventName = std::string(Event.name());
+        CallbackEventNameFullyQualifed = std::string(Event.getPfmEventString());
         CallbackEventCycles = Value;
       },
       EmptyFn);