Skip to content

Commit

Permalink
Fix llvm-dsymutil test in -DLLVM_ENABLE_THREADS=OFF mode
Browse files Browse the repository at this point in the history
After r316999, tools/dsymutil/X86/alias.test started failing in builds
that have threading disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317263 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
zmodem committed Nov 2, 2017
1 parent ce68f2c commit 15f5deb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/dsymutil/dsymutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ int main(int argc, char **argv) {
NumThreads = 1;
NumThreads = std::min<unsigned>(NumThreads, DebugMapPtrsOrErr->size());

llvm::ThreadPool Threads(NumThreads);

// If there is more than one link to execute, we need to generate
// temporary files.
Expand Down Expand Up @@ -366,17 +365,19 @@ int main(int argc, char **argv) {
// FIXME: The DwarfLinker can have some very deep recursion that can max
// out the (significantly smaller) stack when using threads. We don't
// want this limitation when we only have a single thread.
if (NumThreads == 1)
if (NumThreads == 1) {
LinkLambda();
else
} else {
llvm::ThreadPool Threads(NumThreads);
Threads.async(LinkLambda);
Threads.wait();
}

if (NeedsTempFiles)
TempFiles.emplace_back(Map->getTriple().getArchName().str(),
OutputFile);
}

Threads.wait();

if (NeedsTempFiles &&
!MachOUtils::generateUniversalBinary(
Expand Down

0 comments on commit 15f5deb

Please sign in to comment.