[lldb] Remove call_once wrappers around PluginManager::RegisterPlugin (#184273)

Remove call_once wrappers around PluginManager::RegisterPlugin. Plugins
can be registered and unregistered in Initialize and Terminate
respectively. In its current state, after having called Terminate, a
plugin can never be re-initialized.
This commit is contained in:
Jonas Devlieghere authored and GitHub committed 2026-03-03 13:17:21 -08:00
1 parent 6b5c55ef16
commit c4ea6cc3f7
13 files changed
+38 -106

No files matched your search

@@ -48,7 +48,6 @@
#include <cstdio>
#include <cstdlib>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
@@ -292,15 +291,11 @@ llvm::StringRef ScriptInterpreterPython::GetPluginDescriptionStatic() {
void ScriptInterpreterPython::Initialize() {
HostInfo::SetSharedLibraryDirectoryHelper(
ScriptInterpreterPython::SharedLibraryDirectoryHelper);
static llvm::once_flag g_once_flag;
llvm::call_once(g_once_flag, []() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
lldb::eScriptLanguagePython,
ScriptInterpreterPythonImpl::CreateInstance,
ScriptInterpreterPythonImpl::GetPythonDir);
ScriptInterpreterPythonImpl::Initialize();
});
PluginManager::RegisterPlugin(
GetPluginNameStatic(), GetPluginDescriptionStatic(),
lldb::eScriptLanguagePython, ScriptInterpreterPythonImpl::CreateInstance,
ScriptInterpreterPythonImpl::GetPythonDir);
ScriptInterpreterPythonImpl::Initialize();
ScriptInterpreterPythonInterfaces::Initialize();
}