cprover
compile.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Compile and link source and object files.
4 
5 Author: CM Wintersteiger
6 
7 Date: June 2006
8 
9 \*******************************************************************/
10 
13 
14 #ifndef CPROVER_GOTO_CC_COMPILE_H
15 #define CPROVER_GOTO_CC_COMPILE_H
16 
17 #include <util/symbol.h>
18 #include <util/rename_symbol.h>
19 
20 #include <langapi/language_ui.h>
22 
23 class compilet:public language_uit
24 {
25 public:
29  std::string working_directory;
30  std::string override_language;
31 
32  enum { PREPROCESS_ONLY, // gcc -E
33  COMPILE_ONLY, // gcc -c
34  ASSEMBLE_ONLY, // gcc -S
35  LINK_LIBRARY, // ld -r
36  COMPILE_LINK, // gcc -shared
38  } mode;
39 
40  std::list<std::string> library_paths;
41  std::list<std::string> source_files;
42  std::list<std::string> object_files;
43  std::list<std::string> libraries;
44  std::list<std::string> tmp_dirs;
45  std::list<irep_idt> seen_modes;
46 
47  std::string object_file_extension;
49 
50  compilet(cmdlinet &_cmdline, ui_message_handlert &mh, bool Werror);
51 
52  ~compilet();
53 
54  bool add_input_file(const std::string &);
55  bool find_library(const std::string &);
56  bool is_elf_file(const std::string &);
57 
58  bool parse(const std::string &filename);
59  bool parse_stdin();
60  bool doit();
61  bool compile();
62  bool link();
63 
64  bool parse_source(const std::string &);
65 
66  bool write_object_file(
67  const std::string &,
68  const symbol_tablet &,
69  goto_functionst &);
71  const std::string &,
72  const symbol_tablet &,
73  goto_functionst &);
74 
75 protected:
78 
79  unsigned function_body_count(const goto_functionst &);
80 
81  void add_compiler_specific_defines(class configt &config) const;
82 
83  void convert_symbols(goto_functionst &dest);
84 };
85 
86 #endif // CPROVER_GOTO_CC_COMPILE_H
bool add_input_file(const std::string &)
puts input file names into a list and does preprocessing for libraries.
Definition: compile.cpp:140
std::string output_file_executable
Definition: compile.h:48
compilet(cmdlinet &_cmdline, ui_message_handlert &mh, bool Werror)
constructor
Definition: compile.cpp:646
Globally accessible architectural configuration.
Definition: config.h:24
virtual bool parse()
Definition: language_ui.cpp:37
Symbol table entry.
std::list< std::string > tmp_dirs
Definition: compile.h:44
cmdlinet & cmdline
Definition: compile.h:76
Goto Programs with Functions.
std::list< std::string > libraries
Definition: compile.h:43
enum compilet::@2 mode
std::list< std::string > library_paths
Definition: compile.h:40
unsigned function_body_count(const goto_functionst &)
Definition: compile.cpp:669
const cmdlinet & _cmdline
Definition: language_ui.h:53
bool doit()
reads and source and object files, compiles and links them into goto program objects.
Definition: compile.cpp:74
bool find_library(const std::string &)
tries to find a library object file that matches the given library name.
Definition: compile.cpp:282
configt config
Definition: config.cpp:21
bool write_bin_object_file(const std::string &, const symbol_tablet &, goto_functionst &)
writes the goto functions in the function table to a binary format object file.
Definition: compile.cpp:591
bool parse_stdin()
parses a source file (low-level parsing)
Definition: compile.cpp:534
bool compile()
parses source files and writes object files, or keeps the symbols in the symbol_table depending on th...
Definition: compile.cpp:388
bool warning_is_fatal
Definition: compile.h:77
bool parse_source(const std::string &)
parses a source file
Definition: compile.cpp:626
goto_functionst compiled_functions
Definition: compile.h:27
The symbol table.
Definition: symbol_table.h:52
TO_BE_DOCUMENTED.
Definition: namespace.h:62
namespacet ns
Definition: compile.h:26
bool echo_file_name
Definition: compile.h:28
std::string working_directory
Definition: compile.h:29
bool write_object_file(const std::string &, const symbol_tablet &, goto_functionst &)
writes the goto functions in the function table to a binary format object file.
Definition: compile.cpp:579
bool is_elf_file(const std::string &)
checking if we can load an object file
Definition: compile.cpp:322
void convert_symbols(goto_functionst &dest)
Definition: compile.cpp:688
std::string object_file_extension
Definition: compile.h:47
std::list< std::string > source_files
Definition: compile.h:41
std::list< std::string > object_files
Definition: compile.h:42
bool link()
parses object files and links them
Definition: compile.cpp:342
void add_compiler_specific_defines(class configt &config) const
Definition: compile.cpp:683
std::string override_language
Definition: compile.h:30
std::string output_file_object
Definition: compile.h:48
~compilet()
cleans up temporary files
Definition: compile.cpp:659
std::list< irep_idt > seen_modes
Definition: compile.h:45