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

@ -305,6 +305,9 @@ bool HeaderSearchDirs::isPathInCompat15 (const std::string& in_dir ) {
return true ;
}
}
if ( trick_icg_present.find(in_dir) != trick_icg_present.end() ) {
return true ;
}
return false ;
}
@ -363,3 +366,11 @@ void HeaderSearchDirs::addDefines ( std::vector<std::string> & defines ) {
pp.setPredefines(pp.getPredefines() + "\n" + predefines) ;
}
void HeaderSearchDirs::addTrickICGFoundFile ( std::string file_name ) {
char * rp = almostRealPath(file_name.c_str()) ;
if ( rp != NULL ) {
trick_icg_present.insert(rp) ;
free(rp) ;
}
}