[PATCH] D61460: Fix bug in getCompleteTypeIndex in codeview debug info
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 13:50:00 PDT 2019
rnk added a comment.
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.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2519-2521
+ auto InsertResult = CompleteTypeIndices.insert({CTy, TypeIndex()});
+ if (!InsertResult.second)
+ return InsertResult.first->second;
----------------
While we're here, please simplify this to just use `.find` since we can't use InsertResult below.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2536-2539
// Update the type index associated with this CompositeType. This cannot
// use the 'InsertResult' iterator above because it is potentially
// invalidated by map insertions which can occur while lowering the class
// type above.
----------------
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61460/new/
https://reviews.llvm.org/D61460
More information about the llvm-commits
mailing list