From 68f115f8c088bafd7d60b1245867ee8f42ccfcef Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Wed, 24 Mar 2021 13:41:14 -0700 Subject: [PATCH] Fix TYPE_DECLARED_CLASS thinko Simon pointed out an error that I made in compile_cplus_conver_struct_or_union in my original C++ compile submission: if (type->code () == TYPE_CODE_STRUCT) { const char *what = TYPE_DECLARED_CLASS (type) ? "struct" : "class"; resuld = instance->plugin ().build_decl (what, name.get (), (GCC_CP_SYMBOL_CLASS | nested_access | (TYPE_DECLARED_CLASS (type) ? GCC_CP_FLAG_CLASS_NOFLAG : GCC_CP_FLAG_CLASS_IS_STRUCT)), 0, nullptr, 0, filename, line); } Notice that WHAT will contain "struct" for TYPE_DECLARED_CLASS. Whoops. Fortunately this first parameter of build_decl is only used for debugging. gdb/ChangeLog 2021-03-24 Keith Seitz * compile/compile-cplus-types.c (compile_cplus_convert_struct_or_union): Fix TYPE_DECLARED_CLASS thinko. --- gdb/ChangeLog | 6 ++++++ gdb/compile/compile-cplus-types.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7b867f014db..bd869661f69 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-03-24 Keith Seitz + + * compile/compile-cplus-types.c + (compile_cplus_convert_struct_or_union): Fix TYPE_DECLARED_CLASS + thinko. + 2021-03-24 Simon Marchi * gdbarch.sh (gdbarch_data_registry): Make static. diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index d666ac3a83e..ef5fbcf133a 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -828,7 +828,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance, gcc_decl resuld; if (type->code () == TYPE_CODE_STRUCT) { - const char *what = TYPE_DECLARED_CLASS (type) ? "struct" : "class"; + const char *what = TYPE_DECLARED_CLASS (type) ? "class" : "struct"; resuld = instance->plugin ().build_decl (what, name.get (), (GCC_CP_SYMBOL_CLASS | nested_access -- 2.30.2