Fix TYPE_DECLARED_CLASS thinko
authorKeith Seitz <keiths@redhat.com>
Wed, 24 Mar 2021 20:41:14 +0000 (13:41 -0700)
committerKeith Seitz <keiths@redhat.com>
Wed, 24 Mar 2021 20:44:17 +0000 (13:44 -0700)
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  <keiths@redhat.com>

* compile/compile-cplus-types.c
(compile_cplus_convert_struct_or_union): Fix TYPE_DECLARED_CLASS
thinko.

gdb/ChangeLog
gdb/compile/compile-cplus-types.c

index 7b867f014dba3ccceadbdc6ba293fb006bc5577b..bd869661f69c508c0094b1fc6a2f7e023d985d31 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-24  Keith Seitz  <keiths@redhat.com>
+
+       * compile/compile-cplus-types.c
+       (compile_cplus_convert_struct_or_union): Fix TYPE_DECLARED_CLASS
+       thinko.
+
 2021-03-24  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * gdbarch.sh (gdbarch_data_registry): Make static.
index d666ac3a83ed3b7169ef58ad42e6ea4e40475e7b..ef5fbcf133a107c5b9c83c7080f98fe0e50f94fc 100644 (file)
@@ -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