mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 21:27:54 +00:00
ICG exclude of class member variables now defines incorrect memory offsets in io_src #311
Missed some bitfield offset calculations.
This commit is contained in:
parent
ae07b26243
commit
00a0e8be44
@ -443,6 +443,14 @@ void FieldDescription::setBitFieldWidth(unsigned int len) {
|
||||
bitfield_width = len ;
|
||||
}
|
||||
|
||||
void FieldDescription::setBitFieldStart(unsigned int sb) {
|
||||
bitfield_start_bit = sb ;
|
||||
}
|
||||
|
||||
void FieldDescription::setBitFieldByteOffset(unsigned int wo) {
|
||||
bitfield_word_offset = wo ;
|
||||
}
|
||||
|
||||
unsigned int FieldDescription::getBitFieldWidth() {
|
||||
return bitfield_width ;
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ class FieldDescription : public ConstructValues {
|
||||
std::string getEnumString() ;
|
||||
void setBitField( bool yes_no ) ;
|
||||
void setBitFieldWidth( unsigned int len ) ;
|
||||
void setBitFieldStart( unsigned int len ) ;
|
||||
void setBitFieldByteOffset( unsigned int len ) ;
|
||||
unsigned int getBitFieldWidth() ;
|
||||
unsigned int getBitFieldStart() ;
|
||||
unsigned int getBitFieldByteOffset() ;
|
||||
|
@ -215,6 +215,9 @@ bool FieldVisitor::VisitFieldDecl( clang::FieldDecl *field ) {
|
||||
if ( field->isBitField()) {
|
||||
fdes->setBitField(true) ;
|
||||
fdes->setBitFieldWidth(field->getBitWidthValue(field->getASTContext())) ;
|
||||
unsigned int field_offset_bits = field->getASTContext().getFieldOffset(field) + fdes->getBaseClassOffset() * 8 ;
|
||||
fdes->setBitFieldStart( 32 - (field_offset_bits % 32) - fdes->getBitFieldWidth()) ;
|
||||
fdes->setBitFieldByteOffset((field_offset_bits / 32) * 4 ) ;
|
||||
}
|
||||
|
||||
if ( debug_level >= 3 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user