[Lldb-commits] [lldb] r168766 - /lldb/trunk/source/Expression/ClangASTSource.cpp

Sean Callanan scallanan at apple.com
Tue Nov 27 19:23:20 PST 2012


Author: spyffe
Date: Tue Nov 27 21:23:20 2012
New Revision: 168766

URL: http://llvm.org/viewvc/llvm-project?rev=168766&view=rev
Log:
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>

Modified:
    lldb/trunk/source/Expression/ClangASTSource.cpp

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=168766&r1=168765&r2=168766&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Nov 27 21:23:20 2012
@@ -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;





More information about the lldb-commits mailing list