Avoid extra shallow class lookups in decl folding
Summary:
The default implementation of FoldedDeclProvider::get_class [uses the provider's implementation of get_type](https://www.internalfb.com/code/fbsource/%
5Baae650dcab88%5D/fbcode/hphp/hack/src/rupro/hackrs/folded_decl_provider.rs?lines=125). The way that LazyFoldedDeclProvider::get_type is currently implemented involves [invoking ShallowDeclProvider::get_type](https://www.internalfb.com/code/fbsource/[
aae650dcab88]/fbcode/hphp/hack/src/rupro/hackrs/folded_decl_provider/provider.rs?lines=78). If the decl is a typedef, it is returned. If it is a (shallow) class, we look at our folded classes cache and return that decl if it is present. Otherwise, we fold the class, store it in the cache, and return it.
If it is inexpensive to look up a shallow class, this is fine. But when looking up a shallow class involves deserialization and decompression, this imposes an unnecessary performance overhead in the case that the folded decl is already computed and in the folded decl provider's cache, since we don't need to look up the shallow decl at all.
If we add a get_type_kind method to ShallowDeclProvider (which can be inexpensively implemented using the naming table in the LazyShallowDeclProvider case), then we can avoid this overhead.
Reviewed By: shayne-fletcher
Differential Revision:
D37840849
fbshipit-source-id:
319705cc130074b1c5d6df9bdc5e93115f34cbe4