[Unittest] Clean up formatting, NFC
authorJoseph Tremoulet <jotrem@microsoft.com>
Wed, 3 Feb 2016 17:11:24 +0000 (17:11 +0000)
committerJoseph Tremoulet <jotrem@microsoft.com>
Wed, 3 Feb 2016 17:11:24 +0000 (17:11 +0000)
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

llvm-svn: 259663

llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp

index e91194b..908dba1 100644 (file)
@@ -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);
 }
 }