cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
ms_link_mode.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Visual Studio Link Mode
4
5
Author: Daniel Kroening
6
7
\*******************************************************************/
8
11
12
#include "
ms_link_mode.h
"
13
14
#include <iostream>
15
16
#include <
util/config.h
>
17
#include <
util/get_base_name.h
>
18
19
#include "
compile.h
"
20
#include "
goto_cc_cmdline.h
"
21
22
ms_link_modet::ms_link_modet
(
goto_cc_cmdlinet
&_cmdline)
23
:
goto_cc_modet
(_cmdline,
"link"
,
message_handler
)
24
{
25
}
26
28
int
ms_link_modet::doit
()
29
{
30
if
(
cmdline
.isset(
"help"
))
31
{
32
help
();
33
return
0;
34
}
35
36
messaget::eval_verbosity
(
37
cmdline
.get_value(
"verbosity"
),
messaget::M_ERROR
,
message_handler
);
38
message_handler
.print_warnings_as_errors(
cmdline
.isset(
"WX"
));
39
40
compilet
compiler(
cmdline
,
message_handler
,
cmdline
.isset(
"WX"
));
41
42
// determine actions to be undertaken
43
compiler.
mode
=
compilet::LINK_LIBRARY
;
44
45
// get configuration
46
config
.set(
cmdline
);
47
48
compiler.
object_file_extension
=
"obj"
;
49
50
if
(
cmdline
.isset(
"LIBPATH"
))
51
compiler.
library_paths
=
cmdline
.get_values(
"LIBPATH"
);
52
// Don't add the system paths!
53
54
if
(
cmdline
.isset(
"OUT"
))
55
{
56
// This must be a file, not a directory.
57
// If the option is given multiple times, the last instance wins.
58
const
auto
&values =
cmdline
.get_values(
"OUT"
);
59
if
(!values.empty())
60
compiler.
output_file_executable
= values.back();
61
}
62
else
63
{
64
// The first input file is used to determine the default
65
// name of the executable.
66
if
(!
cmdline
.args.empty())
67
compiler.
output_file_executable
=
get_base_name
(
cmdline
.args[0],
true
)+
".exe"
;
68
}
69
70
// We now iterate over any input files
71
72
for
(
const
auto
&arg :
cmdline
.parsed_argv)
73
if
(arg.is_infile_name)
74
compiler.
add_input_file
(arg.arg);
75
76
// do all the rest
77
if
(compiler.
doit
())
78
return
1;
79
80
return
0;
81
}
82
84
void
ms_link_modet::help_mode
()
85
{
86
std::cout <<
"goto-link understands the options of "
87
<<
"link plus the following.\n\n"
;
88
}
config
configt config
Definition
config.cpp:25
compilet
Definition
compile.h:32
compilet::LINK_LIBRARY
@ LINK_LIBRARY
Definition
compile.h:41
compilet::add_input_file
bool add_input_file(const std::string &)
puts input file names into a list and does preprocessing for libraries.
Definition
compile.cpp:167
compilet::doit
bool doit()
reads and source and object files, compiles and links them into goto program objects.
Definition
compile.cpp:54
compilet::object_file_extension
std::string object_file_extension
Definition
compile.h:51
compilet::mode
enum compilet::@010007010156070135133373264143331307343141370152 mode
compilet::library_paths
std::list< std::string > library_paths
Definition
compile.h:46
compilet::output_file_executable
std::string output_file_executable
Definition
compile.h:52
goto_cc_cmdlinet
Definition
goto_cc_cmdline.h:20
goto_cc_modet::goto_cc_modet
goto_cc_modet(goto_cc_cmdlinet &, const std::string &_base_name, message_handlert &)
constructor
Definition
goto_cc_mode.cpp:33
goto_cc_modet::cmdline
goto_cc_cmdlinet & cmdline
Definition
goto_cc_mode.h:38
goto_cc_modet::help
void help()
display command line help
Definition
goto_cc_mode.cpp:48
messaget::eval_verbosity
static unsigned eval_verbosity(const std::string &user_input, const message_levelt default_verbosity, message_handlert &dest)
Parse a (user-)provided string as a verbosity level and set it as the verbosity of dest.
Definition
message.cpp:105
messaget::M_ERROR
@ M_ERROR
Definition
message.h:169
ms_link_modet::ms_link_modet
ms_link_modet(goto_cc_cmdlinet &)
Definition
ms_link_mode.cpp:22
ms_link_modet::message_handler
cl_message_handlert message_handler
Definition
ms_link_mode.h:29
ms_link_modet::doit
int doit() final
does it.
Definition
ms_link_mode.cpp:28
ms_link_modet::help_mode
void help_mode() final
display command line help
Definition
ms_link_mode.cpp:84
compile.h
Compile and link source and object files.
config.h
get_base_name
std::string get_base_name(const std::string &in, bool strip_suffix)
cleans a filename from path and extension
Definition
get_base_name.cpp:16
get_base_name.h
goto_cc_cmdline.h
Command line interpretation for goto-cc.
ms_link_mode.h
Visual Studio Link Mode.
goto-cc
ms_link_mode.cpp
Generated by
1.17.0