dwarf2read: replace gdb::optional<bool> with enum
authorSimon Marchi <simon.marchi@efficios.com>
Sun, 25 Aug 2019 22:09:47 +0000 (18:09 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Sun, 25 Aug 2019 22:09:47 +0000 (18:09 -0400)
commitbeadd3e84ed8e652015f07eb4734a6d3b17e79cb
tree760d19a2058f7b19ef9d792d0bb44fd984110325
parente3ec872f8012377e50f0c9c888d2bc3163a356b2
dwarf2read: replace gdb::optional<bool> with enum

gdb::optional<bool> is dangerous, because it's easy to do:

  if (opt_bool)

when you actually meant

  if (*opt_bool)

or vice-versa.  The first checks if the optional is set, the second
checks if the wrapped bool is true.

Replace it with an enum that explicitly defines the three possible
states.

gdb/ChangeLog:

* dwarf2read.c (dw2_debug_names_iterator::next): Use enum to
represent whether the symbol is static, dynamic, or we don't
know.
gdb/ChangeLog
gdb/dwarf2read.c