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/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 5cf0ca8..2d3440c 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -98,7 +98,7 @@
const Function *F = L->getHeader()->getParent();
if (!llvm::isFunctionInPrintList(F->getName()))
return;
- llvm::printLoop(const_cast<Loop &>(*L), dbgs(), Banner);
+ llvm::printLoop(const_cast<Loop &>(*L), dbgs(), std::string(Banner));
}
/// Generic IR-printing helper that unpacks a pointer to IRUnit wrapped into
@@ -127,7 +127,7 @@
if (any_isa<const LazyCallGraph::SCC *>(IR)) {
const LazyCallGraph::SCC *C = any_cast<const LazyCallGraph::SCC *>(IR);
assert(C && "scc should be valid for printing");
- std::string Extra = formatv(" (scc: {0})", C->getName());
+ std::string Extra = std::string(formatv(" (scc: {0})", C->getName()));
printIR(C, Banner, Extra);
return;
}