diff --git a/trick_source/codegen/Interface_Code_Gen/FieldDescription.cpp b/trick_source/codegen/Interface_Code_Gen/FieldDescription.cpp index 8505c393..f1519ff2 100644 --- a/trick_source/codegen/Interface_Code_Gen/FieldDescription.cpp +++ b/trick_source/codegen/Interface_Code_Gen/FieldDescription.cpp @@ -57,6 +57,7 @@ FieldDescription::FieldDescription( is_stl(0) , has_stl_clear(1) , is_static(0) , + is_reference(0) , num_dims(0) , array_sizes() {} ; @@ -543,6 +544,14 @@ bool FieldDescription::isStatic() { return is_static ; } +void FieldDescription::setReference(bool yes_no) { + is_reference = yes_no ; +} + +bool FieldDescription::isReference() { + return is_reference ; +} + unsigned int FieldDescription::getNumDims() { return num_dims ; } diff --git a/trick_source/codegen/Interface_Code_Gen/FieldDescription.hh b/trick_source/codegen/Interface_Code_Gen/FieldDescription.hh index dff5fe86..28e2a745 100644 --- a/trick_source/codegen/Interface_Code_Gen/FieldDescription.hh +++ b/trick_source/codegen/Interface_Code_Gen/FieldDescription.hh @@ -87,6 +87,8 @@ class FieldDescription : public ConstructValues { bool hasSTLClear() ; void setStatic( bool yes_no ) ; bool isStatic() ; + void setReference( bool yes_no ) ; + bool isReference() ; void setInherited( bool yes_no ) ; bool isInherited() ; void setVirtualInherited( bool yes_no ) ; @@ -184,6 +186,9 @@ class FieldDescription : public ConstructValues { /** is this field declared static */ bool is_static ; + /** is this field a reference type */ + bool is_reference ; + /** map of strings to io numbers. One copy for all fields */ static std::map io_map ; diff --git a/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp b/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp index 8c46bb1f..79bf2af8 100644 --- a/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp +++ b/trick_source/codegen/Interface_Code_Gen/FieldVisitor.cpp @@ -43,12 +43,12 @@ bool FieldVisitor::VisitType(clang::Type *t) { std::cout << "FieldVisitor VisitType Type = " << t->getTypeClassName() << std::endl ; t->dump() ; } - // If this type is a reference, set IO to 0 if ( t->isReferenceType() ) { 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; } diff --git a/trick_source/codegen/Interface_Code_Gen/PrintFileContents10.cpp b/trick_source/codegen/Interface_Code_Gen/PrintFileContents10.cpp index 4ba5d12a..533a16f7 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintFileContents10.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintFileContents10.cpp @@ -76,7 +76,7 @@ void PrintFileContents10::print_field_attr(std::ostream & ostream , FieldDescri ostream << ", sizeof(" << fdes.getTypeName() << ")" ; } 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() ) { // For bitfields we need the offset to start on 4 byte boundaries because that is what our // insert and extract bitfield routines work with.