diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-08-22 20:41:16 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-08-22 20:41:16 +0000 |
commit | b041602e3fe330368200a925c18af4d5e0df155c (patch) | |
tree | 55290996dd526619f05d96484bf657230b8eac07 /lldb/source/Core/PluginManager.cpp | |
parent | dddc0fd9cbba726a82a1f6b88015fa73dd2643c6 (diff) | |
download | bcm5719-llvm-b041602e3fe330368200a925c18af4d5e0df155c.tar.gz bcm5719-llvm-b041602e3fe330368200a925c18af4d5e0df155c.zip |
Revert Extend FindTypes with CompilerContext to allow filtering by language.
This reverts r369690 (git commit aa3a564efa6b5fff2129f81a4041069a0233168f)
llvm-svn: 369702
Diffstat (limited to 'lldb/source/Core/PluginManager.cpp')
-rw-r--r-- | lldb/source/Core/PluginManager.cpp | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 80b64fb832f..e0026e3d001 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -2083,11 +2083,12 @@ PluginManager::GetInstrumentationRuntimeCreateCallbackForPluginName( #pragma mark TypeSystem struct TypeSystemInstance { + TypeSystemInstance() : name(), description(), create_callback(nullptr) {} + ConstString name; std::string description; TypeSystemCreateInstance create_callback; - LanguageSet supported_languages_for_types; - LanguageSet supported_languages_for_expressions; + TypeSystemEnumerateSupportedLanguages enumerate_callback; }; typedef std::vector<TypeSystemInstance> TypeSystemInstances; @@ -2102,11 +2103,11 @@ static TypeSystemInstances &GetTypeSystemInstances() { return g_instances; } -bool PluginManager::RegisterPlugin( - ConstString name, const char *description, - TypeSystemCreateInstance create_callback, - LanguageSet supported_languages_for_types, - LanguageSet supported_languages_for_expressions) { +bool PluginManager::RegisterPlugin(ConstString name, + const char *description, + TypeSystemCreateInstance create_callback, + TypeSystemEnumerateSupportedLanguages + enumerate_supported_languages_callback) { if (create_callback) { TypeSystemInstance instance; assert((bool)name); @@ -2114,8 +2115,7 @@ bool PluginManager::RegisterPlugin( if (description && description[0]) instance.description = description; instance.create_callback = create_callback; - instance.supported_languages_for_types = supported_languages_for_types; - instance.supported_languages_for_expressions = supported_languages_for_expressions; + instance.enumerate_callback = enumerate_supported_languages_callback; std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex()); GetTypeSystemInstances().push_back(instance); } @@ -2163,22 +2163,30 @@ PluginManager::GetTypeSystemCreateCallbackForPluginName( return nullptr; } -LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForTypes() { +TypeSystemEnumerateSupportedLanguages +PluginManager::GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex( + uint32_t idx) { std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex()); - LanguageSet all; TypeSystemInstances &instances = GetTypeSystemInstances(); - for (unsigned i = 0; i < instances.size(); ++i) - all.bitvector |= instances[i].supported_languages_for_types.bitvector; - return all; + if (idx < instances.size()) + return instances[idx].enumerate_callback; + return nullptr; } -LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForExpressions() { - std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex()); - LanguageSet all; - TypeSystemInstances &instances = GetTypeSystemInstances(); - for (unsigned i = 0; i < instances.size(); ++i) - all.bitvector |= instances[i].supported_languages_for_expressions.bitvector; - return all; +TypeSystemEnumerateSupportedLanguages +PluginManager::GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName( + ConstString name) { + if (name) { + std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex()); + TypeSystemInstances &instances = GetTypeSystemInstances(); + + TypeSystemInstances::iterator pos, end = instances.end(); + for (pos = instances.begin(); pos != end; ++pos) { + if (name == pos->name) + return pos->enumerate_callback; + } + } + return nullptr; } #pragma mark REPL @@ -2189,7 +2197,7 @@ struct REPLInstance { ConstString name; std::string description; REPLCreateInstance create_callback; - LanguageSet supported_languages; + REPLEnumerateSupportedLanguages enumerate_languages_callback; }; typedef std::vector<REPLInstance> REPLInstances; @@ -2204,9 +2212,10 @@ static REPLInstances &GetREPLInstances() { return g_instances; } -bool PluginManager::RegisterPlugin(ConstString name, const char *description, - REPLCreateInstance create_callback, - LanguageSet supported_languages) { +bool PluginManager::RegisterPlugin( + ConstString name, const char *description, + REPLCreateInstance create_callback, + REPLEnumerateSupportedLanguages enumerate_languages_callback) { if (create_callback) { REPLInstance instance; assert((bool)name); @@ -2214,7 +2223,7 @@ bool PluginManager::RegisterPlugin(ConstString name, const char *description, if (description && description[0]) instance.description = description; instance.create_callback = create_callback; - instance.supported_languages = supported_languages; + instance.enumerate_languages_callback = enumerate_languages_callback; std::lock_guard<std::recursive_mutex> guard(GetREPLMutex()); GetREPLInstances().push_back(instance); } @@ -2260,13 +2269,29 @@ PluginManager::GetREPLCreateCallbackForPluginName(ConstString name) { return nullptr; } -LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() { +REPLEnumerateSupportedLanguages +PluginManager::GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx) { std::lock_guard<std::recursive_mutex> guard(GetREPLMutex()); - LanguageSet all; REPLInstances &instances = GetREPLInstances(); - for (unsigned i = 0; i < instances.size(); ++i) - all.bitvector |= instances[i].supported_languages.bitvector; - return all; + if (idx < instances.size()) + return instances[idx].enumerate_languages_callback; + return nullptr; +} + +REPLEnumerateSupportedLanguages +PluginManager::GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName( + ConstString name) { + if (name) { + std::lock_guard<std::recursive_mutex> guard(GetREPLMutex()); + REPLInstances &instances = GetREPLInstances(); + + REPLInstances::iterator pos, end = instances.end(); + for (pos = instances.begin(); pos != end; ++pos) { + if (name == pos->name) + return pos->enumerate_languages_callback; + } + } + return nullptr; } #pragma mark PluginManager |