[clangd] Using symbol name to map includes for STL symbols.
authorHaojian Wu <hokein@google.com>
Thu, 14 Mar 2019 11:25:26 +0000 (11:25 +0000)
committerHaojian Wu <hokein@google.com>
Thu, 14 Mar 2019 11:25:26 +0000 (11:25 +0000)
commit7f51b5dc3271bc8078a6f63db2e50f06def9090d
treec4da160745384c2ad35329e984f99da331e02cf3
parente81f5f91b49677f4fbf545fcd9a742d5de155f0a
[clangd] Using symbol name to map includes for STL symbols.

Summary:
Using suffix path mapping relies on the STL implementations, and it is
not portable. This patch is using symbol name mapping, which should
work with different STL implementations, fix clangd/clangd#9.

To generate the symbol mapping, we parse the cppreference symbol index
page to build a lookup table.

The mapping is not completed, a few TODOs:
  - support symbols from different headers (e.g. std::move)
  - support STL macros
  - support symbols from std's sub-namespaces (e.g. chrono)

Reviewers: ioeric, jfb, serge-sans-paille

Reviewed By: ioeric

Subscribers: sammccall, klimek, ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, kadircet, jfb, jdoerfert, cfe-commits

Tags: #clang-tools-extra, #clang

Differential Revision: https://reviews.llvm.org/D58345

llvm-svn: 356134
clang-tools-extra/clangd/StdSymbolMap.inc [new file with mode: 0644]
clang-tools-extra/clangd/include-mapping/gen_std.py [new file with mode: 0755]
clang-tools-extra/clangd/include-mapping/test.py [new file with mode: 0755]
clang-tools-extra/clangd/index/CanonicalIncludes.cpp