David Blaikie | e960a4e | 2015-02-23 00:36:25 +0000 | [diff] [blame] | 1 | //===- LazyEmittingLayerTest.cpp - Unit tests for the lazy emitting layer -===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame^] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
David Blaikie | e960a4e | 2015-02-23 00:36:25 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h" |
Chandler Carruth | 9a67b07 | 2017-06-06 11:06:56 +0000 | [diff] [blame] | 10 | #include "llvm/ExecutionEngine/RuntimeDyld.h" |
David Blaikie | e960a4e | 2015-02-23 00:36:25 +0000 | [diff] [blame] | 11 | #include "gtest/gtest.h" |
| 12 | |
| 13 | namespace { |
| 14 | |
| 15 | struct MockBaseLayer { |
Lang Hames | cd9d49b | 2017-06-23 23:25:28 +0000 | [diff] [blame] | 16 | typedef int ModuleHandleT; |
Lang Hames | 4b546c9 | 2018-02-06 21:25:11 +0000 | [diff] [blame] | 17 | ModuleHandleT addModule(llvm::orc::VModuleKey, |
| 18 | std::shared_ptr<llvm::Module>) { |
David Blaikie | e960a4e | 2015-02-23 00:36:25 +0000 | [diff] [blame] | 19 | return 42; |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | TEST(LazyEmittingLayerTest, Empty) { |
| 24 | MockBaseLayer M; |
| 25 | llvm::orc::LazyEmittingLayer<MockBaseLayer> L(M); |
Lang Hames | 4b546c9 | 2018-02-06 21:25:11 +0000 | [diff] [blame] | 26 | cantFail( |
| 27 | L.addModule(llvm::orc::VModuleKey(), std::unique_ptr<llvm::Module>())); |
David Blaikie | e960a4e | 2015-02-23 00:36:25 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | } |