[PATCH] D103142: [clang][clangd] Use reverse header map lookup in suggestPathToFileForDiagnostics

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 27 17:32:54 PDT 2021


bruno requested changes to this revision.
bruno added a comment.
This revision now requires changes to proceed.

Overall looks good, few remaining nitpicks.



================
Comment at: clang/lib/Lex/HeaderMap.cpp:245
+StringRef HeaderMapImpl::reverseLookupFilename(StringRef DestPath) const {
+  if (ReverseMap.empty()) {
+    const HMapHeader &Hdr = getHeader();
----------------
Please rewrite this to early return in case this isn't empty. 


================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1856
+    if (SearchDirs[I].isHeaderMap()) {
+      StringRef SpelledFilename =
+          SearchDirs[I].getHeaderMap()->reverseLookupFilename(Filename);
----------------
Similar from above: rewrite to early continue if it's not meeting the conditions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103142



More information about the cfe-commits mailing list