[Lldb-commits] [lldb] r141808 - in /lldb/trunk: include/lldb/Expression/ClangASTSource.h source/Expression/ClangExpressionDeclMap.cpp

Sean Callanan scallanan at apple.com
Wed Oct 12 13:29:25 PDT 2011


Author: spyffe
Date: Wed Oct 12 15:29:25 2011
New Revision: 141808

URL: http://llvm.org/viewvc/llvm-project?rev=141808&view=rev
Log:
Refactoring in preparation for having multiple
calls to the FindExternalVisibleDecls function.

FindExternalVisibleDecls was recording whether
it had found generic function symbols in variables
that were local to the function.  Now, however,
multiple calls occur in response to one request
from Clang, since we may be searching across
namespaces.  To support that, I moved the local
variables into a bitfield in NameSearchContext.

Modified:
    lldb/trunk/include/lldb/Expression/ClangASTSource.h
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=141808&r1=141807&r2=141808&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Wed Oct 12 15:29:25 2011
@@ -185,6 +185,12 @@
     const clang::DeclarationName &m_decl_name;          ///< The name being looked for
     const clang::DeclContext *m_decl_context;           ///< The DeclContext to put declarations into
     
+    struct {
+        bool variable                   : 1;
+        bool function_with_type_info    : 1;
+        bool function                   : 1;
+    } m_found;
+    
     //------------------------------------------------------------------
     /// Constructor
     ///

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141808&r1=141807&r2=141808&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 15:29:25 2011
@@ -2335,7 +2335,6 @@
         ValueObjectSP valobj;
         VariableSP var;
         Error err;
-        bool found = false;
         
         if (frame && !namespace_decl)
         {
@@ -2349,7 +2348,7 @@
             if (err.Success() && var != NULL)
             {
                 AddOneVariable(context, var);
-                found = true;
+                context.m_found.variable = true;
             }
         }
         else if (target)
@@ -2363,11 +2362,11 @@
             if (var)
             {
                 AddOneVariable(context, var);
-                found = true;
+                context.m_found.variable = true;
             }
         }
         
-        if (!found)
+        if (!context.m_found.variable)
         {
             const bool include_symbols = true;
             const bool append = false;
@@ -2392,7 +2391,6 @@
             
             if (sc_list.GetSize())
             {
-                bool found_specific = false;
                 Symbol *generic_symbol = NULL;
                 Symbol *non_extern_symbol = NULL;
                 
@@ -2407,10 +2405,10 @@
                     {
                         // TODO only do this if it's a C function; C++ functions may be
                         // overloaded
-                        if (!found_specific)
+                        if (!context.m_found.function_with_type_info)
                             AddOneFunction(context, sym_ctx.function, NULL);
-                        found_specific = true;
-                        found = true;
+                        context.m_found.function_with_type_info = true;
+                        context.m_found.function = true;
                     }
                     else if (sym_ctx.symbol)
                     {
@@ -2421,24 +2419,24 @@
                     }
                 }
                 
-                if (!found_specific)
+                if (!context.m_found.function_with_type_info)
                 {
                     if (generic_symbol)
                     {
                         AddOneFunction (context, NULL, generic_symbol);
-                        found = true;
+                        context.m_found.function = true;
                     }
                     else if (non_extern_symbol)
                     {
                         AddOneFunction (context, NULL, non_extern_symbol);
-                        found = true;
+                        context.m_found.function = true;
                     }
                 }
             }
             
-            if (!found)
+            if (!context.m_found.variable)
             {
-                // We couldn't find a variable or function for this.  Now we'll hunt for a generic 
+                // We couldn't find a non-symbol variable for this.  Now we'll hunt for a generic 
                 // data symbol, and -- if it is found -- treat it as a variable.
                 
                 Symbol *data_symbol = FindGlobalDataSymbol(*target, module_sp, name, &namespace_decl);
@@ -2446,7 +2444,7 @@
                 if (data_symbol)
                 {
                     AddOneGenericVariable(context, *data_symbol);
-                    found = true;
+                    context.m_found.variable = true;
                 }
             }
         }





More information about the lldb-commits mailing list