Skip to content

Commit 111de45

Browse files
authored
[clang-scan-deps] Move command-line generation out of critical section (#158187)
The first call to getBuildArguments() can be costly. Although the original author’s comment (from commit 3b1a686) states that it should be called outside the critical section, it is currently invoked within the locked region. This change moves it outside the critical section to match the original intent and reduce lock contention.
1 parent f94e36d commit 111de45

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,12 @@ class FullDeps {
429429
auto Res = Modules.insert(I, {{MD.ID, InputIndex}, std::move(MD)});
430430
NewMDs.push_back(&Res->second);
431431
}
432-
// First call to \c getBuildArguments is somewhat expensive. Let's call it
433-
// on the current thread (instead of the main one), and outside the
434-
// critical section.
435-
for (ModuleDeps *MD : NewMDs)
436-
(void)MD->getBuildArguments();
437432
}
433+
// First call to \c getBuildArguments is somewhat expensive. Let's call it
434+
// on the current thread (instead of the main one), and outside the
435+
// critical section.
436+
for (ModuleDeps *MD : NewMDs)
437+
(void)MD->getBuildArguments();
438438
}
439439

440440
bool roundTripCommand(ArrayRef<std::string> ArgStrs,

0 commit comments

Comments
 (0)