================
@@ -33,5 +37,16 @@ bool FeatureModuleSet::addImpl(void *Key, 
std::unique_ptr<FeatureModule> M,
   return true;
 }
 
+FeatureModuleSet FeatureModuleSet::fromRegistry() {
+  FeatureModuleSet ModuleSet;
+  for (FeatureModuleRegistry::entry E : FeatureModuleRegistry::entries()) {
+    vlog("Adding feature module '{0}' ({1})", E.getName(), E.getDesc());
+    ModuleSet.add(E.instantiate());
+  }
+  return ModuleSet;
+}
+
 } // namespace clangd
 } // namespace clang
+
+LLVM_INSTANTIATE_REGISTRY(clang::clangd::FeatureModuleRegistry)
----------------
kadircet wrote:

i think we'll still hit the same issue when there are users calling 
`FeatureModuleRegistry::Add` from other translation units. can you add an 
explicit instantiation to the header file instead via `extern template class 
FeatureModuleRegistry` and a unittest that actually registers a dummy plugin 
via this mechanism?

https://github.com/llvm/llvm-project/pull/154836
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to