@@ -1654,7 +1654,7 @@ static void parseInputFilenamesFile(MemoryBuffer *Buffer,
16541654 }
16551655}
16561656
1657- static int merge_main (int argc, const char *argv[] ) {
1657+ static int merge_main (StringRef ProgName ) {
16581658 WeightedFileVector WeightedInputs;
16591659 for (StringRef Filename : InputFilenames)
16601660 addWeightedInput (WeightedInputs, {std::string (Filename), 1 });
@@ -1667,8 +1667,7 @@ static int merge_main(int argc, const char *argv[]) {
16671667 parseInputFilenamesFile (Buffer.get (), WeightedInputs);
16681668
16691669 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" );
16721671
16731672 if (DumpInputFileList) {
16741673 for (auto &WF : WeightedInputs)
@@ -2654,7 +2653,7 @@ void overlapSampleProfile(const std::string &BaseFilename,
26542653 OverlapAggr.dumpFuncSimilarity (OS);
26552654}
26562655
2657- static int overlap_main (int argc, const char *argv[] ) {
2656+ static int overlap_main () {
26582657 std::error_code EC;
26592658 raw_fd_ostream OS (OutputFilename.data (), EC, sys::fs::OF_TextWithCRLF);
26602659 if (EC)
@@ -3231,15 +3230,16 @@ static int showDebugInfoCorrelation(const std::string &Filename,
32313230 return 0 ;
32323231}
32333232
3234- static int show_main (int argc, const char *argv[] ) {
3233+ static int show_main (StringRef ProgName ) {
32353234 if (Filename.empty () && DebugInfoFilename.empty ())
32363235 exitWithError (
32373236 " the positional argument '<profdata-file>' is required unless '--" +
32383237 DebugInfoFilename.ArgStr + " ' is provided" );
32393238
32403239 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 " ;
32433243 return 1 ;
32443244 }
32453245 if (JsonFormat)
@@ -3263,7 +3263,7 @@ static int show_main(int argc, const char *argv[]) {
32633263 return showMemProfProfile (SFormat, OS);
32643264}
32653265
3266- static int order_main (int argc, const char *argv[] ) {
3266+ static int order_main () {
32673267 std::error_code EC;
32683268 raw_fd_ostream OS (OutputFilename.data (), EC, sys::fs::OF_TextWithCRLF);
32693269 if (EC)
@@ -3314,16 +3314,16 @@ int llvm_profdata_main(int argc, char **argvNonConst,
33143314 cl::ParseCommandLineOptions (argc, argv, " LLVM profile data\n " );
33153315
33163316 if (ShowSubcommand)
3317- return show_main (argc, argv );
3317+ return show_main (ProgName );
33183318
33193319 if (OrderSubcommand)
3320- return order_main (argc, argv );
3320+ return order_main ();
33213321
33223322 if (OverlapSubcommand)
3323- return overlap_main (argc, argv );
3323+ return overlap_main ();
33243324
33253325 if (MergeSubcommand)
3326- return merge_main (argc, argv );
3326+ return merge_main (ProgName );
33273327
33283328 errs () << ProgName
33293329 << " : Unknown command. Run llvm-profdata --help for usage.\n " ;
0 commit comments