diff options
author | Michael Park <mcypark@gmail.com> | 2025-03-15 23:03:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-15 23:03:20 -0700 |
commit | 0689d23ab3089eb9920b8f5caa92e423fe3475f8 (patch) | |
tree | 3f2b2fc720cbd0067436661c770d287d1732c684 /llvm/lib/Transforms/Utils/CloneFunction.cpp | |
parent | 508db53d1af5b01f8f8275229f087bb6407f0033 (diff) | |
download | llvm-0689d23ab3089eb9920b8f5caa92e423fe3475f8.zip llvm-0689d23ab3089eb9920b8f5caa92e423fe3475f8.tar.gz llvm-0689d23ab3089eb9920b8f5caa92e423fe3475f8.tar.bz2 |
[C++20][Modules] Prevent premature calls to PassInterestingDeclsToConsumer() within FinishedDeserializing(). (#129982)
`ASTReader::FinishedDeserializing` uses `NumCurrentElementsDeserializing` to keep track of nested `Deserializing` RAII actions. The `FinishedDeserializing` only performs actions if it is the top-level `Deserializing` layer. This works fine in general, but there is a problematic edge case.
If a call to `redecls()` in `FinishedDeserializing` performs deserialization, we re-enter `FinishedDeserializing` while in the middle of the previous `FinishedDeserializing` call.
The known problematic part of this is that this inner `FinishedDeserializing` can go all the way to `PassInterestingDeclsToConsumer`, which operates on `PotentiallyInterestingDecls` data structure which contain decls that should be handled by the previous `FinishedDeserializing` stage.
The other shared data structures are also somewhat concerning at a high-level in that the inner `FinishedDeserializing` would be handling pending actions that are not "within its scope", but this part is not known to be problematic.
We already have a guard within `PassInterestingDeclsToConsumer` because we can end up with recursive deserialization within `PassInterestingDeclsToConsumer`. The implemented solution is to apply this guard to the portion of `FinishedDeserializing` that performs further deserialization as well. This ensures that recursive deserialization does not trigger `PassInterestingDeclsToConsumer` which may operate on entries that are not ready to be passed.
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
0 files changed, 0 insertions, 0 deletions