summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangASTSource.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-12-07 22:39:39 +0000
committerSean Callanan <scallanan@apple.com>2011-12-07 22:39:39 +0000
commit610baf42ce66a0b9ca9048b68bc5e8b819bb39d3 (patch)
tree4322b16f9d8b7e82a2ec2e7a171e678c7bec524c /lldb/source/Expression/ClangASTSource.cpp
parent56b70de01b98fe75adebf1ed7afa4d10799f8f9c (diff)
downloadbcm5719-llvm-610baf42ce66a0b9ca9048b68bc5e8b819bb39d3.tar.gz
bcm5719-llvm-610baf42ce66a0b9ca9048b68bc5e8b819bb39d3.zip
Fixed a few details of method lookup in Objective-C
symbols. Now we find the correct method. Unfortunately we don't get the superclass from the runtime yet so the method doesn't import correctly (and I added a check to make sure that doesn't hurt us) but once we get that information right we will report methods correctly to the parser as well. Getting superclass information requires a common AST context for all Objective-C runtime information, meaning that the superclass and the subclass are in the same AST context in all cases. That is the next thing that needs to be done here. llvm-svn: 146089
Diffstat (limited to 'lldb/source/Expression/ClangASTSource.cpp')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 19baef0b061..bae92cdc0a3 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -581,6 +581,7 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
clang::ASTContext &backing_ast_context = backing_interface_decl->getASTContext();
llvm::SmallVector<clang::IdentifierInfo *, 3> selector_components;
+ int num_arguments = 0;
if (decl_name.isObjCZeroArgSelector())
{
@@ -589,6 +590,7 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
else if (decl_name.isObjCOneArgSelector())
{
selector_components.push_back (&backing_ast_context.Idents.get(decl_name.getAsString().c_str()));
+ num_arguments = 1;
}
else
{
@@ -601,10 +603,11 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
llvm::StringRef r = sel.getNameForSlot(i);
selector_components.push_back (&backing_ast_context.Idents.get(r.str().c_str()));
+ num_arguments++;
}
}
- Selector backing_selector = backing_interface_decl->getASTContext().Selectors.getSelector(selector_components.size(), selector_components.data());
+ Selector backing_selector = backing_interface_decl->getASTContext().Selectors.getSelector(num_arguments, selector_components.data());
DeclarationName backing_decl_name = DeclarationName(backing_selector);
DeclContext::lookup_const_result lookup_result = backing_interface_decl->lookup(backing_decl_name);
@@ -619,6 +622,12 @@ ClangASTSource::FindObjCMethodDecls (NameSearchContext &context)
Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &backing_ast_context, *lookup_result.first);
+ if (!copied_decl)
+ {
+ log->Printf(" CAS::FOMD[%d] couldn't import method from symbols", current_id);
+ continue;
+ }
+
ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl> (copied_decl);
if (!copied_method_decl)
OpenPOWER on IntegriCloud