[PATCH] D67172: [clangd] Use pre-populated mappings for standard symbols
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 9 04:22:19 PDT 2019
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
More information about the cfe-commits
mailing list