[llvm] r259663 - [Unittest] Clean up formatting, NFC
Joseph Tremoulet via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 3 09:11:24 PST 2016
Author: josepht
Date: Wed Feb 3 11:11:24 2016
New Revision: 259663
URL: http://llvm.org/viewvc/llvm-project?rev=259663&view=rev
Log:
[Unittest] Clean up formatting, NFC
Summary:
Use an early return to reduce indentation.
Remove unused local.
Reviewers: dblaikie, lhames
Subscribers: lhames, llvm-commits
Differential Revision: http://reviews.llvm.org/D16513
Modified:
llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp?rev=259663&r1=259662&r2=259663&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp Wed Feb 3 11:11:24 2016
@@ -279,60 +279,59 @@ TEST(ObjectTransformLayerTest, Main) {
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 *) override { return false; }
- };
-
- // Construct the jit layers.
- ObjectLinkingLayer<> BaseLayer;
- auto IdentityTransform = [](
- std::unique_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>>
- Obj) { return Obj; };
- ObjectTransformLayer<decltype(BaseLayer), decltype(IdentityTransform)>
- TransformLayer(BaseLayer, IdentityTransform);
- auto NullCompiler = [](llvm::Module &) {
- return llvm::object::OwningBinary<llvm::object::ObjectFile>();
- };
- IRCompileLayer<decltype(TransformLayer)> CompileLayer(TransformLayer,
- NullCompiler);
- std::vector<llvm::Module *> Modules;
-
- // Make sure that the calls from IRCompileLayer to ObjectTransformLayer
- // compile.
- NullResolver Resolver;
- NullManager Manager;
- CompileLayer.addModuleSet(std::vector<llvm::Module *>(), &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 *) override { return false; }
+ };
+
+ // Construct the jit layers.
+ ObjectLinkingLayer<> BaseLayer;
+ auto IdentityTransform = [](
+ std::unique_ptr<llvm::object::OwningBinary<llvm::object::ObjectFile>>
+ Obj) { return Obj; };
+ ObjectTransformLayer<decltype(BaseLayer), decltype(IdentityTransform)>
+ TransformLayer(BaseLayer, IdentityTransform);
+ auto NullCompiler = [](llvm::Module &) {
+ return llvm::object::OwningBinary<llvm::object::ObjectFile>();
+ };
+ IRCompileLayer<decltype(TransformLayer)> CompileLayer(TransformLayer,
+ NullCompiler);
+
+ // Make sure that the calls from IRCompileLayer to ObjectTransformLayer
+ // compile.
+ NullResolver Resolver;
+ NullManager Manager;
+ CompileLayer.addModuleSet(std::vector<llvm::Module *>(), &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);
}
}
More information about the llvm-commits
mailing list