[Tooling/Inclusion] Add symbol mappings for `std::experimental::filesystem`
authorYounan Zhang <zyn7109@gmail.com>
Mon, 13 Feb 2023 11:17:26 +0000 (19:17 +0800)
committerYounan Zhang <zyn7109@gmail.com>
Mon, 13 Feb 2023 17:07:39 +0000 (01:07 +0800)
commitd4021ed3d79d8823317d894b55f4e6a30cfc3614
tree65c64059c0014d4e879509f5cc9e042662090cb7
parent6e10e6cb8fab015952edbc86d82e85b991ad26dc
[Tooling/Inclusion] Add symbol mappings for `std::experimental::filesystem`

Clangd maintains a symbol map from standard library, in order to prevent
unexpected header/symbol leaks from internal files. (e.g. files under
`bits/` for libstdc++) This symbol map was generated by a python script
that parses pages of offline cppreference archive. The script didn't
handle the case for `std::experimental::`, where most symbols are from
TS. It works well as symbols are directly laid out in the corresponding
header under `experimental` directory for most of time.

However, libstdc++'s implementation split symbols of TS FS into a few
header files located in `experimental/bits`. This would make the code
completion provide internal headers when we simply select the symbols.

There are slightly differences between TS FS and C++17 FS. Some
functions like `system_complete` was replaced by `absolute` and
relative-related operations were introduced later by another proposal.
Even so, all mainstream implementation are based on N4100, the final
filesystem TS draft that was published in 2014 and from which symbols
we've added are exported.

This fixes https://github.com/clangd/clangd/issues/1481

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D142836
clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
clang/lib/Tooling/Inclusions/Stdlib/StdTsSymbolMap.inc [new file with mode: 0644]
clang/unittests/Tooling/StandardLibraryTest.cpp