diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h index 75f166b21b2..fe5201eb2e6 100644 --- a/tools/bugpoint/BugDriver.h +++ b/tools/bugpoint/BugDriver.h @@ -217,8 +217,7 @@ public: /// returning the transformed module on success, or a null pointer on failure. std::unique_ptr runPassesOn(Module *M, const std::vector &Passes, - unsigned NumExtraArgs = 0, - const char *const *ExtraArgs = nullptr); + ArrayRef ExtraArgs = {}); /// runPasses - Run the specified passes on Program, outputting a bitcode /// file and writting the filename into OutputFile if successful. If the @@ -231,8 +230,8 @@ public: /// bool runPasses(Module &Program, const std::vector &PassesToRun, std::string &OutputFilename, bool DeleteOutput = false, - bool Quiet = false, unsigned NumExtraArgs = 0, - const char *const *ExtraArgs = nullptr) const; + bool Quiet = false, + ArrayRef ExtraArgs = {}) const; /// runPasses - Just like the method above, but this just returns true or /// false indicating whether or not the optimizer crashed on the specified diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 105702de3f1..d9047acd30e 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -407,11 +407,10 @@ BugDriver::extractMappedBlocksFromModule(const std::vector &BBs, std::string uniqueFN = "--extract-blocks-file="; uniqueFN += Temp->TmpName; - const char *ExtraArg = uniqueFN.c_str(); std::vector PI; PI.push_back("extract-blocks"); - std::unique_ptr Ret = runPassesOn(M, PI, 1, &ExtraArg); + std::unique_ptr Ret = runPassesOn(M, PI, {uniqueFN}); if (!Ret) { outs() << "*** Basic Block extraction failed, please report a bug!\n"; diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index e093389bdfe..64af81fcc8a 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -130,8 +130,7 @@ static cl::list OptArgs("opt-args", cl::Positional, bool BugDriver::runPasses(Module &Program, const std::vector &Passes, std::string &OutputFilename, bool DeleteOutput, - bool Quiet, unsigned NumExtraArgs, - const char *const *ExtraArgs) const { + bool Quiet, ArrayRef ExtraArgs) const { // setup the output file name outs().flush(); SmallString<128> UniqueFilename; @@ -223,8 +222,7 @@ bool BugDriver::runPasses(Module &Program, I != E; ++I) Args.push_back(I->c_str()); Args.push_back(Temp->TmpName.c_str()); - for (unsigned i = 0; i < NumExtraArgs; ++i) - Args.push_back(*ExtraArgs); + Args.append(ExtraArgs.begin(), ExtraArgs.end()); LLVM_DEBUG(errs() << "\nAbout to run:\t"; for (unsigned i = 0, e = Args.size() - 1; i != e; ++i) errs() @@ -268,10 +266,10 @@ bool BugDriver::runPasses(Module &Program, std::unique_ptr BugDriver::runPassesOn(Module *M, const std::vector &Passes, - unsigned NumExtraArgs, const char *const *ExtraArgs) { + ArrayRef ExtraArgs) { std::string BitcodeResult; if (runPasses(*M, Passes, BitcodeResult, false /*delete*/, true /*quiet*/, - NumExtraArgs, ExtraArgs)) { + ExtraArgs)) { return nullptr; }