From a2452aacd0bdb065e569fa06345f3a8aa45fe551 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Fri, 21 Oct 2016 10:04:07 -0500 Subject: [PATCH] ICG creates offsetof statements that will not compile when using clang #327 When copying inherited variables to a child class in ICG, the inherited flags were not being set on the mac. --- .../codegen/Interface_Code_Gen/ClassValues.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/trick_source/codegen/Interface_Code_Gen/ClassValues.cpp b/trick_source/codegen/Interface_Code_Gen/ClassValues.cpp index c62e453f..55f73eb8 100644 --- a/trick_source/codegen/Interface_Code_Gen/ClassValues.cpp +++ b/trick_source/codegen/Interface_Code_Gen/ClassValues.cpp @@ -57,6 +57,16 @@ void ClassValues::addInheritedFieldDescriptions(std::vector std::vector::iterator fdit ; // 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 ) ; + } + #ifdef __APPLE__ if ( !global_compat15 and !compat15 ) { #else @@ -64,13 +74,6 @@ void ClassValues::addInheritedFieldDescriptions(std::vector #endif 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 ) ; - std::string in_name = (*fdit)->getName() ; // search existing names for incoming inherited variable name. std::map< std::string , FieldDescription * >::iterator mit = field_name_to_info_map.find(in_name) ;