<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 14, 2019 at 10:46 AM Ilya Biryukov <<a href="mailto:ibiryukov@google.com">ibiryukov@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Sun, Jan 13, 2019 at 7:25 PM Nathan Ridge <<a href="mailto:zeratul976@hotmail.com" target="_blank">zeratul976@hotmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> We do have plans to add some type information to the index for the <br>
> purposes of code completion ranking (boost results that have the <br>
> right type).<br>
> This will need to include the base types (e.g. so that when a Shape& is <br>
> expected, a Circle& will match it). So maybe we can use the same data <br>
> and query for (kind=type && type=SomeBase) to find derived types.<br>
> Ilya is working on this, this might be a nice solution without <br>
> expanding the index, if expected-types ranking and subtypes don't <br>
> turn out to be too divergent.<br>
<br>
Thanks, this is an interesting direction to explore.<br>
<br>
I looked briefly at the expected-types patches that have landed so far. Do I understand correctly that there are plans to expand the field Symbol::Type to also encode the types of the base classes?<br></blockquote><div>We plan to do this for expected types at some point, however my natural instinct would be to avoid using this for anything other than completion ranking.</div><div>Not saying this wouldn't work, but my assumption is that storing hierarchies separately will be cheap both in storage and performance, make the intention of the code querying them clearer and would allow to generalize easier for the template hierarchy (for go to template specializations/explicit instantiations).</div></div></div></blockquote><div>Fair enough, we should measure. I'm slightly nervous about thousands of tiny posting lists in dex, but maybe my intuition is failing me.</div><div>At least we should reuse (some of) the code that encodes types opaquely for the index, though.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> One limitation here is that subtypes are not strictly a <br>
> symbol->symbol relationship when templates are considered. <br>
<br>
Good point. Indeed, in the other C++ indexer that I'm familiar with (Eclipse CDT's), types have their own representation in the index (which includes a way to represent e.g. template specializations), and bases use that representation. </blockquote></div></div></blockquote><div>So we have a (trivial for now) encoding that allows types to be attributes, query for them etc: <a href="https://reviews.llvm.org/source/clang-tools-extra/browse/clang-tools-extra/trunk/clangd/ExpectedTypes.h$42">https://reviews.llvm.org/source/clang-tools-extra/browse/clang-tools-extra/trunk/clangd/ExpectedTypes.h$42</a></div><div>But we don't have them as first-class entities in the index like Symbols and References are. My gut feeling is we might be able to get away without this, by attaching them to symbols in the right way.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> Regarding Apple's index-while-build: <br>
> [...]<br>
> We do use a bit of the infrastructure to walk ASTs.<br>
<br>
Would that be the facilities in the "clang/Index/*" headers that e.g. SymbolCollector uses?<br></blockquote></div></div></blockquote><div>Yes, that's right.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
Nate</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_6395493975730533462gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Regards,</div><div>Ilya Biryukov</div></div></div></div></div></div>
</blockquote></div></div></div>