@@ -181,13 +181,11 @@ Expected<int> LLI::ExecuteProgram(const std::string &Bitcode,
181181 }
182182
183183 // Add any extra LLI args.
184- for (unsigned i = 0 , e = ToolArgs.size (); i != e; ++i)
185- LLIArgs.push_back (ToolArgs[i]);
184+ llvm::append_range (LLIArgs, ToolArgs);
186185
187186 LLIArgs.push_back (Bitcode);
188187 // Add optional parameters to the running program from Argv
189- for (unsigned i = 0 , e = Args.size (); i != e; ++i)
190- LLIArgs.push_back (Args[i]);
188+ llvm::append_range (LLIArgs, Args);
191189
192190 outs () << " <lli>" ;
193191 outs ().flush ();
@@ -268,13 +266,11 @@ Error CustomCompiler::compileProgram(const std::string &Bitcode,
268266 std::vector<StringRef> ProgramArgs;
269267 ProgramArgs.push_back (CompilerCommand);
270268
271- for (const auto &Arg : CompilerArgs)
272- ProgramArgs.push_back (Arg);
269+ llvm::append_range (ProgramArgs, CompilerArgs);
273270 ProgramArgs.push_back (Bitcode);
274271
275272 // Add optional parameters to the running program from Argv
276- for (const auto &Arg : CompilerArgs)
277- ProgramArgs.push_back (Arg);
273+ llvm::append_range (ProgramArgs, CompilerArgs);
278274
279275 if (RunProgramWithTimeout (CompilerCommand, ProgramArgs, " " , " " , " " , Timeout,
280276 MemoryLimit))
@@ -317,13 +313,11 @@ Expected<int> CustomExecutor::ExecuteProgram(
317313 std::vector<StringRef> ProgramArgs;
318314 ProgramArgs.push_back (ExecutionCommand);
319315
320- for (std::size_t i = 0 ; i < ExecutorArgs.size (); ++i)
321- ProgramArgs.push_back (ExecutorArgs[i]);
316+ llvm::append_range (ProgramArgs, ExecutorArgs);
322317 ProgramArgs.push_back (Bitcode);
323318
324319 // Add optional parameters to the running program from Argv
325- for (unsigned i = 0 , e = Args.size (); i != e; ++i)
326- ProgramArgs.push_back (Args[i]);
320+ llvm::append_range (ProgramArgs, Args);
327321
328322 return RunProgramWithTimeout (ExecutionCommand, ProgramArgs, InputFile,
329323 OutputFile, OutputFile, Timeout, MemoryLimit);
@@ -447,8 +441,7 @@ Expected<CC::FileType> LLC::OutputCode(const std::string &Bitcode,
447441 LLCArgs.push_back (LLCPath);
448442
449443 // Add any extra LLC args.
450- for (unsigned i = 0 , e = ToolArgs.size (); i != e; ++i)
451- LLCArgs.push_back (ToolArgs[i]);
444+ llvm::append_range (LLCArgs, ToolArgs);
452445
453446 LLCArgs.push_back (" -o" );
454447 LLCArgs.push_back (OutputAsmFile); // Output to the Asm file
@@ -563,17 +556,15 @@ Expected<int> JIT::ExecuteProgram(const std::string &Bitcode,
563556 JITArgs.push_back (" -force-interpreter=false" );
564557
565558 // Add any extra LLI args.
566- for (unsigned i = 0 , e = ToolArgs.size (); i != e; ++i)
567- JITArgs.push_back (ToolArgs[i]);
559+ llvm::append_range (JITArgs, ToolArgs);
568560
569561 for (unsigned i = 0 , e = SharedLibs.size (); i != e; ++i) {
570562 JITArgs.push_back (" -load" );
571563 JITArgs.push_back (SharedLibs[i]);
572564 }
573565 JITArgs.push_back (Bitcode);
574566 // Add optional parameters to the running program from Argv
575- for (unsigned i = 0 , e = Args.size (); i != e; ++i)
576- JITArgs.push_back (Args[i]);
567+ llvm::append_range (JITArgs, Args);
577568
578569 outs () << " <jit>" ;
579570 outs ().flush ();
@@ -674,8 +665,7 @@ Expected<int> CC::ExecuteProgram(const std::string &ProgramFile,
674665 // most likely -L and -l options that need to come before other libraries but
675666 // after the source. Other options won't be sensitive to placement on the
676667 // command line, so this should be safe.
677- for (unsigned i = 0 , e = ArgsForCC.size (); i != e; ++i)
678- CCArgs.push_back (ArgsForCC[i]);
668+ llvm::append_range (CCArgs, ArgsForCC);
679669
680670 CCArgs.push_back (" -lm" ); // Hard-code the math library...
681671 CCArgs.push_back (" -O2" ); // Optimize the program a bit...
@@ -725,8 +715,7 @@ Expected<int> CC::ExecuteProgram(const std::string &ProgramFile,
725715 }
726716
727717 // Add optional parameters to the running program from Argv
728- for (unsigned i = 0 , e = Args.size (); i != e; ++i)
729- ProgramArgs.push_back (Args[i]);
718+ llvm::append_range (ProgramArgs, Args);
730719
731720 // Now that we have a binary, run it!
732721 outs () << " <program>" ;
@@ -823,8 +812,7 @@ Error CC::MakeSharedObject(const std::string &InputFile, FileType fileType,
823812 // most likely -L and -l options that need to come before other libraries but
824813 // after the source. Other options won't be sensitive to placement on the
825814 // command line, so this should be safe.
826- for (unsigned i = 0 , e = ArgsForCC.size (); i != e; ++i)
827- CCArgs.push_back (ArgsForCC[i]);
815+ llvm::append_range (CCArgs, ArgsForCC);
828816
829817 outs () << " <CC>" ;
830818 outs ().flush ();
0 commit comments