mirror of
https://github.com/nasa/trick.git
synced 2025-06-19 07:38:26 +00:00
ICG creates offsetof statements that will not compile when using clang #327
Added a check that was in 15 that tested the platform we are running on. If we are on an mac, we want to skip fully qualifying variable names because it creates code that doesn't compile under clang.
This commit is contained in:
@ -2,9 +2,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
#include "ClassValues.hh"
|
#include "ClassValues.hh"
|
||||||
#include "FieldDescription.hh"
|
#include "FieldDescription.hh"
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
extern llvm::cl::opt< bool > no_offset_of ;
|
||||||
|
#endif
|
||||||
|
|
||||||
ClassValues::ClassValues() :
|
ClassValues::ClassValues() :
|
||||||
has_init_attr_friend(false) ,
|
has_init_attr_friend(false) ,
|
||||||
is_pod(false) ,
|
is_pod(false) ,
|
||||||
@ -23,6 +29,11 @@ ClassValues::~ClassValues() {
|
|||||||
void ClassValues::addFieldDescription(FieldDescription * in_fdes) {
|
void ClassValues::addFieldDescription(FieldDescription * in_fdes) {
|
||||||
field_descripts.push_back(in_fdes) ;
|
field_descripts.push_back(in_fdes) ;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if ( no_offset_of ) {
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
// Test to see if the new field overloads a field of the same name. If it does
|
// Test to see if the new field overloads a field of the same name. If it does
|
||||||
// then fully qualify the name of the inherited field (the one already in field_name_to_info).
|
// then fully qualify the name of the inherited field (the one already in field_name_to_info).
|
||||||
std::map< std::string , FieldDescription * >::iterator mit = field_name_to_info_map.find(in_fdes->getName()) ;
|
std::map< std::string , FieldDescription * >::iterator mit = field_name_to_info_map.find(in_fdes->getName()) ;
|
||||||
@ -34,7 +45,7 @@ void ClassValues::addFieldDescription(FieldDescription * in_fdes) {
|
|||||||
field_name_to_info_map.erase(mit) ;
|
field_name_to_info_map.erase(mit) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
field_name_to_info_map[in_fdes->getName()] = in_fdes ;
|
field_name_to_info_map[in_fdes->getName()] = in_fdes ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +56,11 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
|||||||
|
|
||||||
std::vector<FieldDescription *>::iterator fdit ;
|
std::vector<FieldDescription *>::iterator fdit ;
|
||||||
// Loop through the incoming inherited variable names
|
// Loop through the incoming inherited variable names
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if ( no_offset_of ) {
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; fdit++ ) {
|
for ( fdit = in_fdes.begin() ; fdit != in_fdes.end() ; fdit++ ) {
|
||||||
|
|
||||||
(*fdit)->setBaseClassOffset( class_offset ) ;
|
(*fdit)->setBaseClassOffset( class_offset ) ;
|
||||||
@ -86,6 +102,7 @@ void ClassValues::addInheritedFieldDescriptions(std::vector<FieldDescription *>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user