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/lib/XRay/FDRTraceExpander.cpp b/llvm/lib/XRay/FDRTraceExpander.cpp
index cb7f66b..b68e997 100644
--- a/llvm/lib/XRay/FDRTraceExpander.cpp
+++ b/llvm/lib/XRay/FDRTraceExpander.cpp
@@ -44,7 +44,7 @@
CurrentRecord.PId = PID;
CurrentRecord.TId = TID;
CurrentRecord.Type = RecordTypes::CUSTOM_EVENT;
- CurrentRecord.Data = R.data();
+ CurrentRecord.Data = std::string(R.data());
BuildingRecord = true;
}
return Error::success();
@@ -59,7 +59,7 @@
CurrentRecord.PId = PID;
CurrentRecord.TId = TID;
CurrentRecord.Type = RecordTypes::CUSTOM_EVENT;
- CurrentRecord.Data = R.data();
+ CurrentRecord.Data = std::string(R.data());
BuildingRecord = true;
}
return Error::success();
@@ -75,7 +75,7 @@
CurrentRecord.TId = TID;
CurrentRecord.RecordType = R.eventType();
CurrentRecord.Type = RecordTypes::TYPED_EVENT;
- CurrentRecord.Data = R.data();
+ CurrentRecord.Data = std::string(R.data());
BuildingRecord = true;
}
return Error::success();