Split CP up into components that can be called individually

Fixed some library dependency bugs.  JEOD test sims compile now.

refs #86
This commit is contained in:
Alex Lin
2015-07-21 08:52:00 -05:00
parent dfa961808b
commit d7b386227a
6 changed files with 55 additions and 14 deletions

View File

@ -357,6 +357,36 @@ void PrintAttributes::closeMapFiles() {
}
}
void PrintAttributes::addEmptyFiles() {
// Make a list of the empty files we processed.
// This list is written to the ICG_processed file and used by other processors.
clang::SourceManager::fileinfo_iterator fi ;
for ( fi = ci.getSourceManager().fileinfo_begin() ; fi != ci.getSourceManager().fileinfo_end() ; fi++ ) {
const clang::FileEntry * fe = (*fi).first ;
std::string header_file_name = fe->getName() ;
if ( visited_files.find(header_file_name) == visited_files.end() ) {
visited_files.insert(header_file_name) ;
// several tests require the real path of the header file.
char * rp = almostRealPath(header_file_name.c_str()) ;
if ( rp != NULL ) {
// Only include user directories (not system dirs like /usr/include)
if ( hsd.isPathInUserDir(rp) ) {
// Don't process files in excluded directories
if ( hsd.isPathInICGExclude(rp) == false ) {
// Only include files that do not have ICG: (No)
// hasICGNo uses original header name, not the real path
if ( ! cs.hasICGNo(header_file_name) ) {
std::string io_file_name = createIOFileName(std::string(rp)) ;
empty_header_files.insert(rp) ;
}
}
}
free(rp) ;
}
}
}
}
//TODO: Move this into PrintFileContents10.
void PrintAttributes::printIOMakefile() {
std::ofstream makefile_io_src ;
@ -447,6 +477,12 @@ void PrintAttributes::printIOMakefile() {
link_io_objs << (*mit).second.substr(0,found) << ".o" << std::endl ;
ICG_processed << (*mit).first << std::endl ;
}
// Create the list of empty (of classes/enums) header files to be written to ICG_processed.
addEmptyFiles() ;
std::set< std::string >::iterator sit ;
for ( sit = empty_header_files.begin() ; sit != empty_header_files.end() ; sit++ ) {
ICG_processed << (*sit) << std::endl ;
}
makefile_ICG << std::endl << std::endl ;
makefile_ICG.close() ;
link_io_objs << "build/class_map.o" << std::endl ;

View File

@ -98,6 +98,9 @@ class PrintAttributes {
bool isIOFileOutOfDate(std::string header_file_name, std::string io_file_name ) ;
bool doesIODirectoryExist(std::string io_file_name ) ;
/** Adds empty header files to list of processed files. */
void addEmptyFiles() ;
/** Determines the io_file_name based on the given header file name
@param header_file_name = full path to header file
@return string of full path to io_src file name.
@ -110,6 +113,9 @@ class PrintAttributes {
/** map of all io_files we processed */
std::map< std::string , std::string > all_io_files ;
/** map of all io_files we processed */
std::set< std::string > empty_header_files ;
/** map of open files to the out of date io_src file */
std::map< std::string , std::string > out_of_date_io_files ;