RE: [PATCH 07/16] gdb: convert type instance flags to bitfields
"Aktemur, Baris" <[email protected]> Wed, 22 Jul 2026 10:29:30 +0000
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <DM4PR12MB64703321566973E0EA354837F8C12@DM4PR12MB6470.namprd12.prod.outlook.com> |
AMD General On Tuesday, July 21, 2026 9:14 PM, Tom Tromey wrote: > >>>>> Tankut Baris Aktemur <[email protected]> writes: > > > Convert the instance flags of a type to a struct with bitfields. This > > helps avoid bitwise operations and instead refer to the fields by > > name. In particular, Harvard address space information (i.e. code > > space and data space) and address class information become enum values > > instead of being handled by seemingly independent bits. > > Thanks. > > I like this direction. I have a couple minor questions. > > > + type_instance_flags &operator|= (const type_instance_flags &other) > > + { > ... > > + harvard_aspace > > + = static_cast<harvard_address_space> (harvard_aspace > > + | other.harvard_aspace); > > + address_class = address_class | other.address_class; > > These two assignments in particular don't really make sense to me. > Perhaps they should assert that the relevant member of 'this' is 0? I agree. I updated the patch accordingly. Thanks for catching this. > > @@ -1593,7 +1616,7 @@ struct type > > instance flags are completely inherited from the target type. No > > qualifiers can be cleared by the typedef. See also > > check_typedef. */ > > - unsigned m_instance_flags : 9; > > + type_instance_flags m_instance_flags; > > I would guess this increases the size of 'struct type'. > I don't think it's a big deal, but I'm curious about it. Checking with sizeof, both before and after the change, the size of a type object is 56. -Baris