Skip to content
Snippets Groups Projects
  • Pedro Alves's avatar
    40d97ee2
    Eliminate the two-level data structures behind location_specs · 40d97ee2
    Pedro Alves authored
    Currently, there's the location_spec hierarchy, and then some
    location_spec subclasses have their own struct type holding all their
    data fields.
    
    I.e., there is this:
    
     location_spec
       explicit_location_spec
       linespec_location_spec
       address_location_spec
       probe_location_spec
    
    and then these separate types:
    
      explicit_location
      linespec_location
    
    where:
    
      explicit_location_spec
         has-a explicit_location
      linespec_location_spec
         has-a linespec_location
    
    This patch eliminates explicit_location and linespec_location,
    inlining their members in the corresponding location_spec type.
    
    The location_spec subclasses were the ones currently defined in
    location.c, so they are moved to the header.  Since the definitions of
    the classes are now visible, we no longer need location_spec_deleter.
    
    Some constructors that are used for cloning location_specs, like:
    
      explicit explicit_location_spec (const struct explicit_location *loc)
    
    ... were converted to proper copy ctors.
    
    In the process, initialize_explicit_location is eliminated, and some
    functions that returned the "data type behind a locspec", like
    get_linespec_location are converted to downcast functions, like
    as_linespec_location_spec.
    
    Change-Id: Ia31ccef9382b25a52b00fa878c8df9b8cf2a6c5a
    40d97ee2
    History
    Eliminate the two-level data structures behind location_specs
    Pedro Alves authored
    Currently, there's the location_spec hierarchy, and then some
    location_spec subclasses have their own struct type holding all their
    data fields.
    
    I.e., there is this:
    
     location_spec
       explicit_location_spec
       linespec_location_spec
       address_location_spec
       probe_location_spec
    
    and then these separate types:
    
      explicit_location
      linespec_location
    
    where:
    
      explicit_location_spec
         has-a explicit_location
      linespec_location_spec
         has-a linespec_location
    
    This patch eliminates explicit_location and linespec_location,
    inlining their members in the corresponding location_spec type.
    
    The location_spec subclasses were the ones currently defined in
    location.c, so they are moved to the header.  Since the definitions of
    the classes are now visible, we no longer need location_spec_deleter.
    
    Some constructors that are used for cloning location_specs, like:
    
      explicit explicit_location_spec (const struct explicit_location *loc)
    
    ... were converted to proper copy ctors.
    
    In the process, initialize_explicit_location is eliminated, and some
    functions that returned the "data type behind a locspec", like
    get_linespec_location are converted to downcast functions, like
    as_linespec_location_spec.
    
    Change-Id: Ia31ccef9382b25a52b00fa878c8df9b8cf2a6c5a