aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-04-24 10:18:45 -0700
committerGitHub <noreply@github.com>2025-04-24 10:18:45 -0700
commit8832a5950f3b62331842ecb2f3a68f33732822eb (patch)
tree3e4326e877e53faf5cf47f058e64f9c8c321b944 /llvm/lib/Transforms/Utils/Local.cpp
parent7a276c8acfc3977de8c3ceb0af67fcf603834946 (diff)
downloadllvm-8832a5950f3b62331842ecb2f3a68f33732822eb.zip
llvm-8832a5950f3b62331842ecb2f3a68f33732822eb.tar.gz
llvm-8832a5950f3b62331842ecb2f3a68f33732822eb.tar.bz2
[clang] Enable making the module build stack thread-safe (#137059)
This PR makes another piece of the `CompilerInstance::cloneForModuleCompile()` result thread-safe: the module build stack. This data structure is used to detect cyclic dependencies between modules. The problem is that it uses `FullSourceLoc` which refers to the `SourceManager` of the parent `CompilerInstance`: if two threads happen to execute `CompilerInstance`s cloned from the same parent concurrently, and both discover a dependency cycle, they may concurrently access the parent `SourceManager` when emitting the diagnostic, creating a data race. In this PR, we prevent this by keeping the stack empty and moving the responsibility of cycle detection to the client. The client can recreate the same module build stack externally and ensure thread-safety by enforcing mutual exclusion.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
0 files changed, 0 insertions, 0 deletions