When there are multiple instances of a forward decl record type, only the first one is emitted with a type index, because
the type is added to a map with a null type index. Avoid this by reordering so that forward decl types aren't added to the map.
Details
- Reviewers
rnk - Commits
- rZORGecb100f50c58: Fix bug in getCompleteTypeIndex in codeview debug info
rZORG1479028ac17b: Fix bug in getCompleteTypeIndex in codeview debug info
rGecb100f50c58: Fix bug in getCompleteTypeIndex in codeview debug info
rG1479028ac17b: Fix bug in getCompleteTypeIndex in codeview debug info
rG987b969babe1: Fix bug in getCompleteTypeIndex in codeview debug info
rL360101: Fix bug in getCompleteTypeIndex in codeview debug info
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 31312 Build 31311: arc lint + arc unit
Event Timeline
This should have a test. I think you can use this C++ to start:
struct Foo; extern "C" __declspec(allocator) Foo *alloc_foo(); void escape(Foo*); void doit() { escape(alloc_foo()); escape(alloc_foo()); escape(alloc_foo()); }
Before this change, the symbols would show the wrong type for the second and third heap alloc sites.
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | ||
---|---|---|
2519–2521 | While we're here, please simplify this to just use .find since we can't use InsertResult below. | |
2538–2541 | If you do delete InsertResult, you should simplify this comment to just say that we need to re-do the hash lookup because complete type lowering may insert more complete types into the table. |
- Add comment about inserting type to map
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | ||
---|---|---|
2519–2521 | Not inserting breaks in the case of circular references |
While we're here, please simplify this to just use .find since we can't use InsertResult below.