This is an archive of the discontinued LLVM Phabricator instance.

[PDB] Finish and simplify TPI hashing
ClosedPublic

Authored by rnk on Jul 17 2017, 4:15 PM.

Details

Summary

This removes the CVTypeVisitor updater and verifier classes. They were
made dead by the minimal type dumping refactoring. Replace them with a
single function that takes a type record and produces a hash. Call this
from the minimal type dumper and compare the hash.

I also noticed that the microsoft-pdb reference repository uses a basic
CRC32 for records that aren't special. We already have an implementation
of that CRC ready to use, because it's used in COFF for ICF.

I'll make LLD call this hashing utility in a follow-up change. We might
also consider using this same hash in type stream merging, so that we
don't have to hash our records twice.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Jul 17 2017, 4:15 PM
ruiu accepted this revision.Jul 17 2017, 4:43 PM

LGTM

llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
31–33 ↗(On Diff #106973)

Do you need these casts to bool?

83–88 ↗(On Diff #106973)

You can make this as default: for the above switch.

This revision is now accepted and ready to land.Jul 17 2017, 4:43 PM
rnk added inline comments.Jul 17 2017, 5:21 PM
llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
31–33 ↗(On Diff #106973)

Apparently I do. The old code was implicitly converting uint16_t to bool, but you can't implicitly convert a ClassOptions strongly typed enum to bool.

83–88 ↗(On Diff #106973)

I declare a variable, though, so I'd need more braces, and I'm trying to pacify any compilers that might warn about falling off the end of the function.

This revision was automatically updated to reflect the committed changes.