diff options
author | Sterling Augustine <saugustine@google.com> | 2021-04-12 14:17:49 -0700 |
---|---|---|
committer | Sterling Augustine <saugustine@google.com> | 2021-04-12 14:39:13 -0700 |
commit | c2ad7c23707cece995ee9070283a72c4afc8c0fe (patch) | |
tree | eb242d10dfbcba28ec9d2c99a3cdc95309506e25 /clang-tools-extra/clangd/ConfigCompile.cpp | |
parent | 9e81325b8769172feab4c3e2726d676bae714e96 (diff) | |
download | llvm-c2ad7c23707cece995ee9070283a72c4afc8c0fe.tar.gz |
Revert "[clangd] Provide a way to disable external index"
This reverts commit 63bc9e443502ab6def2dec0b5ffe64a522f801cc.
This breaks llvm-project/clang-tools-extra/clangd/tool/ClangdMain.cpp:570:11:
with error: enumeration value 'None' not handled in switch [-Werror,-Wswitch]
Diffstat (limited to 'clang-tools-extra/clangd/ConfigCompile.cpp')
-rw-r--r-- | clang-tools-extra/clangd/ConfigCompile.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp index a5745727dca7..1185eb7255b4 100644 --- a/clang-tools-extra/clangd/ConfigCompile.cpp +++ b/clang-tools-extra/clangd/ConfigCompile.cpp @@ -329,11 +329,10 @@ struct FragmentCompiler { } #endif // Make sure exactly one of the Sources is set. - unsigned SourceCount = External.File.hasValue() + - External.Server.hasValue() + *External.IsNone; + unsigned SourceCount = + External.File.hasValue() + External.Server.hasValue(); if (SourceCount != 1) { - diag(Error, "Exactly one of File, Server or None must be set.", - BlockRange); + diag(Error, "Exactly one of File or Server must be set.", BlockRange); return; } Config::ExternalIndexSpec Spec; @@ -347,29 +346,20 @@ struct FragmentCompiler { if (!AbsPath) return; Spec.Location = std::move(*AbsPath); - } else { - assert(*External.IsNone); - Spec.Kind = Config::ExternalIndexSpec::None; } - if (Spec.Kind != Config::ExternalIndexSpec::None) { - // Make sure MountPoint is an absolute path with forward slashes. - if (!External.MountPoint) - External.MountPoint.emplace(FragmentDirectory); - if ((**External.MountPoint).empty()) { - diag(Error, "A mountpoint is required.", BlockRange); - return; - } - auto AbsPath = makeAbsolute(std::move(*External.MountPoint), "MountPoint", - llvm::sys::path::Style::posix); - if (!AbsPath) - return; - Spec.MountPoint = std::move(*AbsPath); + // Make sure MountPoint is an absolute path with forward slashes. + if (!External.MountPoint) + External.MountPoint.emplace(FragmentDirectory); + if ((**External.MountPoint).empty()) { + diag(Error, "A mountpoint is required.", BlockRange); + return; } + auto AbsPath = makeAbsolute(std::move(*External.MountPoint), "MountPoint", + llvm::sys::path::Style::posix); + if (!AbsPath) + return; + Spec.MountPoint = std::move(*AbsPath); Out.Apply.push_back([Spec(std::move(Spec))](const Params &P, Config &C) { - if (Spec.Kind == Config::ExternalIndexSpec::None) { - C.Index.External.reset(); - return; - } if (P.Path.empty() || !pathStartsWith(Spec.MountPoint, P.Path, llvm::sys::path::Style::posix)) return; |