Author: Sam McCall Date: 2022-02-18T18:06:36+01:00 New Revision: 47b749e5be2190d1ccb214fd6364da462a9098cf
URL: https://github.com/llvm/llvm-project/commit/47b749e5be2190d1ccb214fd6364da462a9098cf DIFF: https://github.com/llvm/llvm-project/commit/47b749e5be2190d1ccb214fd6364da462a9098cf.diff LOG: [clangd] Tweak --query-driver to ignore slash direction on windows See https://github.com/clangd/clangd/issues/1022 Differential Revision: https://reviews.llvm.org/D120115 Added: Modified: clang-tools-extra/clangd/QueryDriverDatabase.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/QueryDriverDatabase.cpp b/clang-tools-extra/clangd/QueryDriverDatabase.cpp index 5e51837b4820f..0daa0c5cd0be0 100644 --- a/clang-tools-extra/clangd/QueryDriverDatabase.cpp +++ b/clang-tools-extra/clangd/QueryDriverDatabase.cpp @@ -38,12 +38,10 @@ #include "clang/Basic/TargetOptions.h" #include "clang/Driver/Types.h" #include "clang/Tooling/CompilationDatabase.h" -#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/iterator_range.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" @@ -276,6 +274,10 @@ std::string convertGlobToRegex(llvm::StringRef Glob) { // Single star, accept any sequence without a slash. RegStream << "[^/]*"; } + } else if (llvm::sys::path::is_separator(Glob[I]) && + llvm::sys::path::is_separator('/') && + llvm::sys::path::is_separator('\\')) { + RegStream << R"([/\\])"; // Accept either slash on windows. } else { RegStream << llvm::Regex::escape(Glob.substr(I, 1)); } @@ -293,6 +295,7 @@ llvm::Regex convertGlobsToRegex(llvm::ArrayRef<std::string> Globs) { for (llvm::StringRef Glob : Globs) RegTexts.push_back(convertGlobToRegex(Glob)); + // Tempting to pass IgnoreCase, but we don't know the FS sensitivity. llvm::Regex Reg(llvm::join(RegTexts, "|")); assert(Reg.isValid(RegTexts.front()) && "Created an invalid regex from globs"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits