mirror of
https://github.com/nasa/trick.git
synced 2025-06-14 05:08:22 +00:00
ICG exclude of class member variables now defines incorrect memory offsets in io_src #311
Added back the code that set the offset of variables with the offsetof function. This code is running by default. Any code that includes #ifndef TRICK_ICG in classes/structures will want this on. Added a flag to ICG that allows us to turn off writing of these lines. If the flag is present, ICG may write out io_src code for private/protected variables that it could not reach if an offsetof function was required. Code cannot have any #ifndef TRICK_ICG present in classes/structures for this to work.
This commit is contained in:
@ -38,7 +38,8 @@ void ClassValues::addFieldDescription(FieldDescription * in_fdes) {
|
||||
field_name_to_info_map[in_fdes->getName()] = in_fdes ;
|
||||
}
|
||||
|
||||
void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *> in_fdes, unsigned int class_offset ) {
|
||||
void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *> in_fdes,
|
||||
unsigned int class_offset, bool virtual_inherited ) {
|
||||
// Make a copy of all of the FieldDescription variables.
|
||||
field_descripts.insert(field_descripts.end(), in_fdes.begin() , in_fdes.end()) ;
|
||||
|
||||
@ -46,7 +47,9 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
||||
// Loop through the incoming inherited variable names
|
||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; fdit++ ) {
|
||||
|
||||
(*fdit)->setBaseClassOffset( class_offset ) ;
|
||||
(*fdit)->setInherited( true ) ;
|
||||
(*fdit)->setVirtualInherited( virtual_inherited ) ;
|
||||
// Adds the class offset to the field offset giving the total offset to the inherited variable
|
||||
// The offset is stored in bits so multiply class_offset by 8.
|
||||
(*fdit)->addOffset( class_offset * 8 ) ;
|
||||
|
Reference in New Issue
Block a user