2015-02-26 15:02:31 +00:00
|
|
|
|
2015-03-23 21:03:14 +00:00
|
|
|
#ifndef PRINTATTRIBUTES_HH
|
|
|
|
#define PRINTATTRIBUTES_HH
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
2017-03-15 20:53:56 +00:00
|
|
|
#include "Utilities.hh"
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
class CompilerInstance ;
|
|
|
|
}
|
|
|
|
|
2017-03-15 20:53:56 +00:00
|
|
|
class ConstructValues ;
|
2015-02-26 15:02:31 +00:00
|
|
|
class ClassValues ;
|
|
|
|
class EnumValues ;
|
|
|
|
class PrintFileContentsBase ;
|
|
|
|
class HeaderSearchDirs ;
|
|
|
|
class CommentSaver ;
|
|
|
|
class PrintFileContentsBase ;
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This class creates a PrintFileContentsBase class for each include file that we
|
|
|
|
have parsed. It then adds all of the classes and enums into PrintFileContentBase
|
|
|
|
classes keyed by the files they were found.
|
|
|
|
|
|
|
|
@author Alexander S. Lin
|
|
|
|
|
|
|
|
@date July 2012
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
class PrintAttributes {
|
|
|
|
public:
|
|
|
|
PrintAttributes( int attr_version , HeaderSearchDirs & hsd , CommentSaver & cs ,
|
2015-06-24 22:49:14 +00:00
|
|
|
clang::CompilerInstance & in_ci, bool force , bool sim_services, std::string output_dir ) ;
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
/** Prints all of the processed classes and enumerations */
|
|
|
|
virtual void createMapFiles() ;
|
|
|
|
virtual void closeMapFiles() ;
|
|
|
|
|
2015-07-02 15:09:31 +00:00
|
|
|
/** Create makefile for IO files */
|
|
|
|
virtual void printIOMakefile() ;
|
|
|
|
|
2015-02-26 15:02:31 +00:00
|
|
|
/** Prints list of files that contain ICG:(No) in the Trick header */
|
|
|
|
virtual void printICGNoFiles() ;
|
|
|
|
|
|
|
|
/** Prints a class to the io_src file */
|
|
|
|
virtual void printClass( ClassValues * in_class) ;
|
|
|
|
|
|
|
|
/** Prints an enum to the io_src file */
|
|
|
|
virtual void printEnum( EnumValues * in_enum) ;
|
|
|
|
|
2017-05-24 14:57:07 +00:00
|
|
|
bool isHeaderExcluded(const std::string& header, bool exclude_ext_libs = true);
|
2017-03-15 20:53:56 +00:00
|
|
|
void markHeaderAsVisited(const std::string& header);
|
|
|
|
|
2015-02-26 15:02:31 +00:00
|
|
|
protected:
|
|
|
|
|
2017-03-15 20:53:56 +00:00
|
|
|
const bool verboseBuild = getenv("TRICK_VERBOSE_BUILD");
|
2017-03-27 20:19:43 +00:00
|
|
|
const std::string skipping = color(SKIP, "ICG Skip ");
|
2017-03-15 20:53:56 +00:00
|
|
|
|
2015-02-26 15:02:31 +00:00
|
|
|
/** Directory to put class and enum map files */
|
|
|
|
std::string map_dir ;
|
|
|
|
|
|
|
|
/** Output stream to be used to print individual io_src files */
|
|
|
|
std::ofstream outfile ;
|
|
|
|
|
|
|
|
/** Output stream to be used for class_map */
|
|
|
|
std::ofstream class_map_outfile ;
|
|
|
|
|
|
|
|
/** Output stream to be used for enum_map */
|
|
|
|
std::ofstream enum_map_outfile ;
|
|
|
|
|
|
|
|
/** The header search directories */
|
|
|
|
HeaderSearchDirs & hsd ;
|
|
|
|
|
|
|
|
/** Comments for all of the header files */
|
|
|
|
CommentSaver & cs ;
|
|
|
|
|
|
|
|
/** Compiler instance */
|
|
|
|
clang::CompilerInstance & ci ;
|
|
|
|
|
|
|
|
/** Version specific attributes printer */
|
|
|
|
PrintFileContentsBase * printer ;
|
|
|
|
|
|
|
|
/** Force all io_src files to be written */
|
|
|
|
bool force ;
|
|
|
|
|
|
|
|
/** We are processing sim_services */
|
|
|
|
bool sim_services_flag ;
|
|
|
|
|
2015-06-24 22:49:14 +00:00
|
|
|
/** We are specifying an output directory for all files */
|
|
|
|
std::string output_dir ;
|
|
|
|
|
2016-10-06 18:54:06 +00:00
|
|
|
bool openIOFile(const std::string& header_file_name) ;
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
bool isFileIncluded(std::string header_file_name) ;
|
|
|
|
bool isIOFileOutOfDate(std::string header_file_name, std::string io_file_name ) ;
|
2017-03-15 20:53:56 +00:00
|
|
|
bool hasBeenProcessed(EnumValues& enumValues);
|
|
|
|
bool hasBeenProcessed(ClassValues& classValues);
|
|
|
|
bool hasBeenProcessed(const std::string& name, std::set<std::string>& processedSet);
|
|
|
|
bool isIgnored(ConstructValues& constructValues);
|
2015-02-26 15:02:31 +00:00
|
|
|
|
2017-03-15 20:53:56 +00:00
|
|
|
std::set<std::string> getEmptyFiles();
|
2015-07-21 13:52:00 +00:00
|
|
|
|
2015-02-26 15:02:31 +00:00
|
|
|
/** 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.
|
|
|
|
*/
|
|
|
|
std::string createIOFileName(std::string header_file_name) ;
|
|
|
|
|
|
|
|
/** set of all visited files */
|
|
|
|
std::set< std::string > visited_files ;
|
|
|
|
|
2015-07-02 15:09:31 +00:00
|
|
|
/** map of all io_files we processed */
|
|
|
|
std::map< std::string , std::string > all_io_files ;
|
|
|
|
|
2015-07-22 15:54:00 +00:00
|
|
|
/** set of external library header files */
|
|
|
|
std::set< std::string > ext_lib_io_files ;
|
|
|
|
|
2015-07-02 15:09:31 +00:00
|
|
|
/** map of open files to the out of date io_src file */
|
|
|
|
std::map< std::string , std::string > out_of_date_io_files ;
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
/** List of files that have ICG: No */
|
|
|
|
std::vector< std::string > icg_no_files ;
|
|
|
|
|
|
|
|
/** map of ignored types sorted by file */
|
|
|
|
std::map< std::string , std::set< std::string > > ignored_types ;
|
|
|
|
/** map of processed classes sorted by file */
|
|
|
|
std::map< std::string , std::set< std::string > > processed_classes ;
|
|
|
|
/** map of processed enums sorted by file */
|
|
|
|
std::map< std::string , std::set< std::string > > processed_enums ;
|
|
|
|
|
|
|
|
} ;
|
|
|
|
|
|
|
|
#endif
|