From adcd02683856c30ba6f349279509acecd90063df Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 28 Jan 2020 20:23:46 +0100 Subject: 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. --- llvm/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp | 2 +- .../ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp | 2 +- llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/unittests/ExecutionEngine/Orc') diff --git a/llvm/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp index 7b6d4b0..4b0d67c 100644 --- a/llvm/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp @@ -72,7 +72,7 @@ TEST_F(LegacyAPIsStandardTest, LegacyLookupHelpersFn) { bool BarMaterialized = false; BarSym.setFlags(BarSym.getFlags() | JITSymbolFlags::Weak); - auto LegacyLookup = [&](const std::string &Name) -> JITSymbol { + auto LegacyLookup = [&](StringRef Name) -> JITSymbol { if (Name == "foo") return FooSym; diff --git a/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp index 896914d..c1eb455 100644 --- a/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp @@ -185,7 +185,7 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) { cantFail(ObjLayer.addObject(K1, std::move(Obj1))); auto K2 = ES.allocateVModule(); - auto LegacyLookup = [&](const std::string &Name) { + auto LegacyLookup = [&](StringRef Name) { return ObjLayer.findSymbol(Name, true); }; diff --git a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp index 429d917..31a4247 100644 --- a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp @@ -354,7 +354,7 @@ TEST(RemoteObjectLayer, FindSymbol) { if (Name == "foobar") return JITSymbol(0x12348765, JITSymbolFlags::Exported); if (Name == "badsymbol") - return make_error(Name); + return make_error(std::string(Name)); return nullptr; }; return 42; @@ -435,7 +435,7 @@ TEST(RemoteObjectLayer, FindSymbolIn) { [](StringRef Name, bool ExportedSymbolsOnly) -> JITSymbol { if (Name == "foobar") return JITSymbol(0x12348765, JITSymbolFlags::Exported); - return make_error(Name); + return make_error(std::string(Name)); }; // Dummy symbol table entry - this should not be visible to // findSymbolIn. @@ -443,7 +443,7 @@ TEST(RemoteObjectLayer, FindSymbolIn) { [](StringRef Name, bool ExportedSymbolsOnly) -> JITSymbol { if (Name == "barbaz") return JITSymbol(0xdeadbeef, JITSymbolFlags::Exported); - return make_error(Name); + return make_error(std::string(Name)); }; return 42; -- cgit v1.1