Mark references as such in ICG

This commit is contained in:
Derek Bankieris 2021-02-10 16:05:02 -06:00
parent c0791b46d9
commit 8e3726eb98
4 changed files with 18 additions and 4 deletions

View File

@ -57,6 +57,7 @@ FieldDescription::FieldDescription(
is_stl(0) , is_stl(0) ,
has_stl_clear(1) , has_stl_clear(1) ,
is_static(0) , is_static(0) ,
is_reference(0) ,
num_dims(0) , num_dims(0) ,
array_sizes() {} ; array_sizes() {} ;
@ -543,6 +544,14 @@ bool FieldDescription::isStatic() {
return is_static ; return is_static ;
} }
void FieldDescription::setReference(bool yes_no) {
is_reference = yes_no ;
}
bool FieldDescription::isReference() {
return is_reference ;
}
unsigned int FieldDescription::getNumDims() { unsigned int FieldDescription::getNumDims() {
return num_dims ; return num_dims ;
} }

View File

@ -87,6 +87,8 @@ class FieldDescription : public ConstructValues {
bool hasSTLClear() ; bool hasSTLClear() ;
void setStatic( bool yes_no ) ; void setStatic( bool yes_no ) ;
bool isStatic() ; bool isStatic() ;
void setReference( bool yes_no ) ;
bool isReference() ;
void setInherited( bool yes_no ) ; void setInherited( bool yes_no ) ;
bool isInherited() ; bool isInherited() ;
void setVirtualInherited( bool yes_no ) ; void setVirtualInherited( bool yes_no ) ;
@ -184,6 +186,9 @@ class FieldDescription : public ConstructValues {
/** is this field declared static */ /** is this field declared static */
bool is_static ; bool is_static ;
/** is this field a reference type */
bool is_reference ;
/** map of strings to io numbers. One copy for all fields */ /** map of strings to io numbers. One copy for all fields */
static std::map<std::string , unsigned int> io_map ; static std::map<std::string , unsigned int> io_map ;

View File

@ -43,12 +43,12 @@ bool FieldVisitor::VisitType(clang::Type *t) {
std::cout << "FieldVisitor VisitType Type = " << t->getTypeClassName() << std::endl ; std::cout << "FieldVisitor VisitType Type = " << t->getTypeClassName() << std::endl ;
t->dump() ; t->dump() ;
} }
// If this type is a reference, set IO to 0
if ( t->isReferenceType() ) { if ( t->isReferenceType() ) {
if ( debug_level >= 3 ) { if ( debug_level >= 3 ) {
std::cout << "FieldVisitor VisitType found reference, setIO = 0 " << std::endl ; std::cout << "FieldVisitor VisitType found reference, setIO = 3 " << std::endl ;
} }
fdes->setIO(0) ; fdes->setIO(3) ;
fdes->setReference(true) ;
} }
return true; return true;
} }

View File

@ -76,7 +76,7 @@ void PrintFileContents10::print_field_attr(std::ostream & ostream , FieldDescri
ostream << ", sizeof(" << fdes.getTypeName() << ")" ; ostream << ", sizeof(" << fdes.getTypeName() << ")" ;
} }
ostream << ", 0, 0, Language_CPP" ; // range_min, range_max, language ostream << ", 0, 0, Language_CPP" ; // range_min, range_max, language
ostream << ", " << (fdes.isStatic() << 1) + (fdes.isDashDashUnits() << 2) << "," << std::endl ; // mods ostream << ", " << fdes.isReference() + (fdes.isStatic() << 1) + (fdes.isDashDashUnits() << 2) << "," << std::endl ; // mods
if ( fdes.isBitField() ) { if ( fdes.isBitField() ) {
// For bitfields we need the offset to start on 4 byte boundaries because that is what our // For bitfields we need the offset to start on 4 byte boundaries because that is what our
// insert and extract bitfield routines work with. // insert and extract bitfield routines work with.