Skip to content

Commit f8c90a0

Browse files
[depscand] Fix clang depscand that can leak on linux
On Linux, clang-depscand can be leaked because it is waiting on the destructor of ThreadPool before return. Use `exit()` directly.
1 parent fa3e90f commit f8c90a0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/tools/driver/cc1depscan_main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,9 @@ int cc1depscand_main(ArrayRef<const char *> Argv, const char *Argv0,
10831083
ShutDown.store(true);
10841084
}
10851085

1086-
return 0;
1086+
// Exit instead of return. Otherwise, it will wait on ~ThreadPool() which will
1087+
// never return since all threads might still be sleeping on ::accept().
1088+
::exit(0);
10871089
}
10881090

10891091
static Expected<llvm::cas::CASID> scanAndUpdateCC1InlineWithTool(

0 commit comments

Comments
 (0)