[PATCH] D143509: Move the BySpelling map to IncludeStructure.

Viktoriia Bakalova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 02:35:03 PST 2023


VitaNuo added a comment.

Thanks for the review!



================
Comment at: clang-tools-extra/clangd/Headers.cpp:76
+        Out->MainFileIncludesBySpelling.try_emplace(Inc.Written)
+            .first->second.push_back(static_cast<HeaderID>(*Inc.HeaderID));
       }
----------------
kadircet wrote:
> right now we're only storing "resolved" includes from the main file and not all, this is creating a discrepancy between the view one gets through `MainFileIncludes` and through this map.
> in addition to that only storing `HeaderID` gets the job done for IncludeCleaner, but won't really help anyone that wants to match main file includes apart from that (there's no easy way to go from a `HeaderID` to an `Inclusion`).
> 
> so instead of storing the `HeaderID` in the map values, we can actually store indexes into `MainFileIncludes`. later on during the lookup, we can build a `SmallVector<Inclusion *>` that contains pointers to the relevant includes. WDYT?
Ok sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143509



More information about the cfe-commits mailing list