Skip to content

Commit 16bf28f

Browse files
authored
Merge pull request #6231 from apple/jan_svoboda/20221013-cherry-pick
[clang][deps] Fix race condition
2 parents 6be68b9 + 76485a8 commit 16bf28f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clang/tools/clang-scan-deps/ClangScanDeps.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,18 @@ class FullDeps {
525525
public:
526526
void mergeDeps(StringRef Input, TranslationUnitDeps TUDeps,
527527
size_t InputIndex) {
528+
mergeDeps(std::move(TUDeps.ModuleGraph), InputIndex);
529+
528530
InputDeps ID;
529531
ID.FileName = std::string(Input);
530532
ID.ContextHash = std::move(TUDeps.ID.ContextHash);
531533
ID.FileDeps = std::move(TUDeps.FileDeps);
532534
ID.ModuleDeps = std::move(TUDeps.ClangModuleDeps);
533535
ID.CASFileSystemRootID = TUDeps.CASFileSystemRootID;
534-
mergeDeps(std::move(TUDeps.ModuleGraph), InputIndex);
535536
ID.DriverCommandLine = std::move(TUDeps.DriverCommandLine);
536537
ID.Commands = std::move(TUDeps.Commands);
538+
539+
std::unique_lock<std::mutex> ul(Lock);
537540
Inputs.push_back(std::move(ID));
538541
}
539542

0 commit comments

Comments
 (0)