mirror of
https://github.com/nasa/trick.git
synced 2025-06-21 08:29:39 +00:00
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:
@ -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) ;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user