kadircet added inline comments.

================
Comment at: clang-tools-extra/clangd/Headers.cpp:76
+        Out->MainFileIncludesBySpelling.try_emplace(Inc.Written)
+            .first->second.push_back(static_cast<HeaderID>(*Inc.HeaderID));
       }
----------------
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?


================
Comment at: clang-tools-extra/clangd/Headers.h:166
+  llvm::SmallVector<HeaderID>
+  lookupHeaderIDsBySpelling(llvm::StringRef Spelling) const {
+    return MainFileIncludesBySpelling.lookup(Spelling);
----------------
what about renaming `lookupHeaderIDsBySpelling` to 
`mainFileIncludesWithSpelling`. with a comment explaining `Returns includes 
inside the main file with the given Spelling. Spelling should include brackets 
or quotes, e.g. <foo>`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143509

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to