summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-05-11 03:32:25 +0000
committerAlex Langford <apl@fb.com>2019-05-11 03:32:25 +0000
commit58a638b79f45dd80506cfcc23fd0483d3e3b80eb (patch)
tree7d57ec62e027bed1da264a92cf5b219851989716 /lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
parent3814d60035680054c6c8349e678046527cfae45e (diff)
downloadbcm5719-llvm-58a638b79f45dd80506cfcc23fd0483d3e3b80eb.tar.gz
bcm5719-llvm-58a638b79f45dd80506cfcc23fd0483d3e3b80eb.zip
[Breakpoint] Make breakpoint language agnostic
Summary: Breakpoint shouldn't need to depend on any specific details from a programming language. Currently the only language-specific detail it takes advantage of are the different qualified names an objective-c method name might have when adding a name lookup. This is reasonably generalizable. The current method name I introduced is "GetVariantMethodNames", which I'm not particularly tied to. If you have a better suggestion, please do let me know. Reviewers: JDevlieghere, jingham, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D61746 llvm-svn: 360509
Diffstat (limited to 'lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp')
-rw-r--r--lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp69
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) {
OpenPOWER on IntegriCloud