blob: 0dba66d4753519d96762a5439bfaf9bfdea08aca [file] [log] [blame]
David Blaikiee960a4e2015-02-23 00:36:25 +00001//===- LazyEmittingLayerTest.cpp - Unit tests for the lazy emitting layer -===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
Chandler Carruth9a67b072017-06-06 11:06:56 +000011#include "llvm/ExecutionEngine/RuntimeDyld.h"
David Blaikiee960a4e2015-02-23 00:36:25 +000012#include "gtest/gtest.h"
13
14namespace {
15
16struct MockBaseLayer {
Lang Hamescd9d49b2017-06-23 23:25:28 +000017 typedef int ModuleHandleT;
18 ModuleHandleT addModule(
19 std::shared_ptr<llvm::Module>,
Lang Hames633fe142015-03-30 03:37:06 +000020 std::unique_ptr<llvm::RuntimeDyld::MemoryManager> MemMgr,
Lang Hamesad4a9112016-08-01 20:49:11 +000021 std::unique_ptr<llvm::JITSymbolResolver> Resolver) {
Lang Hames633fe142015-03-30 03:37:06 +000022 EXPECT_FALSE(MemMgr);
David Blaikiee960a4e2015-02-23 00:36:25 +000023 return 42;
24 }
25};
26
27TEST(LazyEmittingLayerTest, Empty) {
28 MockBaseLayer M;
29 llvm::orc::LazyEmittingLayer<MockBaseLayer> L(M);
Lang Hames4ce98662017-07-07 02:59:13 +000030 cantFail(L.addModule(std::unique_ptr<llvm::Module>(), nullptr));
David Blaikiee960a4e2015-02-23 00:36:25 +000031}
32
33}