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

Sean Callanan scallanan at apple.com
Tue Oct 5 17:10:07 PDT 2010


Author: spyffe
Date: Tue Oct  5 19:10:07 2010
New Revision: 115721

URL: http://llvm.org/viewvc/llvm-project?rev=115721&view=rev
Log:
Updated the expression parser to ignore non-external 
functions it finds in libraries unless it cannot find
an external function with the desired name.

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=115721&r1=115720&r2=115721&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Oct  5 19:10:07 2010
@@ -945,8 +945,9 @@
     
     m_sym_ctx->FindFunctionsByName(name_cs, false, sym_ctxs);
     
-    bool found_generic = false;
     bool found_specific = false;
+    Symbol *generic_symbol = NULL;
+    Symbol *non_extern_symbol = NULL;
     
     for (uint32_t index = 0, num_indices = sym_ctxs.GetSize();
          index < num_indices;
@@ -954,7 +955,7 @@
     {
         SymbolContext sym_ctx;
         sym_ctxs.GetContextAtIndex(index, sym_ctx);
-        
+
         if (sym_ctx.function)
         {
             // TODO only do this if it's a C function; C++ functions may be
@@ -963,16 +964,23 @@
                 AddOneFunction(context, sym_ctx.function, NULL);
             found_specific = true;
         }
-        else if(sym_ctx.symbol)
+        else if (sym_ctx.symbol)
         {
-            if (!found_generic && !found_specific)
-            {
-                AddOneFunction(context, NULL, sym_ctx.symbol);
-                found_generic = true;
-            }
+            if (sym_ctx.symbol->IsExternal())
+                generic_symbol = sym_ctx.symbol;
+            else
+                non_extern_symbol = sym_ctx.symbol;
         }
     }
     
+    if (!found_specific)
+    {
+        if (generic_symbol)
+            AddOneFunction(context, NULL, generic_symbol);
+        else if (non_extern_symbol)
+            AddOneFunction(context, NULL, non_extern_symbol);
+    }
+    
     Variable *var = FindVariableInScope(*m_exe_ctx->frame, name);
     
     if (var)





More information about the lldb-commits mailing list