]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Consolidate CU language setting
authorTom Tromey <tom@tromey.com>
Fri, 25 Jun 2021 18:23:04 +0000 (12:23 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 25 Jun 2021 18:23:04 +0000 (12:23 -0600)
commitbf1dcdb3910e003c29c278ddb48eb56cfd045138
tree62737349a9aa423cc10b9627593ad0b1a765778b
parent6b95f5ad9684530960eb828c76755a7b27a44e43
Consolidate CU language setting

The DWARF reader currently sets the CU's language in two different
spots.  It is primarily done in prepare_one_comp_unit, but
read_file_scope also checks the producer and may change the language
based on the result.

This patch consolidates all language-setting into
prepare_one_comp_unit.  set_cu_language is renamed and changed not to
set language_defn; instead that is done in prepare_one_comp_unit after
the correct language enum value is chosen.

This fixes a minor latent bug, which is that read_file_scope could set
the language enum value to language_opencl, but then neglected to
reset language_defn in this case.

gdb/ChangeLog
2021-06-25  Tom Tromey  <tom@tromey.com>

* dwarf2/read.c (read_file_scope): Don't call set_cu_language.
(dwarf_lang_to_enum_language): Rename from set_cu_language.  Don't
set language_defn.  Handle DW_LANG_OpenCL.
(prepare_one_comp_unit): Check producer and set language_defn.
gdb/ChangeLog
gdb/dwarf2/read.c