Skip to content

Commit 2b27328

Browse files
committed
Rename parameters and local variables "options" to "arguments"
This avoids shadowing the class member "options", which is also used in that file.
1 parent 8010419 commit 2b27328

File tree

2 files changed

+41
-43
lines changed

2 files changed

+41
-43
lines changed

src/goto-cc/ms_cl_cmdline.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,48 +47,46 @@ const char *non_ms_cl_options[]=
4747
nullptr
4848
};
4949

50-
bool ms_cl_cmdlinet::parse(const std::vector<std::string> &options)
50+
bool ms_cl_cmdlinet::parse(const std::vector<std::string> &arguments)
5151
{
52-
for(std::size_t i=0; i<options.size(); i++)
52+
for(std::size_t i = 0; i < arguments.size(); i++)
5353
{
5454
// is it a non-cl option?
55-
if(std::string(options[i], 0, 2)=="--")
55+
if(std::string(arguments[i], 0, 2) == "--")
5656
{
57-
process_non_cl_option(options[i]);
57+
process_non_cl_option(arguments[i]);
5858

59-
if(options[i]=="--verbosity" ||
60-
options[i]=="--function")
59+
if(arguments[i] == "--verbosity" || arguments[i] == "--function")
6160
{
62-
if(i<options.size()-1)
61+
if(i < arguments.size() - 1)
6362
{
64-
set(options[i], options[i+1]);
63+
set(arguments[i], arguments[i + 1]);
6564
i++; // skip ahead
6665
}
6766
}
6867
}
69-
else if(!options[i].empty() && options[i][0]=='@')
68+
else if(!arguments[i].empty() && arguments[i][0] == '@')
7069
{
7170
// potentially recursive
72-
process_response_file(
73-
std::string(options[i], 1, std::string::npos));
71+
process_response_file(std::string(arguments[i], 1, std::string::npos));
7472
}
75-
else if(options[i]=="/link" ||
76-
options[i]=="-link")
73+
else if(arguments[i] == "/link" || arguments[i] == "-link")
7774
{
7875
// anything that follows goes to the linker
79-
i=options.size()-1;
76+
i = arguments.size() - 1;
8077
}
81-
else if(options[i].size()==2 &&
82-
(options[i]=="/D" || options[i]=="-D") &&
83-
i!=options.size()-1)
78+
else if(
79+
arguments[i].size() == 2 &&
80+
(arguments[i] == "/D" || arguments[i] == "-D") &&
81+
i != arguments.size() - 1)
8482
{
8583
// this requires special treatment, as you can do "/D something"
86-
std::string tmp="/D"+options[i+1];
84+
std::string tmp = "/D" + arguments[i + 1];
8785
i++;
8886
process_cl_option(tmp);
8987
}
9088
else
91-
process_cl_option(options[i]);
89+
process_cl_option(arguments[i]);
9290
}
9391

9492
return false;
@@ -123,13 +121,13 @@ bool ms_cl_cmdlinet::parse(int argc, const char **argv)
123121
{
124122
// should really use "wide" argv from wmain()
125123

126-
std::vector<std::string> options;
124+
std::vector<std::string> arguments;
127125

128126
// skip argv[0]
129127
for(int i=1; i<argc; i++)
130-
options.push_back(argv[i]);
128+
arguments.push_back(argv[i]);
131129

132-
return parse(options);
130+
return parse(arguments);
133131
}
134132

135133
static std::istream &my_wgetline(std::istream &in, std::wstring &dest)
@@ -242,7 +240,7 @@ void ms_cl_cmdlinet::process_response_file_line(const std::string &line)
242240
if(line[0]=='#')
243241
return; // comment
244242

245-
std::vector<std::string> options;
243+
std::vector<std::string> arguments;
246244
std::string option;
247245
bool in_quotes=false;
248246
for(std::size_t i=0; i<line.size(); i++)
@@ -252,7 +250,7 @@ void ms_cl_cmdlinet::process_response_file_line(const std::string &line)
252250
if(ch==' ' && !in_quotes)
253251
{
254252
if(!option.empty())
255-
options.push_back(option);
253+
arguments.push_back(option);
256254
option.clear();
257255
}
258256
else if(ch=='"')
@@ -264,9 +262,9 @@ void ms_cl_cmdlinet::process_response_file_line(const std::string &line)
264262
}
265263

266264
if(!option.empty())
267-
options.push_back(option);
265+
arguments.push_back(option);
268266

269-
parse(options);
267+
parse(arguments);
270268
}
271269

272270
/// \return none

src/goto-cc/ms_link_cmdline.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,31 @@ const char *non_ms_link_options[]=
2828
"--verbosity"
2929
};
3030

31-
bool ms_link_cmdlinet::parse(const std::vector<std::string> &options)
31+
bool ms_link_cmdlinet::parse(const std::vector<std::string> &arguments)
3232
{
33-
for(std::size_t i = 0; i < options.size(); i++)
33+
for(std::size_t i = 0; i < arguments.size(); i++)
3434
{
3535
// is it a non-link option?
36-
if(std::string(options[i], 0, 2) == "--")
36+
if(std::string(arguments[i], 0, 2) == "--")
3737
{
38-
process_non_link_option(options[i]);
38+
process_non_link_option(arguments[i]);
3939

40-
if(options[i] == "--verbosity")
40+
if(arguments[i] == "--verbosity")
4141
{
42-
if(i < options.size() - 1)
42+
if(i < arguments.size() - 1)
4343
{
44-
set(options[i], options[i + 1]);
44+
set(arguments[i], arguments[i + 1]);
4545
i++; // skip ahead
4646
}
4747
}
4848
}
49-
else if(!options[i].empty() && options[i][0] == '@')
49+
else if(!arguments[i].empty() && arguments[i][0] == '@')
5050
{
5151
// potentially recursive
52-
process_response_file(std::string(options[i], 1, std::string::npos));
52+
process_response_file(std::string(arguments[i], 1, std::string::npos));
5353
}
5454
else
55-
process_link_option(options[i]);
55+
process_link_option(arguments[i]);
5656
}
5757

5858
return false;
@@ -65,13 +65,13 @@ bool ms_link_cmdlinet::parse(int argc, const char **argv)
6565
{
6666
// should really use "wide" argv from wmain()
6767

68-
std::vector<std::string> options;
68+
std::vector<std::string> arguments;
6969

7070
// skip argv[0]
7171
for(int i = 1; i < argc; i++)
72-
options.push_back(argv[i]);
72+
arguments.push_back(argv[i]);
7373

74-
return parse(options);
74+
return parse(arguments);
7575
}
7676

7777
static std::istream &my_wgetline(std::istream &in, std::wstring &dest)
@@ -182,7 +182,7 @@ void ms_link_cmdlinet::process_response_file_line(const std::string &line)
182182
if(line[0] == '#')
183183
return; // comment
184184

185-
std::vector<std::string> options;
185+
std::vector<std::string> arguments;
186186
std::string option;
187187
bool in_quotes = false;
188188
for(std::size_t i = 0; i < line.size(); i++)
@@ -192,7 +192,7 @@ void ms_link_cmdlinet::process_response_file_line(const std::string &line)
192192
if(ch == ' ' && !in_quotes)
193193
{
194194
if(!option.empty())
195-
options.push_back(option);
195+
arguments.push_back(option);
196196
option.clear();
197197
}
198198
else if(ch == '"')
@@ -204,9 +204,9 @@ void ms_link_cmdlinet::process_response_file_line(const std::string &line)
204204
}
205205

206206
if(!option.empty())
207-
options.push_back(option);
207+
arguments.push_back(option);
208208

209-
parse(options);
209+
parse(arguments);
210210
}
211211

212212
/// \return none

0 commit comments

Comments
 (0)