ilya-biryukov added inline comments.

================
Comment at: clang-tools-extra/clangd/index/CanonicalIncludes.cpp:780
+  // Prefer a mapping from the system symbols.
+  if (SystemSymbols) {
+    if (auto Result = SystemSymbols->mapHeader(Header, QualifiedName))
----------------
hokein wrote:
> what's the interesting case where `SystemSymbols` is null?
> I think it should be fine to always use the standard symbol mapping here? 
> just use `getStandardSymbolMapping()->mapHeader()`, this would help to 
> simplify the CanonicalInclude interface (no `addSystemHeadersMapping` and 
> `SystemSymbols` members  are needed).
Fair question. I guess the only interesting case is unit tests - if we always 
have system include mapping, testing other things independently is impossible, 
therefore it's a bit more fragile.
But I don't think that's a real problem in practice.

Should we try to go even further, pass `LangOptions` to `CanonicalIncludes` on 
construction and always have a single defined mapping? I'll try to do that and 
update the patch accordingly. But let me know if you think that's a bad idea 
for some reason.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67172



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

Reply via email to