mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +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 ;
|
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() {
|
unsigned int FieldDescription::getBitFieldWidth() {
|
||||||
return bitfield_width ;
|
return bitfield_width ;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,8 @@ class FieldDescription : public ConstructValues {
|
|||||||
std::string getEnumString() ;
|
std::string getEnumString() ;
|
||||||
void setBitField( bool yes_no ) ;
|
void setBitField( bool yes_no ) ;
|
||||||
void setBitFieldWidth( unsigned int len ) ;
|
void setBitFieldWidth( unsigned int len ) ;
|
||||||
|
void setBitFieldStart( unsigned int len ) ;
|
||||||
|
void setBitFieldByteOffset( unsigned int len ) ;
|
||||||
unsigned int getBitFieldWidth() ;
|
unsigned int getBitFieldWidth() ;
|
||||||
unsigned int getBitFieldStart() ;
|
unsigned int getBitFieldStart() ;
|
||||||
unsigned int getBitFieldByteOffset() ;
|
unsigned int getBitFieldByteOffset() ;
|
||||||
|
@ -215,6 +215,9 @@ bool FieldVisitor::VisitFieldDecl( clang::FieldDecl *field ) {
|
|||||||
if ( field->isBitField()) {
|
if ( field->isBitField()) {
|
||||||
fdes->setBitField(true) ;
|
fdes->setBitField(true) ;
|
||||||
fdes->setBitFieldWidth(field->getBitWidthValue(field->getASTContext())) ;
|
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 ) {
|
if ( debug_level >= 3 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user