[PATCH] D96690: [clangd] Treat paths case-insensitively depending on the platform
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 15 06:26:08 PST 2021
sammccall added a comment.
Thanks for the important fix.
This contains a mixture of changing comparison-of-paths to be case insensitive, and case-normalizing stored paths so we can use case-sensitive comparisons.
I think we should stick to *only* changing comparison-of-path logic as much as possible, because:
- both approaches are ad-hoc and error prone - forgetting to fold/insensitive-compare will introduce a bug
- it's more obvious where to fix a sensitive-compare, and it has fewer unexpected effects
- in many configs we only ever see one case for a given file, case-folding can introduce bugs here where insensitive-comparison cannot
- there's a risk we won't be case-preserving, which can be annoying or really matter (e.g. on a mac volume that *is* case sensitive)
================
Comment at: clang-tools-extra/clangd/ConfigCompile.cpp:202
+#if defined(_WIN32) || defined(__APPLE__)
+ // When matching paths via regex on Windows/Apple they should be treated
----------------
I'm starting to think Path.h should export a CLANGD_PATH_INSENSITIVE macro, this condition is in a bunch of places. (particularly tests)
I nearly did this last time and came to the conclusion it wasn't quite enough :-\
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96690/new/
https://reviews.llvm.org/D96690
More information about the cfe-commits
mailing list