diff options
author | Reid Kleckner <rnk@google.com> | 2018-10-23 20:54:43 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-10-23 20:54:43 +0000 |
commit | 1989ce13fd9d206b0e5ab20e7d135f308748c732 (patch) | |
tree | 310e90c1273e7371085f60a763a53f8dc3ecd756 /unittests | |
parent | e4c9c3925cc54cf13e6c99b68cafd15f50458d25 (diff) |
Revert r345077 "[ORC] Change how non-exported symbols are matched during lookup."
Doesn't build on Windows. The call to 'lookup' is ambiguous. Clang and
MSVC agree, anyway.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/787
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): error C2668: 'llvm::orc::ExecutionSession::lookup': ambiguous call to overloaded function
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(823): note: could be 'llvm::Expected<llvm::JITEvaluatedSymbol> llvm::orc::ExecutionSession::lookup(llvm::ArrayRef<llvm::orc::JITDylib *>,llvm::orc::SymbolStringPtr)'
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(817): note: or 'llvm::Expected<llvm::JITEvaluatedSymbol> llvm::orc::ExecutionSession::lookup(const llvm::orc::JITDylibSearchList &,llvm::orc::SymbolStringPtr)'
C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315): note: while trying to match the argument list '(initializer list, llvm::orc::SymbolStringPtr)'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp | 61 | ||||
-rw-r--r-- | unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp | 8 |
2 files changed, 32 insertions, 37 deletions
diff --git a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp index 1444ba74364..1ccc4755957 100644 --- a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp +++ b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp @@ -48,8 +48,7 @@ TEST_F(CoreAPIsStandardTest, BasicSuccessfulLookup) { FooMR = std::make_shared<MaterializationResponsibility>(std::move(R)); }))); - ES.lookup({{&JD, false}}, {Foo}, OnResolution, OnReady, - NoDependenciesToRegister); + ES.lookup({&JD}, {Foo}, OnResolution, OnReady, NoDependenciesToRegister); EXPECT_FALSE(OnResolutionRun) << "Should not have been resolved yet"; EXPECT_FALSE(OnReadyRun) << "Should not have been marked ready yet"; @@ -102,8 +101,7 @@ TEST_F(CoreAPIsStandardTest, EmptyLookup) { OnReadyRun = true; }; - ES.lookup({{&JD, false}}, {}, OnResolution, OnReady, - NoDependenciesToRegister); + ES.lookup({&JD}, {}, OnResolution, OnReady, NoDependenciesToRegister); EXPECT_TRUE(OnResolvedRun) << "OnResolved was not run for empty query"; EXPECT_TRUE(OnReadyRun) << "OnReady was not run for empty query"; @@ -150,7 +148,7 @@ TEST_F(CoreAPIsStandardTest, RemoveSymbolsTest) { bool OnResolvedRun = false; bool OnReadyRun = false; - ES.lookup({{&JD, false}}, {Foo, Baz}, + ES.lookup({&JD}, {Foo, Baz}, [&](Expected<SymbolMap> Result) { EXPECT_TRUE(!!Result) << "OnResolved failed unexpectedly"; consumeError(Result.takeError()); @@ -231,8 +229,7 @@ TEST_F(CoreAPIsStandardTest, LookupWithHiddenSymbols) { auto &JD2 = ES.createJITDylib("JD2"); cantFail(JD2.define(absoluteSymbols({{Bar, QuxSym}}))); - /// Try a blocking lookup. - auto Result = cantFail(ES.lookup({{&JD, false}, {&JD2, false}}, {Foo, Bar})); + auto Result = cantFail(ES.lookup({&JD, &JD2}, {Foo, Bar})); EXPECT_EQ(Result.size(), 2U) << "Unexpected number of results"; EXPECT_EQ(Result.count(Foo), 1U) << "Missing result for \"Foo\""; @@ -278,7 +275,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicAliases) { {Qux, {Bar, JITSymbolFlags::Weak}}}))); cantFail(JD.define(absoluteSymbols({{Qux, QuxSym}}))); - auto Result = ES.lookup({{&JD, false}}, {Baz, Qux}); + auto Result = ES.lookup({&JD}, {Baz, Qux}); EXPECT_TRUE(!!Result) << "Unexpected lookup failure"; EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\""; EXPECT_EQ(Result->count(Qux), 1U) << "No result for \"qux\""; @@ -293,7 +290,7 @@ TEST_F(CoreAPIsStandardTest, TestChainedAliases) { cantFail(JD.define(symbolAliases( {{Baz, {Bar, BazSym.getFlags()}}, {Bar, {Foo, BarSym.getFlags()}}}))); - auto Result = ES.lookup({{&JD, false}}, {Bar, Baz}); + auto Result = ES.lookup({&JD}, {Bar, Baz}); EXPECT_TRUE(!!Result) << "Unexpected lookup failure"; EXPECT_EQ(Result->count(Bar), 1U) << "No result for \"bar\""; EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\""; @@ -312,7 +309,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicReExports) { cantFail(JD2.define(reexports(JD, {{Bar, {Foo, BarSym.getFlags()}}}))); - auto Result = cantFail(ES.lookup({{&JD2, false}}, Bar)); + auto Result = cantFail(ES.lookup({&JD2}, Bar)); EXPECT_EQ(Result.getAddress(), FooSym.getAddress()) << "Re-export Bar for symbol Foo should match FooSym's address"; } @@ -338,7 +335,7 @@ TEST_F(CoreAPIsStandardTest, TestThatReExportsDontUnnecessarilyMaterialize) { cantFail(JD2.define(reexports( JD, {{Baz, {Foo, BazSym.getFlags()}}, {Qux, {Bar, QuxSym.getFlags()}}}))); - auto Result = cantFail(ES.lookup({{&JD2, false}}, Baz)); + auto Result = cantFail(ES.lookup({&JD2}, Baz)); EXPECT_EQ(Result.getAddress(), FooSym.getAddress()) << "Re-export Baz for symbol Foo should match FooSym's address"; @@ -353,13 +350,13 @@ TEST_F(CoreAPIsStandardTest, TestReexportsGenerator) { auto Filter = [this](SymbolStringPtr Name) { return Name != Bar; }; - JD.setGenerator(ReexportsGenerator(JD2, false, Filter)); + JD.setGenerator(ReexportsGenerator(JD2, Filter)); auto Flags = JD.lookupFlags({Foo, Bar, Baz}); EXPECT_EQ(Flags.size(), 1U) << "Unexpected number of results"; EXPECT_EQ(Flags[Foo], FooSym.getFlags()) << "Unexpected flags for Foo"; - auto Result = cantFail(ES.lookup({{&JD, false}}, Foo)); + auto Result = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(Result.getAddress(), FooSym.getAddress()) << "Incorrect reexported symbol address"; @@ -380,7 +377,7 @@ TEST_F(CoreAPIsStandardTest, TestTrivialCircularDependency) { FooReady = true; }; - ES.lookup({{&JD, false}}, {Foo}, std::move(OnResolution), std::move(OnReady), + ES.lookup({&JD}, {Foo}, std::move(OnResolution), std::move(OnReady), NoDependenciesToRegister); FooR->resolve({{Foo, FooSym}}); @@ -437,8 +434,8 @@ TEST_F(CoreAPIsStandardTest, TestCircularDependenceInOneJITDylib) { // Issue a lookup for Foo. Use NoDependenciesToRegister: We're going to add // the dependencies manually below. - ES.lookup({{&JD, false}}, {Foo}, std::move(OnFooResolution), - std::move(OnFooReady), NoDependenciesToRegister); + ES.lookup({&JD}, {Foo}, std::move(OnFooResolution), std::move(OnFooReady), + NoDependenciesToRegister); bool BarResolved = false; bool BarReady = false; @@ -452,8 +449,8 @@ TEST_F(CoreAPIsStandardTest, TestCircularDependenceInOneJITDylib) { BarReady = true; }; - ES.lookup({{&JD, false}}, {Bar}, std::move(OnBarResolution), - std::move(OnBarReady), NoDependenciesToRegister); + ES.lookup({&JD}, {Bar}, std::move(OnBarResolution), std::move(OnBarReady), + NoDependenciesToRegister); bool BazResolved = false; bool BazReady = false; @@ -468,8 +465,8 @@ TEST_F(CoreAPIsStandardTest, TestCircularDependenceInOneJITDylib) { BazReady = true; }; - ES.lookup({{&JD, false}}, {Baz}, std::move(OnBazResolution), - std::move(OnBazReady), NoDependenciesToRegister); + ES.lookup({&JD}, {Baz}, std::move(OnBazResolution), std::move(OnBazReady), + NoDependenciesToRegister); // Add a circular dependency: Foo -> Bar, Bar -> Baz, Baz -> Foo. FooR->addDependenciesForAll({{&JD, SymbolNameSet({Bar})}}); @@ -591,7 +588,7 @@ TEST_F(CoreAPIsStandardTest, AddAndMaterializeLazySymbol) { OnReadyRun = true; }; - ES.lookup({{&JD, false}}, Names, std::move(OnResolution), std::move(OnReady), + ES.lookup({&JD}, Names, std::move(OnResolution), std::move(OnReady), NoDependenciesToRegister); EXPECT_TRUE(FooMaterialized) << "Foo was not materialized"; @@ -640,7 +637,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicWeakSymbolMaterialization) { OnReadyRun = true; }; - ES.lookup({{&JD, false}}, {Bar}, std::move(OnResolution), std::move(OnReady), + ES.lookup({&JD}, {Bar}, std::move(OnResolution), std::move(OnReady), NoDependenciesToRegister); EXPECT_TRUE(OnResolvedRun) << "OnResolved not run"; @@ -669,13 +666,13 @@ TEST_F(CoreAPIsStandardTest, DefineMaterializingSymbol) { }); cantFail(JD.define(MU)); - cantFail(ES.lookup({{&JD, false}}, Foo)); + cantFail(ES.lookup({&JD}, Foo)); // Assert that materialization is complete by now. ExpectNoMoreMaterialization = true; // Look up bar to verify that no further materialization happens. - auto BarResult = cantFail(ES.lookup({{&JD, false}}, Bar)); + auto BarResult = cantFail(ES.lookup({&JD}, Bar)); EXPECT_EQ(BarResult.getAddress(), BarSym.getAddress()) << "Expected Bar == BarSym"; } @@ -688,7 +685,7 @@ TEST_F(CoreAPIsStandardTest, GeneratorTest) { return SymbolNameSet({Bar}); }); - auto Result = cantFail(ES.lookup({{&JD, false}}, {Foo, Bar})); + auto Result = cantFail(ES.lookup({&JD}, {Foo, Bar})); EXPECT_EQ(Result.count(Bar), 1U) << "Expected to find fallback def for 'bar'"; EXPECT_EQ(Result[Bar].getAddress(), BarSym.getAddress()) @@ -704,7 +701,7 @@ TEST_F(CoreAPIsStandardTest, FailResolution) { cantFail(JD.define(MU)); SymbolNameSet Names({Foo, Bar}); - auto Result = ES.lookup({{&JD, false}}, Names); + auto Result = ES.lookup({&JD}, Names); EXPECT_FALSE(!!Result) << "Expected failure"; if (!Result) { @@ -736,7 +733,7 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithUnthreadedMaterialization) { cantFail(JD.define(MU)); - auto FooLookupResult = cantFail(ES.lookup({{&JD, false}}, Foo)); + auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress()) << "lookup returned an incorrect address"; @@ -757,7 +754,7 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) { cantFail(JD.define(absoluteSymbols({{Foo, FooSym}}))); - auto FooLookupResult = cantFail(ES.lookup({{&JD, false}}, Foo)); + auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress()) << "lookup returned an incorrect address"; @@ -805,14 +802,14 @@ TEST_F(CoreAPIsStandardTest, TestGetRequestedSymbolsAndReplace) { EXPECT_FALSE(FooMaterialized) << "Foo should not be materialized yet"; EXPECT_FALSE(BarMaterialized) << "Bar should not be materialized yet"; - auto FooSymResult = cantFail(ES.lookup({{&JD, false}}, Foo)); + auto FooSymResult = cantFail(ES.lookup({&JD}, Foo)); EXPECT_EQ(FooSymResult.getAddress(), FooSym.getAddress()) << "Address mismatch for Foo"; EXPECT_TRUE(FooMaterialized) << "Foo should be materialized now"; EXPECT_FALSE(BarMaterialized) << "Bar still should not be materialized"; - auto BarSymResult = cantFail(ES.lookup({{&JD, false}}, Bar)); + auto BarSymResult = cantFail(ES.lookup({&JD}, Bar)); EXPECT_EQ(BarSymResult.getAddress(), BarSym.getAddress()) << "Address mismatch for Bar"; EXPECT_TRUE(BarMaterialized) << "Bar should be materialized now"; @@ -832,7 +829,7 @@ TEST_F(CoreAPIsStandardTest, TestMaterializationResponsibilityDelegation) { cantFail(JD.define(MU)); - auto Result = ES.lookup({{&JD, false}}, {Foo, Bar}); + auto Result = ES.lookup({&JD}, {Foo, Bar}); EXPECT_TRUE(!!Result) << "Result should be a success value"; EXPECT_EQ(Result->count(Foo), 1U) << "\"Foo\" entry missing"; @@ -864,7 +861,7 @@ TEST_F(CoreAPIsStandardTest, TestMaterializeWeakSymbol) { auto OnReady = [](Error Err) { cantFail(std::move(Err)); }; - ES.lookup({{&JD, false}}, {Foo}, std::move(OnResolution), std::move(OnReady), + ES.lookup({&JD}, {Foo}, std::move(OnResolution), std::move(OnReady), NoDependenciesToRegister); auto MU2 = llvm::make_unique<SimpleMaterializationUnit>( diff --git a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp index b6c362b8aaa..1660670ae63 100644 --- a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp +++ b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp @@ -66,7 +66,7 @@ static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj, ObjLayer.setProcessAllSections(ProcessAllSections); cantFail(ObjLayer.add(JD, std::move(Obj), ES.allocateVModule())); - ES.lookup({{&JD, false}}, {Foo}, OnResolveDoNothing, OnReadyDoNothing, + ES.lookup({&JD}, {Foo}, OnResolveDoNothing, OnReadyDoNothing, NoDependenciesToRegister); return DebugSectionSeen; } @@ -157,8 +157,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) { ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true); cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule())); - ES.lookup({{&JD, false}}, {Foo}, - [](Expected<SymbolMap> R) { cantFail(std::move(R)); }, + ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); }, [](Error Err) { cantFail(std::move(Err)); }, NoDependenciesToRegister); } @@ -220,8 +219,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) { ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true); cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule())); - ES.lookup({{&JD, false}}, {Foo}, - [](Expected<SymbolMap> R) { cantFail(std::move(R)); }, + ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); }, [](Error Err) { cantFail(std::move(Err)); }, NoDependenciesToRegister); } |