This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Allow random access visitation of type records
ClosedPublic

Authored by zturner on May 5 2017, 5:01 PM.

Details

Summary

In preparation for providing random access visitation of type streams, we need some plumbing that allows the vistation infrastructure to pass type indices through the pipeline.

This patches takes the simplest possible approach. No existing interfaces are changed, but there is now an additional overload of CVTypeVisitor::visitTypeRecord which takes a TypeIndex. When this overload is called, instead of invoking the normal visitTypeBegin(CVType&) method on the callback interface it invokes a new callback visitTypeBegin(CVType&,TypeIndex).

To demonstrate how this is useful, a new implementation of TypeDatabase is introduced which allows random insertion and access of type records, and the TypeDatabaseVisitor is taught to be able to add records to either a TypeDatabase or a RandomAccessTypeDatabase, depending on how the visitor is constructed.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.May 5 2017, 5:01 PM

Note that this does not yet contain any of the functionality discussed offline about caching and type index offsets. This is strictly plumbing type indices through the visitor pipeline in preparation.

rnk accepted this revision.May 8 2017, 9:21 AM

lgtm

llvm/include/llvm/DebugInfo/CodeView/TypeDatabase.h
48 ↗(On Diff #98041)

This could use a better name. toArrayIndex? zeroBaseIndex? toZeroIndexed?

And then after all that, a Doxygen comment would be good.

llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp
129 ↗(On Diff #98041)

This should assert that it's greater or equal than FirstNonSimpleIndex.

This revision is now accepted and ready to land.May 8 2017, 9:21 AM
This revision was automatically updated to reflect the committed changes.