ROSE  0.11.83.1
Driver.h
1 
2 #ifndef Rose_CodeGen_Driver_h
3 #define Rose_CodeGen_Driver_h
4 
5 #include <set>
6 #include <map>
7 #include <string>
8 
9 #include <boost/filesystem.hpp>
10 
11 class SgProject;
12 class SgSourceFile;
13 class SgScopeStatement;
14 class SgSymbol;
15 class SgGlobal;
16 
17 namespace Rose { namespace CodeGen {
18 
22 class Driver {
23  public:
25 
26  private:
27  size_t file_id_counter;
28  std::map<boost::filesystem::path, size_t> path_to_id_map;
29  std::map<size_t, SgSourceFile *> id_to_file_map;
30  std::map<SgSourceFile *, size_t> file_to_id_map;
31  std::map<size_t, std::set<size_t> > file_id_to_accessible_file_id_map;
32 
33  void init(SgProject * project_);
34  size_t add(SgSourceFile * file);
35 
36  public:
37  Driver();
38  Driver(SgProject * project_);
39  Driver(std::vector<std::string> & args);
40 
42  size_t create(const boost::filesystem::path & path);
43  size_t add(const boost::filesystem::path & path);
44 
47  size_t getFileID(const boost::filesystem::path & path) const;
48  size_t getFileID(SgSourceFile * source_file) const;
49  size_t getFileID(SgScopeStatement * scope) const;
51 
53  SgGlobal * getGlobalScope(size_t file_id) const;
54 
56  void setUnparsedFile(size_t file_id) const;
57 
59  void setCompiledFile(size_t file_id) const;
60 
62  void addIncludeDirectives(size_t target_file_id, size_t header_file_id);
63 
65  void addExternalHeader(size_t file_id, std::string header_name, bool is_system_header = true);
66 
68  void addPragmaDecl(size_t file_id, std::string str);
69 };
70 
71 } }
72 
73 #endif /* Rose_CodeGen_Driver_h */
74 
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.).
void setUnparsedFile(size_t file_id) const
Set a file to be unparsed with the project (by default file added to the driver are NOT unparsed) ...
SgProject * project
the Rose project
Definition: Driver.h:24
void setCompiledFile(size_t file_id) const
Set a file to be compiled with the project (by default file added to the driver are NOT compiled) ...
Main namespace for the ROSE library.
facilitates the manipulation of source-files (esp.
Definition: Driver.h:22
This class represents the concept of a name within the compiler.
size_t getFileID(const boost::filesystem::path &path) const
Retrieve file-id of associated with a file.
This class represents the concept of a namespace definition.
void addIncludeDirectives(size_t target_file_id, size_t header_file_id)
Add include statement for header inside of target.
size_t create(const boost::filesystem::path &path)
Create a file ()
void addExternalHeader(size_t file_id, std::string header_name, bool is_system_header=true)
Import external header for a given file.
This class represents a source project, with a list of SgFile objects and global information about th...
SgGlobal * getGlobalScope(size_t file_id) const
Retrieve the global scope of a file from its file-id.
void addPragmaDecl(size_t file_id, std::string str)
Add a pragma at the begining of the file.