Index: unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp +++ unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp @@ -279,60 +279,60 @@ EXPECT_EQ(289, *OwnedObj) << "Expected incrementing transform"; volatile bool RunStaticChecks = false; - if (RunStaticChecks) { - // Make sure that ObjectTransformLayer implements the object layer concept - // correctly by sandwitching one between an ObjectLinkingLayer and an - // IRCompileLayer, verifying that it compiles if we have a call to the - // IRComileLayer's addModuleSet that should call the transform layer's - // addObjectSet, and also calling the other public transform layer methods - // directly to make sure the methods they intend to forward to exist on - // the ObjectLinkingLayer. - - // We'll need a concrete MemoryManager class. - class NullManager : public llvm::RuntimeDyld::MemoryManager { - public: - uint8_t *allocateCodeSection(uintptr_t, unsigned, unsigned, - llvm::StringRef) override { - return nullptr; - } - uint8_t *allocateDataSection(uintptr_t, unsigned, unsigned, - llvm::StringRef, bool) override { - return nullptr; - } - void registerEHFrames(uint8_t *, uint64_t, size_t) override {} - void deregisterEHFrames(uint8_t *, uint64_t, size_t) override {} - bool finalizeMemory(std::string *) { return false; } - }; - - // Construct the jit layers. - ObjectLinkingLayer<> BaseLayer; - auto IdentityTransform = []( - std::unique_ptr> - Obj) { return std::move(Obj); }; - ObjectTransformLayer - TransformLayer(BaseLayer, IdentityTransform); - auto NullCompiler = [](llvm::Module &) { - return llvm::object::OwningBinary(); - }; - IRCompileLayer CompileLayer(TransformLayer, - NullCompiler); - std::vector Modules; - - // Make sure that the calls from IRCompileLayer to ObjectTransformLayer - // compile. - NullResolver Resolver; - NullManager Manager; - CompileLayer.addModuleSet(std::vector(), &Manager, - &Resolver); - - // Make sure that the calls from ObjectTransformLayer to ObjectLinkingLayer - // compile. - decltype(TransformLayer)::ObjSetHandleT ObjSet; - TransformLayer.emitAndFinalize(ObjSet); - TransformLayer.findSymbolIn(ObjSet, Name, false); - TransformLayer.findSymbol(Name, true); - TransformLayer.mapSectionAddress(ObjSet, nullptr, 0); - TransformLayer.removeObjectSet(ObjSet); - } + if (!RunStaticChecks) + return; + + // Make sure that ObjectTransformLayer implements the object layer concept + // correctly by sandwitching one between an ObjectLinkingLayer and an + // IRCompileLayer, verifying that it compiles if we have a call to the + // IRComileLayer's addModuleSet that should call the transform layer's + // addObjectSet, and also calling the other public transform layer methods + // directly to make sure the methods they intend to forward to exist on + // the ObjectLinkingLayer. + + // We'll need a concrete MemoryManager class. + class NullManager : public llvm::RuntimeDyld::MemoryManager { + public: + uint8_t *allocateCodeSection(uintptr_t, unsigned, unsigned, + llvm::StringRef) override { + return nullptr; + } + uint8_t *allocateDataSection(uintptr_t, unsigned, unsigned, llvm::StringRef, + bool) override { + return nullptr; + } + void registerEHFrames(uint8_t *, uint64_t, size_t) override {} + void deregisterEHFrames(uint8_t *, uint64_t, size_t) override {} + bool finalizeMemory(std::string *) { return false; } + }; + + // Construct the jit layers. + ObjectLinkingLayer<> BaseLayer; + auto IdentityTransform = []( + std::unique_ptr> + Obj) { return std::move(Obj); }; + ObjectTransformLayer + TransformLayer(BaseLayer, IdentityTransform); + auto NullCompiler = [](llvm::Module &) { + return llvm::object::OwningBinary(); + }; + IRCompileLayer CompileLayer(TransformLayer, + NullCompiler); + + // Make sure that the calls from IRCompileLayer to ObjectTransformLayer + // compile. + NullResolver Resolver; + NullManager Manager; + std::vector Modules; + CompileLayer.addModuleSet(Modules, &Manager, &Resolver); + + // Make sure that the calls from ObjectTransformLayer to ObjectLinkingLayer + // compile. + decltype(TransformLayer)::ObjSetHandleT ObjSet; + TransformLayer.emitAndFinalize(ObjSet); + TransformLayer.findSymbolIn(ObjSet, Name, false); + TransformLayer.findSymbol(Name, true); + TransformLayer.mapSectionAddress(ObjSet, nullptr, 0); + TransformLayer.removeObjectSet(ObjSet); } }