blob: 88d12cd103a9213f4dc0d0df65f384fcf3e8375d [file] [log] [blame]
David Blaikiee960a4e2015-02-23 00:36:25 +00001//===- LazyEmittingLayerTest.cpp - Unit tests for the lazy emitting layer -===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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 Blaikiee960a4e2015-02-23 00:36:25 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
Chandler Carruth9a67b072017-06-06 11:06:56 +000010#include "llvm/ExecutionEngine/RuntimeDyld.h"
David Blaikiee960a4e2015-02-23 00:36:25 +000011#include "gtest/gtest.h"
12
13namespace {
14
15struct MockBaseLayer {
Lang Hamescd9d49b2017-06-23 23:25:28 +000016 typedef int ModuleHandleT;
Lang Hames4b546c92018-02-06 21:25:11 +000017 ModuleHandleT addModule(llvm::orc::VModuleKey,
18 std::shared_ptr<llvm::Module>) {
David Blaikiee960a4e2015-02-23 00:36:25 +000019 return 42;
20 }
21};
22
23TEST(LazyEmittingLayerTest, Empty) {
24 MockBaseLayer M;
25 llvm::orc::LazyEmittingLayer<MockBaseLayer> L(M);
Lang Hames4b546c92018-02-06 21:25:11 +000026 cantFail(
27 L.addModule(llvm::orc::VModuleKey(), std::unique_ptr<llvm::Module>()));
David Blaikiee960a4e2015-02-23 00:36:25 +000028}
29
30}