If Clang is looking for an Objective-C method on
a type, and we find it in the origin for that
type, don't look anywhere else; just report it.
<rdar://problem/12675970>
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168766 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index 67fdace..81400ff 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -750,7 +750,7 @@
return DeclFromParser<D>(dyn_cast<D>(parser_generic_decl.decl));
}
-static void
+static bool
FindObjCMethodDeclsWithOrigin (unsigned int current_id,
NameSearchContext &context,
ObjCInterfaceDecl *original_interface_decl,
@@ -798,25 +798,25 @@
ObjCInterfaceDecl::lookup_result result = original_interface_decl->lookup(original_decl_name);
if (result.first == result.second)
- return;
+ return false;
if (!*result.first)
- return;
+ return false;
ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(*result.first);
if (!result_method)
- return;
+ return false;
Decl *copied_decl = ast_importer->CopyDecl(ast_context, &result_method->getASTContext(), result_method);
if (!copied_decl)
- return;
+ return false;
ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
if (!copied_method_decl)
- return;
+ return false;
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -828,7 +828,7 @@
context.AddNamedDecl(copied_method_decl);
- return;
+ return true;
}
void
@@ -859,12 +859,13 @@
ObjCInterfaceDecl *original_interface_decl = dyn_cast<ObjCInterfaceDecl>(original_decl);
- FindObjCMethodDeclsWithOrigin(current_id,
- context,
- original_interface_decl,
- m_ast_context,
- m_ast_importer,
- "at origin");
+ if (FindObjCMethodDeclsWithOrigin(current_id,
+ context,
+ original_interface_decl,
+ m_ast_context,
+ m_ast_importer,
+ "at origin"))
+ return; // found it, no need to look any further
} while (0);
StreamString ss;