@@ -1654,7 +1654,7 @@ static void parseInputFilenamesFile(MemoryBuffer *Buffer,
1654
1654
}
1655
1655
}
1656
1656
1657
- static int merge_main (int argc, const char *argv[] ) {
1657
+ static int merge_main (StringRef ProgName ) {
1658
1658
WeightedFileVector WeightedInputs;
1659
1659
for (StringRef Filename : InputFilenames)
1660
1660
addWeightedInput (WeightedInputs, {std::string (Filename), 1 });
@@ -1667,8 +1667,7 @@ static int merge_main(int argc, const char *argv[]) {
1667
1667
parseInputFilenamesFile (Buffer.get (), WeightedInputs);
1668
1668
1669
1669
if (WeightedInputs.empty ())
1670
- exitWithError (" no input files specified. See " +
1671
- sys::path::filename (argv[0 ]) + " " + argv[1 ] + " -help" );
1670
+ exitWithError (" no input files specified. See " + ProgName + " merge -help" );
1672
1671
1673
1672
if (DumpInputFileList) {
1674
1673
for (auto &WF : WeightedInputs)
@@ -2654,7 +2653,7 @@ void overlapSampleProfile(const std::string &BaseFilename,
2654
2653
OverlapAggr.dumpFuncSimilarity (OS);
2655
2654
}
2656
2655
2657
- static int overlap_main (int argc, const char *argv[] ) {
2656
+ static int overlap_main () {
2658
2657
std::error_code EC;
2659
2658
raw_fd_ostream OS (OutputFilename.data (), EC, sys::fs::OF_TextWithCRLF);
2660
2659
if (EC)
@@ -3231,15 +3230,16 @@ static int showDebugInfoCorrelation(const std::string &Filename,
3231
3230
return 0 ;
3232
3231
}
3233
3232
3234
- static int show_main (int argc, const char *argv[] ) {
3233
+ static int show_main (StringRef ProgName ) {
3235
3234
if (Filename.empty () && DebugInfoFilename.empty ())
3236
3235
exitWithError (
3237
3236
" the positional argument '<profdata-file>' is required unless '--" +
3238
3237
DebugInfoFilename.ArgStr + " ' is provided" );
3239
3238
3240
3239
if (Filename == OutputFilename) {
3241
- errs () << sys::path::filename (argv[0 ]) << " " << argv[1 ]
3242
- << " : Input file name cannot be the same as the output file name!\n " ;
3240
+ errs () << ProgName
3241
+ << " show: Input file name cannot be the same as the output file "
3242
+ " name!\n " ;
3243
3243
return 1 ;
3244
3244
}
3245
3245
if (JsonFormat)
@@ -3263,7 +3263,7 @@ static int show_main(int argc, const char *argv[]) {
3263
3263
return showMemProfProfile (SFormat, OS);
3264
3264
}
3265
3265
3266
- static int order_main (int argc, const char *argv[] ) {
3266
+ static int order_main () {
3267
3267
std::error_code EC;
3268
3268
raw_fd_ostream OS (OutputFilename.data (), EC, sys::fs::OF_TextWithCRLF);
3269
3269
if (EC)
@@ -3314,16 +3314,16 @@ int llvm_profdata_main(int argc, char **argvNonConst,
3314
3314
cl::ParseCommandLineOptions (argc, argv, " LLVM profile data\n " );
3315
3315
3316
3316
if (ShowSubcommand)
3317
- return show_main (argc, argv );
3317
+ return show_main (ProgName );
3318
3318
3319
3319
if (OrderSubcommand)
3320
- return order_main (argc, argv );
3320
+ return order_main ();
3321
3321
3322
3322
if (OverlapSubcommand)
3323
- return overlap_main (argc, argv );
3323
+ return overlap_main ();
3324
3324
3325
3325
if (MergeSubcommand)
3326
- return merge_main (argc, argv );
3326
+ return merge_main (ProgName );
3327
3327
3328
3328
errs () << ProgName
3329
3329
<< " : Unknown command. Run llvm-profdata --help for usage.\n " ;
0 commit comments