diff options
Diffstat (limited to 'lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp')
-rw-r--r-- | lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index 45cb4851aae..1e12a66af30 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -220,43 +220,46 @@ ConstString ObjCLanguage::MethodName::GetFullNameWithoutCategory( return ConstString(); } -size_t ObjCLanguage::MethodName::GetFullNames(std::vector<ConstString> &names, - bool append) { - if (!append) - names.clear(); - if (IsValid(false)) { +std::vector<ConstString> +ObjCLanguage::GetMethodNameVariants(ConstString method_name) const { + std::vector<ConstString> variant_names; + ObjCLanguage::MethodName objc_method(method_name.GetCString(), false); + if (!objc_method.IsValid(false)) { + return variant_names; + } + + const bool is_class_method = + objc_method.GetType() == MethodName::eTypeClassMethod; + const bool is_instance_method = + objc_method.GetType() == MethodName::eTypeInstanceMethod; + ConstString name_sans_category = + objc_method.GetFullNameWithoutCategory(/*empty_if_no_category*/ true); + + if (is_class_method || is_instance_method) { + if (name_sans_category) + variant_names.emplace_back(name_sans_category); + } else { StreamString strm; - const bool is_class_method = m_type == eTypeClassMethod; - const bool is_instance_method = m_type == eTypeInstanceMethod; - ConstString category = GetCategory(); - if (is_class_method || is_instance_method) { - names.push_back(m_full); - if (category) { - strm.Printf("%c[%s %s]", is_class_method ? '+' : '-', - GetClassName().GetCString(), GetSelector().GetCString()); - names.emplace_back(strm.GetString()); - } - } else { - ConstString class_name = GetClassName(); - ConstString selector = GetSelector(); - strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString()); - names.emplace_back(strm.GetString()); - strm.Clear(); - strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString()); - names.emplace_back(strm.GetString()); + + strm.Printf("+%s", objc_method.GetFullName().GetCString()); + variant_names.emplace_back(strm.GetString()); + strm.Clear(); + + strm.Printf("-%s", objc_method.GetFullName().GetCString()); + variant_names.emplace_back(strm.GetString()); + strm.Clear(); + + if (name_sans_category) { + strm.Printf("+%s", name_sans_category.GetCString()); + variant_names.emplace_back(strm.GetString()); strm.Clear(); - if (category) { - strm.Printf("+[%s(%s) %s]", class_name.GetCString(), - category.GetCString(), selector.GetCString()); - names.emplace_back(strm.GetString()); - strm.Clear(); - strm.Printf("-[%s(%s) %s]", class_name.GetCString(), - category.GetCString(), selector.GetCString()); - names.emplace_back(strm.GetString()); - } + + strm.Printf("-%s", name_sans_category.GetCString()); + variant_names.emplace_back(strm.GetString()); } } - return names.size(); + + return variant_names; } static void LoadObjCFormatters(TypeCategoryImplSP objc_category_sp) { |