[Lldb-commits] [lldb] r190008 - Report all methods in an Objective-C class that

Sean Callanan scallanan at apple.com
Wed Sep 4 16:25:26 PDT 2013


Author: spyffe
Date: Wed Sep  4 18:25:26 2013
New Revision: 190008

URL: http://llvm.org/viewvc/llvm-project?rev=190008&view=rev
Log:
Report all methods in an Objective-C class that
have a certain name, not just the first.  This
is useful if a class method and an instance
method have the same name.

<rdar://problem/14872081>

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=190008&r1=190007&r2=190008&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Sep  4 18:25:26 2013
@@ -878,31 +878,34 @@ FindObjCMethodDeclsWithOrigin (unsigned
     if (!result[0])
         return false;
     
-    ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(result[0]);
-    
-    if (!result_method)
-        return false;
-    
-    Decl *copied_decl = ast_importer->CopyDecl(ast_context, &result_method->getASTContext(), result_method);
-    
-    if (!copied_decl)
-        return false;
-    
-    ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
-    
-    if (!copied_method_decl)
-        return false;
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    
-    if (log)
+    for (NamedDecl *named_decl : result)
     {
-        ASTDumper dumper((Decl*)copied_method_decl);
-        log->Printf("  CAS::FOMD[%d] found (%s) %s", current_id, log_info, dumper.GetCString());
+        ObjCMethodDecl *result_method = dyn_cast<ObjCMethodDecl>(named_decl);
+        
+        if (!result_method)
+            return false;
+        
+        Decl *copied_decl = ast_importer->CopyDecl(ast_context, &result_method->getASTContext(), result_method);
+        
+        if (!copied_decl)
+            return false;
+        
+        ObjCMethodDecl *copied_method_decl = dyn_cast<ObjCMethodDecl>(copied_decl);
+        
+        if (!copied_method_decl)
+            return false;
+        
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+        
+        if (log)
+        {
+            ASTDumper dumper((Decl*)copied_method_decl);
+            log->Printf("  CAS::FOMD[%d] found (%s) %s", current_id, log_info, dumper.GetCString());
+        }
+        
+        context.AddNamedDecl(copied_method_decl);
     }
     
-    context.AddNamedDecl(copied_method_decl);
-    
     return true;
 }
 





More information about the lldb-commits mailing list