[clangd] Treat paths case-insensitively depending on the platform
authorKadir Cetinkaya <kadircet@google.com>
Mon, 15 Feb 2021 08:00:49 +0000 (09:00 +0100)
committerKadir Cetinkaya <kadircet@google.com>
Tue, 16 Feb 2021 19:20:53 +0000 (20:20 +0100)
commitecea7218fb9b994b26471e9877851cdb51a5f1d4
tree0f269d8da815f706d16b4fdbb3ba5d83c8c55c7f
parentacfab44eebbeccb41f9fd3c2c363ff61f02dbf76
[clangd] Treat paths case-insensitively depending on the platform

Path{Match,Exclude} and MountPoint were checking paths case-sensitively
on all platforms, as with other features, this was causing problems on
windows. Since users can have capital drive letters on config files, but
editors might lower-case them.

This patch addresses that issue by:
- Creating regexes with case-insensitive matching on those platforms.
- Introducing a new pathIsAncestor helper, which performs checks in a
  case-correct manner where needed.

Differential Revision: https://reviews.llvm.org/D96690
clang-tools-extra/clangd/ConfigCompile.cpp
clang-tools-extra/clangd/support/Path.cpp
clang-tools-extra/clangd/support/Path.h
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp
clang-tools-extra/clangd/unittests/support/PathTests.cpp [new file with mode: 0644]