Skip to content
Snippets Groups Projects
  • Simon Marchi's avatar
    d7789889
    gdbsupport: allow passing nullptr to checked_static_cast · d7789889
    Simon Marchi authored
    Both static_cast and dynamic_cast handle nullptr (they return nullptr),
    so I think checked_static_cast should too.  This will allow doing a null
    check after a checked_static_cast:
    
      cooked_index_vector *table
        = (gdb::checked_static_cast<cooked_index_vector *>
           (per_bfd->index_table.get ()));
      if (table != nullptr)
        return;
    
    Change-Id: If5c3134e63696f8e417c87b5f3901240c9f7ea97
    d7789889
    History
    gdbsupport: allow passing nullptr to checked_static_cast
    Simon Marchi authored
    Both static_cast and dynamic_cast handle nullptr (they return nullptr),
    so I think checked_static_cast should too.  This will allow doing a null
    check after a checked_static_cast:
    
      cooked_index_vector *table
        = (gdb::checked_static_cast<cooked_index_vector *>
           (per_bfd->index_table.get ()));
      if (table != nullptr)
        return;
    
    Change-Id: If5c3134e63696f8e417c87b5f3901240c9f7ea97