blob: cc67aa07b802a47147c1d6b7ebe833bf5c312768 [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;
Lang Hames17164542019-07-17 16:40:52 +000025 llvm::orc::LazyEmittingLayer<MockBaseLayer> L(
26 llvm::AcknowledgeORCv1Deprecation, M);
Lang Hames4b546c92018-02-06 21:25:11 +000027 cantFail(
28 L.addModule(llvm::orc::VModuleKey(), std::unique_ptr<llvm::Module>()));
David Blaikiee960a4e2015-02-23 00:36:25 +000029}
30
31}