diff --git a/clang-tools-extra/clangd/QueryDriverDatabase.cpp b/clang-tools-extra/clangd/QueryDriverDatabase.cpp --- 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 @@ // 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 @@ for (llvm::StringRef Glob : Globs) RegTexts.push_back(convertGlobToRegex(Glob)); + // Tempting to pass IgnoreCase, but we don't the FS sensitivity precisely. llvm::Regex Reg(llvm::join(RegTexts, "|")); assert(Reg.isValid(RegTexts.front()) && "Created an invalid regex from globs");