Replace the block_found global with explicit data-flow
[deliverable/binutils-gdb.git] / gdb / compile / compile-c-symbols.c
index 68d38ba2f71017e64a9af2472cbf24a982757c07..21ce655b4e9cfa3c7dbb5d179e3e2e3ffe2db2b8 100644 (file)
@@ -304,13 +304,11 @@ convert_one_symbol (struct compile_c_instance *context,
 
 static void
 convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
-                   struct symbol *sym, domain_enum domain)
+                   struct block_symbol sym, domain_enum domain)
 {
-  const struct block *static_block, *found_block;
+  const struct block *static_block;
   int is_local_symbol;
 
-  found_block = block_found;
-
   /* If we found a symbol and it is not in the  static or global
      scope, then we should first convert any static or global scope
      symbol of the same name.  This lets this unusual case work:
@@ -323,24 +321,24 @@ convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
      }
   */
 
-  static_block = block_static_block (found_block);
+  static_block = block_static_block (sym.block);
   /* STATIC_BLOCK is NULL if FOUND_BLOCK is the global block.  */
-  is_local_symbol = (found_block != static_block && static_block != NULL);
+  is_local_symbol = (sym.block != static_block && static_block != NULL);
   if (is_local_symbol)
     {
-      struct symbol *global_sym;
+      struct block_symbol global_sym;
 
       global_sym = lookup_symbol (identifier, NULL, domain, NULL);
       /* If the outer symbol is in the static block, we ignore it, as
         it cannot be referenced.  */
-      if (global_sym != NULL
-         && block_found != block_static_block (block_found))
+      if (global_sym.symbol != NULL
+         && global_sym.block != block_static_block (global_sym.block))
        {
          if (compile_debug)
            fprintf_unfiltered (gdb_stdlog,
                                "gcc_convert_symbol \"%s\": global symbol\n",
                                identifier);
-         convert_one_symbol (context, global_sym, 1, 0);
+         convert_one_symbol (context, global_sym.symbol, 1, 0);
        }
     }
 
@@ -348,7 +346,7 @@ convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
     fprintf_unfiltered (gdb_stdlog,
                        "gcc_convert_symbol \"%s\": local symbol\n",
                        identifier);
-  convert_one_symbol (context, sym, 0, is_local_symbol);
+  convert_one_symbol (context, sym.symbol, 0, is_local_symbol);
 }
 
 /* Convert a minimal symbol to its gcc form.  CONTEXT is the compiler
@@ -444,10 +442,10 @@ gcc_convert_symbol (void *datum,
      is to simply emit a gcc error.  */
   TRY
     {
-      struct symbol *sym;
+      struct block_symbol sym;
 
       sym = lookup_symbol (identifier, context->base.block, domain, NULL);
-      if (sym != NULL)
+      if (sym.symbol != NULL)
        {
          convert_symbol_sym (context, identifier, sym, domain);
          found = 1;
@@ -495,7 +493,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
       struct symbol *sym;
 
       /* We only need global functions here.  */
-      sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL);
+      sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL).symbol;
       if (sym != NULL && SYMBOL_CLASS (sym) == LOC_BLOCK)
        {
          if (compile_debug)
This page took 0.02923 seconds and 4 git commands to generate.