Orc: Remove an unnecessary explicit scope
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 31 Jan 2020 18:14:18 +0000 (10:14 -0800)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 31 Jan 2020 18:30:25 +0000 (10:30 -0800)
(was useful at some point in the past for scoping some error handling
that's since been tidied up a bit)

llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h

index be68133..65295f9 100644 (file)
@@ -393,50 +393,49 @@ private:
 
     // Create stub functions.
     const DataLayout &DL = SrcM.getDataLayout();
-    {
-      typename IndirectStubsMgrT::StubInitsMap StubInits;
-      for (auto &F : SrcM) {
-        // Skip declarations.
-        if (F.isDeclaration())
-          continue;
 
-        // Skip weak functions for which we already have definitions.
-        auto MangledName = mangle(F.getName(), DL);
-        if (F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
-          if (auto Sym = LD.findSymbol(BaseLayer, MangledName, false))
-            continue;
-          else if (auto Err = Sym.takeError())
-            return Err;
-        }
+    typename IndirectStubsMgrT::StubInitsMap StubInits;
+    for (auto &F : SrcM) {
+      // Skip declarations.
+      if (F.isDeclaration())
+        continue;
 
-        // Record all functions defined by this module.
-        if (CloneStubsIntoPartitions)
-          LD.getStubsToClone(LMId).insert(&F);
-
-        // Create a callback, associate it with the stub for the function,
-        // and set the compile action to compile the partition containing the
-        // function.
-        auto CompileAction = [this, &LD, LMId, &F]() -> JITTargetAddress {
-          if (auto FnImplAddrOrErr = this->extractAndCompile(LD, LMId, F))
-            return *FnImplAddrOrErr;
-          else {
-            // FIXME: Report error, return to 'abort' or something similar.
-            consumeError(FnImplAddrOrErr.takeError());
-            return 0;
-          }
-        };
-        if (auto CCAddr =
-                CompileCallbackMgr.getCompileCallback(std::move(CompileAction)))
-          StubInits[MangledName] =
-              std::make_pair(*CCAddr, JITSymbolFlags::fromGlobalValue(F));
-        else
-          return CCAddr.takeError();
+      // Skip weak functions for which we already have definitions.
+      auto MangledName = mangle(F.getName(), DL);
+      if (F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
+        if (auto Sym = LD.findSymbol(BaseLayer, MangledName, false))
+          continue;
+        else if (auto Err = Sym.takeError())
+          return Err;
       }
 
-      if (auto Err = LD.StubsMgr->createStubs(StubInits))
-        return Err;
+      // Record all functions defined by this module.
+      if (CloneStubsIntoPartitions)
+        LD.getStubsToClone(LMId).insert(&F);
+
+      // Create a callback, associate it with the stub for the function,
+      // and set the compile action to compile the partition containing the
+      // function.
+      auto CompileAction = [this, &LD, LMId, &F]() -> JITTargetAddress {
+        if (auto FnImplAddrOrErr = this->extractAndCompile(LD, LMId, F))
+          return *FnImplAddrOrErr;
+        else {
+          // FIXME: Report error, return to 'abort' or something similar.
+          consumeError(FnImplAddrOrErr.takeError());
+          return 0;
+        }
+      };
+      if (auto CCAddr =
+              CompileCallbackMgr.getCompileCallback(std::move(CompileAction)))
+        StubInits[MangledName] =
+            std::make_pair(*CCAddr, JITSymbolFlags::fromGlobalValue(F));
+      else
+        return CCAddr.takeError();
     }
 
+    if (auto Err = LD.StubsMgr->createStubs(StubInits))
+      return Err;
+
     // If this module doesn't contain any globals, aliases, or module flags then
     // we can bail out early and avoid the overhead of creating and managing an
     // empty globals module.