[PDB] Add the ability to map forward references to full decls.
authorZachary Turner <zturner@google.com>
Thu, 20 Sep 2018 15:50:13 +0000 (15:50 +0000)
committerZachary Turner <zturner@google.com>
Thu, 20 Sep 2018 15:50:13 +0000 (15:50 +0000)
commitcfa1d499f92d52c2ac2443c52fb77ad2fc64591d
treef2b31c0d4b966be52afdd166dc8434c582bcbb38
parent0aea310391dded5ff10d8e183cf255b614026cb0
[PDB] Add the ability to map forward references to full decls.

Some records point to an LF_CLASS, LF_UNION, LF_STRUCTURE, or LF_ENUM
which is a forward reference and doesn't contain complete debug
information. In these cases, we'd like to be able to quickly locate the
full record. The TPI stream stores an array of pre-computed record hash
values, one for each type record. If we pre-process this on startup, we
can build a mapping from hash value -> {list of possible matching type
indices}. Since hashes of full records are only based on the name and or
unique name and not the full record contents, we can then use forward
ref record to compute the hash of what *would* be the full record by
just hashing the name, use this to get the list of possible matches, and
iterate those looking for a match on name or unique name.

llvm-pdbutil is updated to resolve forward references for the purposes
of testing (plus it's just useful).

Differential Revision: https://reviews.llvm.org/D52283

llvm-svn: 342656
15 files changed:
llvm/include/llvm/DebugInfo/PDB/Native/RawTypes.h
llvm/include/llvm/DebugInfo/PDB/Native/TpiHashing.h
llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
llvm/test/DebugInfo/PDB/Inputs/every-class.cpp [new file with mode: 0644]
llvm/test/DebugInfo/PDB/Inputs/every-class.pdb [new file with mode: 0644]
llvm/test/DebugInfo/PDB/every-type.test
llvm/test/DebugInfo/PDB/pdb-resolve-forward-refs.test [new file with mode: 0644]
llvm/test/DebugInfo/PDB/pdbdump-headers.test
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
llvm/tools/llvm-pdbutil/MinimalTypeDumper.h
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
llvm/tools/llvm-pdbutil/llvm-pdbutil.h