Skip to content

Commit f306e0a

Browse files
authored
Revert "[clangd] Add feature modules registry" (#154711)
Reverts #153756 It leads to new build bot failure. https://lab.llvm.org/buildbot/#/builders/145/builds/9200 ``` BUILD FAILED: failed build (failure) Step 5 (build-unified-tree) failure: build (failure) ... 254.983 [140/55/1504] Building CXX object tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/ClangdMain.cpp.o FAILED: tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/ClangdMain.cpp.o ccache /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/clangd/tool -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/tool -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/../include-cleaner/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/clangd/../clang-tidy -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang- rhel-test/clang-ppc64le-rhel/build/tools/clang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/clangd -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe -unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17 -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/ClangdMain.cpp.o -MF tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/ClangdMain.cpp.o.d -o tools/clang/tools/extra/clangd/tool/CMakeFiles/obj.clangdMain.dir/ClangdMain.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/tool/ClangdMain.cpp In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/tool/ClangdMain.cpp:10: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/ClangdLSPServer.h:12: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/ClangdServer.h:12: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/CodeComplete.h:18: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/ASTSignals.h:12: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/ParsedAST.h:23: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/CollectMacros.h:12: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/Protocol.h:26: In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/URI.h:14: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include/llvm/Support/Registry.h:110:47: error: instantiation of variable 'llvm::Registry<clang::clangd::FeatureModule>::Head' required here, but no definition is available [-Werror,-Wundefined-var-template] 110 | static iterator begin() { return iterator(Head); } | ^ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include/llvm/Support/Registry.h:114:25: note: in instantiation of member function 'llvm::Registry<clang::clangd::FeatureModule>::begin' requested here 114 | return make_range(begin(), end()); | ^ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang-tools-extra/clangd/tool/ClangdMain.cpp:1021:64: note: in instantiation of member function 'llvm::Registry<clang::clangd::FeatureModule>::entries' requested here 1021 | for (FeatureModuleRegistry::entry E : FeatureModuleRegistry::entries()) { | ^ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include/llvm/Support/Registry.h:61:18: note: forward declaration of template entity is here 61 | static node *Head; | ^ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/llvm/include/llvm/Support/Registry.h:110:47: note: add an explicit instantiation declaration to suppress this warning if 'llvm::Registry<clang::clangd::FeatureModule>::Head' is explicitly instantiated in another translation unit 110 | static iterator begin() { return iterator(Head); } | ^ 1 error generated. ``` I need some time to fix this in a correct way
1 parent 21bd3a7 commit f306e0a

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)