[Lldb-commits] [lldb] r312267 - [TypeSystem] Reduce code duplication merging two almost identical functions.
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 31 11:47:49 PDT 2017
Author: davide
Date: Thu Aug 31 11:47:49 2017
New Revision: 312267
URL: http://llvm.org/viewvc/llvm-project?rev=312267&view=rev
Log:
[TypeSystem] Reduce code duplication merging two almost identical functions.
Modified:
lldb/trunk/source/Symbol/TypeSystem.cpp
Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=312267&r1=312266&r2=312267&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Thu Aug 31 11:47:49 2017
@@ -28,14 +28,14 @@ TypeSystem::TypeSystem(LLVMCastKind kind
TypeSystem::~TypeSystem() {}
-lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
- Module *module) {
+static lldb::TypeSystemSP CreateInstanceHelper(lldb::LanguageType language,
+ Module *module, Target *target) {
uint32_t i = 0;
TypeSystemCreateInstance create_callback;
while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex(
i++)) != nullptr) {
lldb::TypeSystemSP type_system_sp =
- create_callback(language, module, nullptr);
+ create_callback(language, module, target);
if (type_system_sp)
return type_system_sp;
}
@@ -44,18 +44,13 @@ lldb::TypeSystemSP TypeSystem::CreateIns
}
lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
- Target *target) {
- uint32_t i = 0;
- TypeSystemCreateInstance create_callback;
- while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex(
- i++)) != nullptr) {
- lldb::TypeSystemSP type_system_sp =
- create_callback(language, nullptr, target);
- if (type_system_sp)
- return type_system_sp;
- }
+ Module *module) {
+ return CreateInstanceHelper(language, module, nullptr);
+}
- return lldb::TypeSystemSP();
+lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
+ Target *target) {
+ return CreateInstanceHelper(language, nullptr, target);
}
bool TypeSystem::IsAnonymousType(lldb::opaque_compiler_type_t type) {
More information about the lldb-commits
mailing list