This is an archive of the discontinued LLVM Phabricator instance.

[codeview] Move type index remapping logic to type merger
ClosedPublic

Authored by rnk on Mar 22 2017, 4:26 PM.

Details

Summary

This removes the 'remapTypeIndices' method on every TypeRecord class. My
original idea was that this would be the beginning of some kind of
generic entry point that would enumerate all of the TypeIndices inside
of a TypeRecord, so that we could write generic graph algorithms for
them without duplicating the knowledge of which fields are type index
fields everywhere. This never happened, and nothing else uses this
method. I need to change the API to deal with merging into IPI streams,
so let's move it into the file that uses it first.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Mar 22 2017, 4:26 PM
ruiu accepted this revision.Mar 22 2017, 4:30 PM

LGTM

This revision is now accepted and ready to land.Mar 22 2017, 4:30 PM
zturner accepted this revision.Mar 22 2017, 4:33 PM
zturner added inline comments.
lib/DebugInfo/CodeView/TypeStreamMerger.cpp
163 ↗(On Diff #92736)

I forgot why we store LastError and proceed through the type stream, instead of just returning the error right away and failing. Do you happen to know?

rnk added inline comments.Mar 22 2017, 4:35 PM
lib/DebugInfo/CodeView/TypeStreamMerger.cpp
163 ↗(On Diff #92736)

Yes, we want to be able to recover from corrupted records by skipping the record and mapping all uses of it to the untranslated type index. One bad type index shouldn't make us throw away all type information when linking.

zturner added inline comments.Mar 22 2017, 4:40 PM
lib/DebugInfo/CodeView/TypeStreamMerger.cpp
163 ↗(On Diff #92736)

Perhaps we could do a better job joining together the errors then. Is it worth it to save *all* the errors? If not, I think "first error" would be better than "last error". Right now we skip a few (for example if remapIndex fails multiple times on a single record)

rnk added inline comments.Mar 22 2017, 4:42 PM
lib/DebugInfo/CodeView/TypeStreamMerger.cpp
163 ↗(On Diff #92736)

I think just the first would be good enough. If we really want to improve error handling, we'd make a note of which index from which source stream was problematic, since that's what you need to debug it.

This revision was automatically updated to reflect the committed changes.
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h