/* The generic symbol table building routines have separate lists for
file scope symbols and all all other scopes (local scopes). So
we need to select the right one to pass to add_symbol_to_list().
- We do it by keeping a pointer to the correct list in list_in_scope.
-
- FIXME: The original dwarf code just treated the file scope as the
- first local scope, and all other local scopes as nested local
- scopes, and worked fine. Check to see if we really need to
- distinguish these in buildsym.c. */
+ We do it by keeping a pointer to the correct list in list_in_scope. */
std::vector<symbol *> *list_in_scope = nullptr;
/* Storage for things with the same lifetime as this read-in
/* We're inheriting ORIGIN's children into the scope we'd put DIE's
symbols in. */
- std::vector<symbol *> *origin_previous_list_in_scope
- = origin_cu->list_in_scope;
- origin_cu->list_in_scope = cu->list_in_scope;
+ scoped_restore save_scope = make_scoped_restore (&origin_cu->list_in_scope,
+ cu->list_in_scope);
if (die->tag != origin_die->tag
&& !(die->tag == DW_TAG_inlined_subroutine
}
}
- origin_cu->list_in_scope = origin_previous_list_in_scope;
-
if (cu != origin_cu)
compute_delayed_physnames (origin_cu);
}
attr_to_dynamic_prop (attr, die, cu, static_link, cu->addr_type ());
}
- cu->list_in_scope = &cu->get_builder ()->get_local_symbols ();
+ scoped_restore save_scope
+ = make_scoped_restore (&cu->list_in_scope,
+ &cu->get_builder ()->get_local_symbols ());
for (die_info *child_die : die->children ())
{
back to building a containing block's symbol lists. */
cu->get_builder ()->get_local_symbols () = std::move (cstk.locals);
cu->get_builder ()->set_local_using_directives (cstk.local_using_directives);
-
- /* If we've finished processing a top-level function, subsequent
- symbols go in the file symbol list. */
- if (cu->get_builder ()->outermost_context_p ())
- cu->list_in_scope = &cu->get_builder ()->get_file_symbols ();
}
/* Process all the DIES contained within a lexical block scope. Start