[clang] [clang][AST][ASTMerge] prevent AST nodes from being deallocated early (PR #73096)
Qizhi Hu via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 23 22:27:36 PST 2023
jcsxky wrote:
> You have found that reason for the crash is that references to `IdentifierInfo` are remaining in `OnDiskChainedHashTableGenerator` and previously deallocated by `ASTUnit` destruction? In this case why is the `ASTUnit` (or something in it, probably `ASTContext`) the owner of the data, and not `OnDiskChainedHashTableGenerator`? By using `ASTImporter` it is possible that it moves data from the "old" AST to the "new" without copy (if yes this is a bug) and such a situation can cause memory errors.
Thanks for your remind! Indeed, root cause of the issue is ASTImporter and I have checked the code. IdentifierInfo of attribute should set with `ToASTContext` instead of copying from `FromASTContext`.
https://github.com/llvm/llvm-project/pull/73096
More information about the cfe-commits
mailing list