[Lldb-commits] [lldb] r160907 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp

Sean Callanan scallanan at apple.com
Fri Jul 27 17:21:01 PDT 2012


Author: spyffe
Date: Fri Jul 27 19:21:01 2012
New Revision: 160907

URL: http://llvm.org/viewvc/llvm-project?rev=160907&view=rev
Log:
Fixed the expression parser to ignore C++ and
Objective-C method names when looking for functions
in the top level or a namespace.  Method names should
only be found via FindExternalLexicalDecls.

<rdar://problem/11711679>

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

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=160907&r1=160906&r2=160907&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Jul 27 19:21:01 2012
@@ -2703,6 +2703,9 @@
             {
                 const bool include_symbols = true;
                 
+                // TODO Fix FindFunctions so that it doesn't return
+                //   instance methods for eFunctionNameTypeBase.
+                
                 target->GetImages().FindFunctions(name,
                                                   eFunctionNameTypeBase,
                                                   include_symbols,
@@ -2725,6 +2728,14 @@
                     
                     if (sym_ctx.function)
                     {
+                        clang::DeclContext *decl_ctx = sym_ctx.function->GetClangDeclContext();
+                        
+                        // Filter out class/instance methods.
+                        if (dyn_cast<clang::ObjCMethodDecl>(decl_ctx))
+                            continue;
+                        if (dyn_cast<clang::CXXMethodDecl>(decl_ctx))
+                            continue;
+                        
                         // TODO only do this if it's a C function; C++ functions may be
                         // overloaded
                         if (!context.m_found.function_with_type_info)
@@ -3281,10 +3292,15 @@
     {
         ASTDumper ast_dumper(fun_decl);
         
-        log->Printf("  CEDM::FEVD[%u] Found %s function %s, returned %s", 
+        StreamString ss;
+        
+        fun_address->Dump(&ss, m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(), Address::DumpStyleResolvedDescription);
+        
+        log->Printf("  CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
                     current_id,
                     (fun ? "specific" : "generic"), 
-                    decl_name.c_str(), 
+                    decl_name.c_str(),
+                    ss.GetData(),
                     ast_dumper.GetCString());
     }
 }





More information about the lldb-commits mailing list