summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Symbol/ClangASTContext.h6
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp80
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp67
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h5
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp20
5 files changed, 153 insertions, 25 deletions
diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index 6738776d27a..ab9caacfa68 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -195,6 +195,12 @@ public:
lldb::clang_type_t
GetCStringType(bool is_const);
+
+ lldb::clang_type_t
+ GetVoidType();
+
+ lldb::clang_type_t
+ GetVoidType(clang::ASTContext *ast);
lldb::clang_type_t
GetVoidPtrType(bool is_const);
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 9933ed1976e..f3f1f204a2f 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -648,6 +648,86 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
if (!interface_decl)
return;
+ do
+ {
+ Decl *original_decl = NULL;
+ ASTContext *original_ctx = NULL;
+
+ m_ast_importer->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx);
+
+ if (!original_decl)
+ break;
+
+ ObjCInterfaceDecl *original_interface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl);
+
+ Selector original_selector;
+
+ if (decl_name.isObjCZeroArgSelector())
+ {
+ IdentifierInfo *ident = &original_ctx->Idents.get(decl_name.getAsString());
+ original_selector = original_ctx->Selectors.getSelector(0, &ident);
+ }
+ else if (decl_name.isObjCOneArgSelector())
+ {
+ const std::string &decl_name_string = decl_name.getAsString();
+ std::string decl_name_string_without_colon(decl_name_string.c_str(), decl_name_string.length() - 1);
+ IdentifierInfo *ident = &original_ctx->Idents.get(decl_name_string_without_colon.c_str());
+ original_selector = original_ctx->Selectors.getSelector(1, &ident);
+ }
+ else
+ {
+ SmallVector<IdentifierInfo *, 4> idents;
+
+ clang::Selector sel = decl_name.getObjCSelector();
+
+ int num_args = sel.getNumArgs();
+
+ for (unsigned i = 0;
+ i != num_args;
+ ++i)
+ {
+ idents.push_back(&original_ctx->Idents.get(sel.getNameForSlot(i)));
+ }
+
+ original_selector = original_ctx->Selectors.getSelector(num_args, idents.data());
+ }
+
+ DeclarationName original_decl_name(original_selector);
+
+ ObjCInterfaceDecl::lookup_result result = original_interface_decl->lookup(original_decl_name);
+
+ if (result.first == result.second)
+ break;
+
+ if (!*result.first)
+ break;
+
+ ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(*result.first);
+
+ if (!result_method)
+ break;
+
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &result_method->getASTContext(), result_method);
+
+ if (!copied_decl)
+ continue;
+
+ ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
+
+ if (!copied_method_decl)
+ continue;
+
+ if (log)
+ {
+ ASTDumper dumper((Decl*)copied_method_decl);
+ log->Printf(" CAS::FOMD[%d] found (in debug info) %s", current_id, dumper.GetCString());
+ }
+
+ context.AddNamedDecl(copied_method_decl);
+
+ return;
+ } while (0);
+
StreamString ss;
if (decl_name.isObjCZeroArgSelector())
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5ce1b75f013..7a47ddb0a96 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1565,28 +1565,53 @@ SymbolFileDWARF::ParseChildMembers
}
}
}
-
- ConstString fixed_getter;
- ConstString fixed_setter;
-
- if (prop_getter_name && prop_getter_name[0] == '-')
- {
- ObjCLanguageRuntime::ParseMethodName (prop_getter_name,
- NULL,
- &fixed_getter,
- NULL,
- NULL);
- prop_getter_name = fixed_getter.GetCString();
- }
-
- if (prop_setter_name && prop_setter_name[0] == '-')
+
+ if (prop_name)
{
- ObjCLanguageRuntime::ParseMethodName (prop_setter_name,
- NULL,
- &fixed_setter,
- NULL,
- NULL);
- prop_setter_name = fixed_setter.GetCString();
+ ConstString fixed_getter;
+ ConstString fixed_setter;
+
+ // Check if the property getter/setter were provided as full
+ // names. We want basenames, so we extract them.
+
+ if (prop_getter_name && prop_getter_name[0] == '-')
+ {
+ ObjCLanguageRuntime::ParseMethodName (prop_getter_name,
+ NULL,
+ &fixed_getter,
+ NULL,
+ NULL);
+ prop_getter_name = fixed_getter.GetCString();
+ }
+
+ if (prop_setter_name && prop_setter_name[0] == '-')
+ {
+ ObjCLanguageRuntime::ParseMethodName (prop_setter_name,
+ NULL,
+ &fixed_setter,
+ NULL,
+ NULL);
+ prop_setter_name = fixed_setter.GetCString();
+ }
+
+ // If the names haven't been provided, they need to be
+ // filled in.
+
+ if (!prop_getter_name)
+ {
+ prop_getter_name = prop_name;
+ }
+ if (!prop_setter_name && prop_name[0] && !(prop_attributes & DW_APPLE_PROPERTY_readonly))
+ {
+ StreamString ss;
+
+ ss.Printf("set%c%s:",
+ toupper(prop_name[0]),
+ &prop_name[1]);
+
+ fixed_setter.SetCString(ss.GetData());
+ prop_setter_name = fixed_setter.GetCString();
+ }
}
// Clang has a DWARF generation bug where sometimes it
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 95568277881..b0a66cce039 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -512,6 +512,11 @@ protected:
bool
DIEDeclContextsMatch (DWARFCompileUnit* cu1, const DWARFDebugInfoEntry *die1,
DWARFCompileUnit* cu2, const DWARFDebugInfoEntry *die2);
+
+ bool
+ ClassContainsSelector (DWARFCompileUnit *dwarf_cu,
+ const DWARFDebugInfoEntry *class_die,
+ const lldb_private::ConstString &selector);
SymbolFileDWARFDebugMap * m_debug_map_symfile;
clang::TranslationUnitDecl * m_clang_tu_decl;
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 7b8c8e1796e..88e18a5db52 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -973,6 +973,18 @@ ClangASTContext::GetCStringType (bool is_const)
}
clang_type_t
+ClangASTContext::GetVoidType()
+{
+ return GetVoidType(getASTContext());
+}
+
+clang_type_t
+ClangASTContext::GetVoidType(ASTContext *ast)
+{
+ return ast->VoidTy.getAsOpaquePtr();
+}
+
+clang_type_t
ClangASTContext::GetVoidPtrType (bool is_const)
{
return GetVoidPtrType(getASTContext(), is_const);
@@ -2424,8 +2436,6 @@ ClangASTContext::AddObjCClassProperty
std::string property_setter_no_colon(property_setter_name, strlen(property_setter_name) - 1);
clang::IdentifierInfo *setter_ident = &identifier_table->get(property_setter_no_colon.c_str());
setter_sel = ast->Selectors.getSelector(1, &setter_ident);
- property_decl->setSetterName(setter_sel);
- property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_setter);
}
else if (!(property_attributes & DW_APPLE_PROPERTY_readonly))
{
@@ -2435,19 +2445,21 @@ ClangASTContext::AddObjCClassProperty
clang::IdentifierInfo *setter_ident = &identifier_table->get(setter_sel_string.c_str());
setter_sel = ast->Selectors.getSelector(1, &setter_ident);
}
+ property_decl->setSetterName(setter_sel);
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_setter);
if (property_getter_name != NULL)
{
clang::IdentifierInfo *getter_ident = &identifier_table->get(property_getter_name);
getter_sel = ast->Selectors.getSelector(0, &getter_ident);
- property_decl->setGetterName(getter_sel);
- property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_getter);
}
else
{
clang::IdentifierInfo *getter_ident = &identifier_table->get(property_name);
getter_sel = ast->Selectors.getSelector(0, &getter_ident);
}
+ property_decl->setGetterName(getter_sel);
+ property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_getter);
if (ivar_decl)
property_decl->setPropertyIvarDecl (ivar_decl);
OpenPOWER on IntegriCloud