diff options
| -rw-r--r-- | lldb/include/lldb/Target/ObjCLanguageRuntime.h | 6 | ||||
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 7 | ||||
| -rw-r--r-- | lldb/source/Symbol/Symtab.cpp | 3 | ||||
| -rw-r--r-- | lldb/source/Target/ObjCLanguageRuntime.cpp | 43 |
5 files changed, 39 insertions, 26 deletions
diff --git a/lldb/include/lldb/Target/ObjCLanguageRuntime.h b/lldb/include/lldb/Target/ObjCLanguageRuntime.h index 793922168e5..d2971eea997 100644 --- a/lldb/include/lldb/Target/ObjCLanguageRuntime.h +++ b/lldb/include/lldb/Target/ObjCLanguageRuntime.h @@ -103,7 +103,11 @@ public: // sub-parts that are passed in non-NULL. The base_name means the name stripped of // category attributes. static bool - ParseMethodName (const char *name, ConstString *class_name, ConstString *method_name, ConstString *base_name); + ParseMethodName (const char *name, + ConstString *class_name, // Class name (with category if there is one) + ConstString *selector_name, // selector only + ConstString *name_sans_category, // full function name with no category + ConstString *class_name_sans_category);// Class name without category (empty if no category) static bool IsPossibleObjCMethodName (const char *name) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp index 185a5cc7532..f13bba5858e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -737,12 +737,16 @@ DWARFCompileUnit::Index (const uint32_t cu_idx, ConstString objc_class_name; ConstString objc_selector_name; ConstString objc_fullname_no_category_name; + ConstString objc_class_name_no_category; if (ObjCLanguageRuntime::ParseMethodName (name, &objc_class_name, &objc_selector_name, - &objc_fullname_no_category_name)) + &objc_fullname_no_category_name, + &objc_class_name_no_category)) { objc_class_selectors.Insert(objc_class_name, die.GetOffset()); + if (objc_class_name_no_category) + objc_class_selectors.Insert(objc_class_name_no_category, die.GetOffset()); func_selectors.Insert (objc_selector_name, die.GetOffset()); func_fullnames.Insert (ConstString(name), die.GetOffset()); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 671afdd8373..7ebd02600ad 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4898,17 +4898,14 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, if (tag == DW_TAG_subprogram) { ConstString class_name; - - if (ObjCLanguageRuntime::ParseMethodName (type_name_cstr, &class_name, NULL, NULL)) + if (ObjCLanguageRuntime::ParseMethodName (type_name_cstr, NULL, NULL, NULL, &class_name)) { SymbolContext empty_sc; clang_type_t class_opaque_type = NULL; if (class_name) { TypeList types; - TypeSP complete_objc_class_type_sp (FindCompleteObjCDefinitionTypeForDIE (NULL, class_name, true)); - if (!complete_objc_class_type_sp) - complete_objc_class_type_sp = FindCompleteObjCDefinitionTypeForDIE (NULL, class_name, false); + TypeSP complete_objc_class_type_sp (FindCompleteObjCDefinitionTypeForDIE (NULL, class_name, false)); if (complete_objc_class_type_sp) { diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 0dd5f313d3b..ea354af258e 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -313,7 +313,8 @@ Symtab::InitNameIndexes() if (ObjCLanguageRuntime::ParseMethodName (entry.cstring, NULL, NULL, - &objc_base_name) + &objc_base_name, + NULL) && !objc_base_name.IsEmpty()) { entry.cstring = objc_base_name.GetCString(); diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index 42e707cdd8e..e8fc510ecf6 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -103,13 +103,19 @@ ObjCLanguageRuntime::GetByteOffsetForIvar (ClangASTType &parent_qual_type, const bool ObjCLanguageRuntime::ParseMethodName (const char *name, - ConstString *class_name, - ConstString *selector_name, - ConstString *name_sans_category) + ConstString *class_name, // Class name (with category if any) + ConstString *selector_name, // selector on its own + ConstString *name_sans_category, // Full function prototype with no category + ConstString *class_name_sans_category)// Class name with no category (or empty if no category as answer will be in "class_name" { - if (class_name) { class_name->Clear(); } - if (selector_name) { selector_name->Clear(); } - if (name_sans_category) { name_sans_category->Clear(); } + if (class_name) + class_name->Clear(); + if (selector_name) + selector_name->Clear(); + if (name_sans_category) + name_sans_category->Clear(); + if (class_name_sans_category) + class_name_sans_category->Clear(); if (IsPossibleObjCMethodName (name)) { @@ -122,8 +128,7 @@ ObjCLanguageRuntime::ParseMethodName (const char *name, // "]" suffix if (name_len >= 6 && name[name_len - 1] == ']') { - const char *selector_name_ptr; - selector_name_ptr = strchr (name, ' '); + const char *selector_name_ptr = strchr (name, ' '); if (selector_name_ptr) { if (class_name) @@ -140,18 +145,21 @@ ObjCLanguageRuntime::ParseMethodName (const char *name, // Also see if this is a "category" on our class. If so strip off the category name, // and add the class name without it to the basename table. - if (name_sans_category) + if (name_sans_category || class_name_sans_category) { - const char *first_paren = (char *) memchr (name, '(', selector_name_ptr - name); - if (first_paren) + const char *open_paren = strchr (name, '('); + const char *close_paren = NULL; + if (open_paren) { - const char *second_paren = (char *) memchr (first_paren, ')', selector_name_ptr - first_paren); - if (second_paren) + if (class_name_sans_category) + class_name_sans_category->SetCStringWithLength (name + 2, open_paren - name - 2); + close_paren = strchr (name, ')'); + if (close_paren) { - std::string buffer (name, first_paren - name); - buffer.append (second_paren + 1); + std::string buffer (name, open_paren - name); + buffer.append (close_paren + 1); name_sans_category->SetCString (buffer.c_str()); - + } } } @@ -160,6 +168,5 @@ ObjCLanguageRuntime::ParseMethodName (const char *name, } return false; } - else - return false; + return false; } |

