[PATCH] D110386: [clangd] Refactor IncludeStructure: use File (unsigned) for most computations

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 27 07:34:31 PDT 2021


kbobyrev added inline comments.


================
Comment at: clang-tools-extra/clangd/Headers.cpp:205
           CurrentLevel.push_back(Child);
-          const auto &Name = RealPathNames[Child];
           // Can't include files if we don't have their real path.
+          if (!RealPathNames[static_cast<unsigned>(Child)].empty())
----------------
sammccall wrote:
> kbobyrev wrote:
> > sammccall wrote:
> > > This is no longer true, we don't need the check.
> > Wait, why not? We still have unresolved includes, e.g. preamble patches are like that, their `RealPathName`s stay empty.
> Right, but why do we need to filter them out here?
> Can't we just drop them when we use them to seed the proximity sources?
I feel like producing them in the first place is kind of redundant, what signal does it give to the user through such API?

Getting some "hidden"/"unresolved" includes certainly feels rather confusing to me, post-filtering outside probably requires understanding of the internals which does not look like a good idea. WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110386/new/

https://reviews.llvm.org/D110386



More information about the cfe-commits mailing list