Skip to content

Commit d379253

Browse files
committed
Orc: Remove an unnecessary explicit scope
(was useful at some point in the past for scoping some error handling that's since been tidied up a bit)
1 parent 2c19d05 commit d379253

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

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

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -393,50 +393,49 @@ class LegacyCompileOnDemandLayer {
393393

394394
// Create stub functions.
395395
const DataLayout &DL = SrcM.getDataLayout();
396-
{
397-
typename IndirectStubsMgrT::StubInitsMap StubInits;
398-
for (auto &F : SrcM) {
399-
// Skip declarations.
400-
if (F.isDeclaration())
401-
continue;
402396

403-
// Skip weak functions for which we already have definitions.
404-
auto MangledName = mangle(F.getName(), DL);
405-
if (F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
406-
if (auto Sym = LD.findSymbol(BaseLayer, MangledName, false))
407-
continue;
408-
else if (auto Err = Sym.takeError())
409-
return Err;
410-
}
397+
typename IndirectStubsMgrT::StubInitsMap StubInits;
398+
for (auto &F : SrcM) {
399+
// Skip declarations.
400+
if (F.isDeclaration())
401+
continue;
411402

412-
// Record all functions defined by this module.
413-
if (CloneStubsIntoPartitions)
414-
LD.getStubsToClone(LMId).insert(&F);
415-
416-
// Create a callback, associate it with the stub for the function,
417-
// and set the compile action to compile the partition containing the
418-
// function.
419-
auto CompileAction = [this, &LD, LMId, &F]() -> JITTargetAddress {
420-
if (auto FnImplAddrOrErr = this->extractAndCompile(LD, LMId, F))
421-
return *FnImplAddrOrErr;
422-
else {
423-
// FIXME: Report error, return to 'abort' or something similar.
424-
consumeError(FnImplAddrOrErr.takeError());
425-
return 0;
426-
}
427-
};
428-
if (auto CCAddr =
429-
CompileCallbackMgr.getCompileCallback(std::move(CompileAction)))
430-
StubInits[MangledName] =
431-
std::make_pair(*CCAddr, JITSymbolFlags::fromGlobalValue(F));
432-
else
433-
return CCAddr.takeError();
403+
// Skip weak functions for which we already have definitions.
404+
auto MangledName = mangle(F.getName(), DL);
405+
if (F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
406+
if (auto Sym = LD.findSymbol(BaseLayer, MangledName, false))
407+
continue;
408+
else if (auto Err = Sym.takeError())
409+
return Err;
434410
}
435411

436-
if (auto Err = LD.StubsMgr->createStubs(StubInits))
437-
return Err;
412+
// Record all functions defined by this module.
413+
if (CloneStubsIntoPartitions)
414+
LD.getStubsToClone(LMId).insert(&F);
415+
416+
// Create a callback, associate it with the stub for the function,
417+
// and set the compile action to compile the partition containing the
418+
// function.
419+
auto CompileAction = [this, &LD, LMId, &F]() -> JITTargetAddress {
420+
if (auto FnImplAddrOrErr = this->extractAndCompile(LD, LMId, F))
421+
return *FnImplAddrOrErr;
422+
else {
423+
// FIXME: Report error, return to 'abort' or something similar.
424+
consumeError(FnImplAddrOrErr.takeError());
425+
return 0;
426+
}
427+
};
428+
if (auto CCAddr =
429+
CompileCallbackMgr.getCompileCallback(std::move(CompileAction)))
430+
StubInits[MangledName] =
431+
std::make_pair(*CCAddr, JITSymbolFlags::fromGlobalValue(F));
432+
else
433+
return CCAddr.takeError();
438434
}
439435

436+
if (auto Err = LD.StubsMgr->createStubs(StubInits))
437+
return Err;
438+
440439
// If this module doesn't contain any globals, aliases, or module flags then
441440
// we can bail out early and avoid the overhead of creating and managing an
442441
// empty globals module.

0 commit comments

Comments
 (0)