aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorKristina Bessonova <kbessonova@accesssoftek.com>2022-11-03 10:27:10 +0200
committerKristina Bessonova <kbessonova@accesssoftek.com>2022-11-03 10:28:38 +0200
commit4ecb2b8ef6be69b55d46ac274f3b7a7103219f98 (patch)
treedaa66fe38ca5dd5388b57d6e32d844695f03a5fb /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent9135137718bbb8322dc42a1026ce3f843bbeacc6 (diff)
downloadllvm-4ecb2b8ef6be69b55d46ac274f3b7a7103219f98.zip
llvm-4ecb2b8ef6be69b55d46ac274f3b7a7103219f98.tar.gz
llvm-4ecb2b8ef6be69b55d46ac274f3b7a7103219f98.tar.bz2
[DebugInfo][Metadata] Make AllEnumTypes holding TrackingMDNodeRef
Having AllEnumtypes to be a vector of TrackingMDNodeRef makes it possible to reflect changes in metadata in the vector if they took place before DIBuilder being finalized. Otherwise, we end up with heap-use-after-free because AllEnumTypes contains metadata that no longer valid. Consider a case where we have a class containing a definition of a enum, so this enum has the class as a scope. For some reason (doesn't matter for the current issue), we create a temporary debug metadata for this class, and then resolve it while finalizing CGDebugInfo. In the case of collision during uniqifying the temporary, we then need to replace its uses with a new pointer. If a temporary's user is unique (this is the enum mentioned above), we may need re-uniquefying it, which may return a new pointer in the case of another collision. If so, the pointer we stored in AllEnumTypes vector become dangling. Making AllEnumTypes hodling TrackingMDNodeRef should solve this problem (see debug-info-enum-metadata-collision.cpp test for details). Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D137067
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions