diff options
author | Keno Fischer <kfischer@college.harvard.edu> | 2015-01-27 19:29:00 +0000 |
---|---|---|
committer | Keno Fischer <kfischer@college.harvard.edu> | 2015-01-27 19:29:00 +0000 |
commit | 5f92a08fc051d921f75af0cab01ce6a5b255b9c4 (patch) | |
tree | 73c7be64de5fffb63c8af12ee74ffacb2b106f01 /llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp | |
parent | b1e72eca0caf9bb10d66577573d4845557e61c25 (diff) | |
download | bcm5719-llvm-5f92a08fc051d921f75af0cab01ce6a5b255b9c4.tar.gz bcm5719-llvm-5f92a08fc051d921f75af0cab01ce6a5b255b9c4.zip |
[ExecutionEngine] FindFunctionNamed: Skip declarations
Summary:
Basically all other methods that look up functions by name skip them if they are mere declarations.
Do the same in FindFunctionNamed.
Reviewers: lhames
Reviewed By: lhames
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7068
llvm-svn: 227227
Diffstat (limited to 'llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp')
-rw-r--r-- | llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp index b0d1bb39c7f..da6e25a3d51 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp @@ -392,4 +392,23 @@ TEST_F(MCJITMultipleModuleTest, cross_module_dependency_case3) { ptr = TheJIT->getFunctionAddress(FB2->getName().str()); checkAccumulate(ptr); } + +// Test that FindFunctionNamed finds the definition of +// a function in the correct module. We check two functions +// in two different modules, to make sure that for at least +// one of them MCJIT had to ignore the extern declaration. +TEST_F(MCJITMultipleModuleTest, FindFunctionNamed_test) { + SKIP_UNSUPPORTED_PLATFORM; + + std::unique_ptr<Module> A, B; + Function *FA, *FB1, *FB2; + createCrossModuleRecursiveCase(A, FA, B, FB1, FB2); + + createJIT(std::move(A)); + TheJIT->addModule(std::move(B)); + + EXPECT_EQ(FA, TheJIT->FindFunctionNamed(FA->getName().data())); + EXPECT_EQ(FB1, TheJIT->FindFunctionNamed(FB1->getName().data())); +} + } |