Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit fc3a969

Browse files
author
Sergey Andreenko
authored
Format spmi sources with clang-format (#11027)
Apply jit style format on spmi sources.
1 parent c06fb33 commit fc3a969

File tree

129 files changed

+9760
-10245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+9760
-10245
lines changed

src/ToolBox/superpmi/mcs/commandline.cpp

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,26 @@ void CommandLine::DumpHelp(const char* program)
134134
printf("Note: Inputs are case insensitive.\n");
135135
}
136136

137-
//Assumption: All inputs are initialized to default or real value. we'll just set the stuff in what we see on the command line.
138-
//Assumption: Single byte names are passed in.. mb stuff doesnt cause an obvious problem... but it might have issues...
139-
//Assumption: Values larger than 2^31 aren't expressible from the commandline.... (atoi) Unless you pass in negatives.. :-|
137+
// Assumption: All inputs are initialized to default or real value. we'll just set the stuff in what we see on the
138+
// command line. Assumption: Single byte names are passed in.. mb stuff doesnt cause an obvious problem... but it might
139+
// have issues... Assumption: Values larger than 2^31 aren't expressible from the commandline.... (atoi) Unless you pass
140+
// in negatives.. :-|
140141
bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
141142
{
142-
size_t argLen = 0;
143+
size_t argLen = 0;
143144
size_t tempLen = 0;
144145

145-
bool foundVerb = false;
146+
bool foundVerb = false;
146147
bool foundFile1 = false;
147148
bool foundFile2 = false;
148149

149-
if (argc == 1) //Print help when no args are passed
150+
if (argc == 1) // Print help when no args are passed
150151
{
151152
DumpHelp(argv[0]);
152153
return false;
153154
}
154155

155-
for (int i = 1; i<argc; i++)
156+
for (int i = 1; i < argc; i++)
156157
{
157158
bool isASwitch = (argv[i][0] == '-');
158159
#ifndef FEATURE_PAL
@@ -162,98 +163,97 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
162163
}
163164
#endif // !FEATURE_PAL
164165

165-
//Process a switch
166+
// Process a switch
166167
if (isASwitch)
167168
{
168169
argLen = strlen(argv[i]);
169170

170-
if (argLen >1)
171-
argLen--; //adjust for leading switch
171+
if (argLen > 1)
172+
argLen--; // adjust for leading switch
172173
else
173174
{
174175
DumpHelp(argv[0]);
175176
return false;
176177
}
177178

178-
if ((_strnicmp(&argv[i][1], "help", argLen) == 0) ||
179-
(_strnicmp(&argv[i][1], "?", argLen) == 0))
179+
if ((_strnicmp(&argv[i][1], "help", argLen) == 0) || (_strnicmp(&argv[i][1], "?", argLen) == 0))
180180
{
181181
DumpHelp(argv[0]);
182182
return false;
183183
}
184184
else if ((_strnicmp(&argv[i][1], "ASMDump", argLen) == 0))
185185
{
186-
tempLen = strlen(argv[i]);
187-
foundVerb = true;
186+
tempLen = strlen(argv[i]);
187+
foundVerb = true;
188188
o->actionASMDump = true;
189-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
189+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
190190
goto processMCL;
191191
}
192192
else if ((_strnicmp(&argv[i][1], "concat", argLen) == 0))
193193
{
194-
tempLen = strlen(argv[i]);
195-
foundVerb = true;
194+
tempLen = strlen(argv[i]);
195+
foundVerb = true;
196196
o->actionConcat = true;
197197
}
198198
else if ((_strnicmp(&argv[i][1], "copy", argLen) == 0))
199199
{
200-
tempLen = strlen(argv[i]);
201-
foundVerb = true;
200+
tempLen = strlen(argv[i]);
201+
foundVerb = true;
202202
o->actionCopy = true;
203-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
203+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
204204
goto processMCL;
205205
}
206206
else if ((_strnicmp(&argv[i][1], "dump", argLen) == 0))
207207
{
208-
tempLen = strlen(argv[i]);
209-
foundVerb = true;
208+
tempLen = strlen(argv[i]);
209+
foundVerb = true;
210210
o->actionDump = true;
211-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
211+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
212212
goto processMCL;
213213
}
214214
else if ((_strnicmp(&argv[i][1], "fracture", argLen) == 0))
215215
{
216-
tempLen = strlen(argv[i]);
217-
foundVerb = true;
216+
tempLen = strlen(argv[i]);
217+
foundVerb = true;
218218
o->actionFracture = true;
219-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
219+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
220220
goto processMCL;
221221
}
222222
else if ((_strnicmp(&argv[i][1], "dumpmap", argLen) == 0))
223223
{
224-
tempLen = strlen(argv[i]);
225-
foundVerb = true;
224+
tempLen = strlen(argv[i]);
225+
foundVerb = true;
226226
o->actionDumpMap = true;
227227
}
228228
else if ((_strnicmp(&argv[i][1], "dumptoc", argLen) == 0))
229229
{
230-
tempLen = strlen(argv[i]);
231-
foundVerb = true;
230+
tempLen = strlen(argv[i]);
231+
foundVerb = true;
232232
o->actionDumpToc = true;
233233
}
234234
else if ((_strnicmp(&argv[i][1], "ildump", argLen) == 0))
235235
{
236-
tempLen = strlen(argv[i]);
237-
foundVerb = true;
236+
tempLen = strlen(argv[i]);
237+
foundVerb = true;
238238
o->actionILDump = true;
239-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
239+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
240240
goto processMCL;
241241
}
242242
else if ((_strnicmp(&argv[i][1], "merge", argLen) == 0))
243243
{
244-
tempLen = strlen(argv[i]);
245-
foundVerb = true;
244+
tempLen = strlen(argv[i]);
245+
foundVerb = true;
246246
o->actionMerge = true;
247247
}
248248
else if ((_strnicmp(&argv[i][1], "recursive", argLen) == 0))
249249
{
250-
tempLen = strlen(argv[i]);
250+
tempLen = strlen(argv[i]);
251251
o->recursive = true;
252252
}
253253
else if ((_strnicmp(&argv[i][1], "toc", argLen) == 0))
254254
{
255-
tempLen = strlen(argv[i]);
256-
foundVerb = true;
255+
tempLen = strlen(argv[i]);
256+
foundVerb = true;
257257
o->actionTOC = true;
258258
}
259259
else if ((_strnicmp(&argv[i][1], "input", argLen) == 0))
@@ -294,8 +294,8 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
294294
}
295295
else if ((_strnicmp(&argv[i][1], "integ", argLen) == 0))
296296
{
297-
tempLen = strlen(argv[i]);
298-
foundVerb = true;
297+
tempLen = strlen(argv[i]);
298+
foundVerb = true;
299299
o->actionInteg = true;
300300
}
301301
else if ((_strnicmp(&argv[i][1], "mcl", argLen) == 0))
@@ -316,24 +316,24 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
316316
}
317317
else if ((_strnicmp(&argv[i][1], "removeDup", argLen) == 0))
318318
{
319-
tempLen = strlen(argv[i]);
320-
foundVerb = true;
319+
tempLen = strlen(argv[i]);
320+
foundVerb = true;
321321
o->actionRemoveDup = true;
322322
}
323323
else if ((_strnicmp(&argv[i][1], "stat", argLen) == 0))
324324
{
325-
tempLen = strlen(argv[i]);
326-
foundVerb = true;
325+
tempLen = strlen(argv[i]);
326+
foundVerb = true;
327327
o->actionStat = true;
328-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
328+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
329329
goto processMCL;
330330
}
331331
else if ((_strnicmp(&argv[i][1], "strip", argLen) == 0))
332332
{
333-
tempLen = strlen(argv[i]);
334-
foundVerb = true;
333+
tempLen = strlen(argv[i]);
334+
foundVerb = true;
335335
o->actionStrip = true;
336-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
336+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
337337
goto processMCL;
338338
}
339339
else if ((_strnicmp(&argv[i][1], "thin", argLen) == 0))
@@ -346,10 +346,10 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
346346
}
347347
else if ((_strnicmp(&argv[i][1], "smarty", argLen) == 0))
348348
{
349-
tempLen = strlen(argv[i]);
349+
tempLen = strlen(argv[i]);
350350
o->actionSmarty = true;
351-
foundVerb = true;
352-
if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
351+
foundVerb = true;
352+
if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
353353
goto processMCL;
354354
}
355355
else if ((_strnicmp(&argv[i][1], "verbosity", argLen) == 0))
@@ -378,12 +378,11 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
378378
DumpHelp(argv[0]);
379379
return false;
380380
}
381-
382381
}
383-
//Process an input filename
382+
// Process an input filename
384383
else
385384
{
386-
char *lastdot = strrchr(argv[i], '.');
385+
char* lastdot = strrchr(argv[i], '.');
387386
if (lastdot != nullptr)
388387
{
389388
if (_stricmp(lastdot, ".mcl") == 0)

src/ToolBox/superpmi/mcs/commandline.h

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,59 @@
1212
class CommandLine
1313
{
1414
public:
15-
1615
class Options
1716
{
1817
public:
19-
Options() :
20-
actionASMDump(false),
21-
actionConcat(false),
22-
actionCopy(false),
23-
actionDump(false),
24-
actionDumpMap(false),
25-
actionDumpToc(false),
26-
actionFracture(false),
27-
actionILDump(false),
28-
actionInteg(false),
29-
actionMerge(false),
30-
actionRemoveDup(false),
31-
actionSmarty(false),
32-
actionStat(false),
33-
actionStrip(false),
34-
actionTOC(false),
35-
legacyCompare(false),
36-
recursive(false),
37-
stripCR(false),
38-
nameOfFile1(nullptr),
39-
nameOfFile2(nullptr),
40-
nameOfFile3(nullptr),
41-
indexCount(-1),
42-
indexes(nullptr)
18+
Options()
19+
: actionASMDump(false)
20+
, actionConcat(false)
21+
, actionCopy(false)
22+
, actionDump(false)
23+
, actionDumpMap(false)
24+
, actionDumpToc(false)
25+
, actionFracture(false)
26+
, actionILDump(false)
27+
, actionInteg(false)
28+
, actionMerge(false)
29+
, actionRemoveDup(false)
30+
, actionSmarty(false)
31+
, actionStat(false)
32+
, actionStrip(false)
33+
, actionTOC(false)
34+
, legacyCompare(false)
35+
, recursive(false)
36+
, stripCR(false)
37+
, nameOfFile1(nullptr)
38+
, nameOfFile2(nullptr)
39+
, nameOfFile3(nullptr)
40+
, indexCount(-1)
41+
, indexes(nullptr)
4342
{
4443
}
4544

46-
bool actionASMDump;
47-
bool actionConcat;
48-
bool actionCopy;
49-
bool actionDump;
50-
bool actionDumpMap;
51-
bool actionDumpToc;
52-
bool actionFracture;
53-
bool actionILDump;
54-
bool actionInteg;
55-
bool actionMerge;
56-
bool actionRemoveDup;
57-
bool actionSmarty;
58-
bool actionStat;
59-
bool actionStrip;
60-
bool actionTOC;
61-
bool legacyCompare;
62-
bool recursive;
63-
bool stripCR;
45+
bool actionASMDump;
46+
bool actionConcat;
47+
bool actionCopy;
48+
bool actionDump;
49+
bool actionDumpMap;
50+
bool actionDumpToc;
51+
bool actionFracture;
52+
bool actionILDump;
53+
bool actionInteg;
54+
bool actionMerge;
55+
bool actionRemoveDup;
56+
bool actionSmarty;
57+
bool actionStat;
58+
bool actionStrip;
59+
bool actionTOC;
60+
bool legacyCompare;
61+
bool recursive;
62+
bool stripCR;
6463
char* nameOfFile1;
6564
char* nameOfFile2;
6665
char* nameOfFile3;
67-
int indexCount;
68-
int* indexes;
66+
int indexCount;
67+
int* indexes;
6968
};
7069

7170
static bool Parse(int argc, char* argv[], /* OUT */ Options* o);

src/ToolBox/superpmi/mcs/mcs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ int __cdecl main(int argc, char* argv[])
3535
Logger::Initialize();
3636

3737
CommandLine::Options o;
38-
if(!CommandLine::Parse(argc, argv, &o))
38+
if (!CommandLine::Parse(argc, argv, &o))
3939
{
4040
return -1;
4141
}
4242

43-
//execute the chosen command.
43+
// execute the chosen command.
4444
int exitCode = 0;
4545
if (o.actionASMDump)
4646
{

src/ToolBox/superpmi/mcs/verbasmdump.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#define BUFFER_SIZE 0xFFFFFF
1515

16-
int verbASMDump::DoWork(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes)
16+
int verbASMDump::DoWork(const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes)
1717
{
1818
LogVerbose("Loading from '%s' and writing ASM output into '%s-MC#.asm'", nameOfInput, nameOfOutput);
1919

@@ -30,7 +30,8 @@ int verbASMDump::DoWork(const char *nameOfInput, const char *nameOfOutput, int i
3030
char buff[500];
3131
sprintf_s(buff, 500, "%s-%d.asm", nameOfOutput, mci.MethodContextNumber());
3232

33-
HANDLE hFileOut = CreateFileA(buff, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
33+
HANDLE hFileOut = CreateFileA(buff, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
34+
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
3435
if (hFileOut == INVALID_HANDLE_VALUE)
3536
{
3637
LogError("Failed to open output '%s'. GetLastError()=%u", buff, GetLastError());
@@ -40,8 +41,8 @@ int verbASMDump::DoWork(const char *nameOfInput, const char *nameOfOutput, int i
4041
if (mc->cr->IsEmpty())
4142
{
4243
const size_t bufflen = 4096;
43-
DWORD bytesWritten;
44-
char buff[bufflen];
44+
DWORD bytesWritten;
45+
char buff[bufflen];
4546
ZeroMemory(buff, bufflen * sizeof(char));
4647
int buff_offset = sprintf_s(buff, bufflen, ";;Method context has no compile result");
4748
WriteFile(hFileOut, buff, buff_offset * sizeof(char), &bytesWritten, nullptr);

src/ToolBox/superpmi/mcs/verbasmdump.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
class verbASMDump
1313
{
1414
public:
15-
static int DoWork(const char *nameOfInput1, const char *nameOfOutput, int indexCount, const int *indexes);
15+
static int DoWork(const char* nameOfInput1, const char* nameOfOutput, int indexCount, const int* indexes);
1616
};
1717
#endif
18-
19-

0 commit comments

Comments
 (0)