Detect when TRICK_ICG is used in header files and compensate for it. #375

Created a hook for the clang preprocessor.  The hook does 2 things.  It
keeps track to which header files we have entered and exited.  Second it
searches for the use of TRICK_ICG.  If we find an instance of TRICK_ICG we
mark all of the included files from this point up the chain as requiring
compensation.  To compensate for using TRICK_ICG we write out the older
offset statements to get the location of variables in classes/structures.
This commit is contained in:
Alex Lin
2017-01-11 15:02:21 -06:00
parent 0140b0b966
commit ba47c2048c
6 changed files with 190 additions and 21 deletions

View File

@ -201,27 +201,6 @@ void PrintFileContents10::print_init_attr_func( std::ostream & ostream , ClassVa
<< " }\n"
<< " initialized = 1;\n\n" ;
#if 0
if ( cv->getMangledTypeName() != cv->getName() ) {
ostream << " typedef " << cv->getName() << " " << cv->getMangledTypeName() << " ;\n\n" ;
}
if ( !global_compat15 and !cv->isCompat15()) {
ostream << " if ( sizeof(" ;
printNamespaces( ostream, cv , "::" ) ;
printContainerClasses( ostream, cv , "::" ) ;
ostream << cv->getName() << ") > " << cv->getSize() << ") {\n" ;
ostream << " Trick::ClassSizeCheck::class_size_check()->add_diff(\"" ;
printNamespaces( ostream, cv , "::" ) ;
printContainerClasses( ostream, cv , "::" ) ;
ostream << cv->getName() << "\" , Trick::ClassSizeDiffInfo((sizeof(" ;
printNamespaces( ostream, cv , "::" ) ;
printContainerClasses( ostream, cv , "::" ) ;
ostream << cv->getName() << ") - " << cv->getSize() << ") , \"" << cv->getFileName() << "\")) ;\n" ;
ostream << " }\n" ;
}
#endif
unsigned int ii = 0;
for ( auto field : cv->getFieldDescriptions() ) {
if ( determinePrintAttr(cv, field) ) {