Skip to content

Commit 4a878c3

Browse files
authored
Revert "[clangd] Add feature modules registry (#153756)"
This reverts commit ff5767a.
1 parent 7439d22 commit 4a878c3

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

clang-tools-extra/clangd/FeatureModule.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ FeatureModule::Facilities &FeatureModule::facilities() {
2222
return *Fac;
2323
}
2424

25-
void FeatureModuleSet::add(std::unique_ptr<FeatureModule> M) {
26-
Modules.push_back(std::move(M));
27-
}
28-
2925
bool FeatureModuleSet::addImpl(void *Key, std::unique_ptr<FeatureModule> M,
3026
const char *Source) {
3127
if (!Map.try_emplace(Key, M.get()).second) {
@@ -39,5 +35,3 @@ bool FeatureModuleSet::addImpl(void *Key, std::unique_ptr<FeatureModule> M,
3935

4036
} // namespace clangd
4137
} // namespace clang
42-
43-
LLVM_INSTANTIATE_REGISTRY(clang::clangd::FeatureModuleRegistry)

clang-tools-extra/clangd/FeatureModule.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "llvm/ADT/FunctionExtras.h"
1616
#include "llvm/Support/Compiler.h"
1717
#include "llvm/Support/JSON.h"
18-
#include "llvm/Support/Registry.h"
1918
#include <memory>
2019
#include <optional>
2120
#include <type_traits>
@@ -144,14 +143,9 @@ class FeatureModule {
144143

145144
/// A FeatureModuleSet is a collection of feature modules installed in clangd.
146145
///
147-
/// Modules added with explicit type specification can be looked up by type, or
148-
/// used via the FeatureModule interface. This allows individual modules to
149-
/// expose a public API. For this reason, there can be only one feature module
150-
/// of each type.
151-
///
152-
/// Modules added using a base class pointer can be used only via the
153-
/// FeatureModule interface and can't be looked up by type, thus custom public
154-
/// API (if provided by the module) can't be used.
146+
/// Modules can be looked up by type, or used via the FeatureModule interface.
147+
/// This allows individual modules to expose a public API.
148+
/// For this reason, there can be only one feature module of each type.
155149
///
156150
/// The set owns the modules. It is itself owned by main, not ClangdServer.
157151
class FeatureModuleSet {
@@ -178,7 +172,6 @@ class FeatureModuleSet {
178172
const_iterator begin() const { return const_iterator(Modules.begin()); }
179173
const_iterator end() const { return const_iterator(Modules.end()); }
180174

181-
void add(std::unique_ptr<FeatureModule> M);
182175
template <typename Mod> bool add(std::unique_ptr<Mod> M) {
183176
return addImpl(&ID<Mod>::Key, std::move(M), LLVM_PRETTY_FUNCTION);
184177
}
@@ -192,8 +185,6 @@ class FeatureModuleSet {
192185

193186
template <typename Mod> int FeatureModuleSet::ID<Mod>::Key;
194187

195-
using FeatureModuleRegistry = llvm::Registry<FeatureModule>;
196-
197188
} // namespace clangd
198189
} // namespace clang
199190
#endif

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,14 +1017,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
10171017
: static_cast<int>(ErrorResultCode::CheckFailed);
10181018
}
10191019

1020-
FeatureModuleSet ModuleSet;
1021-
for (FeatureModuleRegistry::entry E : FeatureModuleRegistry::entries()) {
1022-
vlog("Adding feature module '{0}' ({1})", E.getName(), E.getDesc());
1023-
ModuleSet.add(E.instantiate());
1024-
}
1025-
if (ModuleSet.begin() != ModuleSet.end())
1026-
Opts.FeatureModules = &ModuleSet;
1027-
10281020
// Initialize and run ClangdLSPServer.
10291021
// Change stdin to binary to not lose \r\n on windows.
10301022
llvm::sys::ChangeStdinToBinary();

0 commit comments

Comments
 (0)