diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-23 22:45:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-23 22:45:37 +0000 |
commit | 74382b7c699120fbec5cb5603c9cf4212eb37f06 (patch) | |
tree | c8c2c5b8879b256c428b0d35841b9cce1c2cc51c /tools/bugpoint/OptimizerDriver.cpp | |
parent | 983c592272eb59d39fd78c515e1f2701638879e0 (diff) | |
download | external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.zip external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.gz external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.bz2 |
Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.
This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
instead.
4. Weans llvm-db off <iostream>
sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r-- | tools/bugpoint/OptimizerDriver.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index ef41c43..0c9037f 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -27,9 +27,9 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/System/Path.h" #include "llvm/System/Program.h" -#include "llvm/Config/alloca.h" #define DONT_GET_PLUGIN_LOADER_OPTION #include "llvm/Support/PluginLoader.h" @@ -136,7 +136,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes, << ErrMsg << "\n"; return(1); } - OutputFilename = uniqueFilename.toString(); + OutputFilename = uniqueFilename.str(); // set up the input file name sys::Path inputFilename("bugpoint-input.bc"); @@ -152,29 +152,26 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes, if (!ErrInfo.empty()) { - errs() << "Error opening bitcode file: " << inputFilename << "\n"; + errs() << "Error opening bitcode file: " << inputFilename.str() << "\n"; return 1; } WriteBitcodeToFile(Program, InFile); InFile.close(); // setup the child process' arguments - const char** args = (const char**) - alloca(sizeof(const char*) * - (Passes.size()+13+2*PluginLoader::getNumPlugins()+NumExtraArgs)); - int n = 0; + SmallVector<const char*, 8> Args; sys::Path tool = sys::Program::FindProgramByName(ToolName); if (UseValgrind) { - args[n++] = "valgrind"; - args[n++] = "--error-exitcode=1"; - args[n++] = "-q"; - args[n++] = tool.c_str(); + Args.push_back("valgrind"); + Args.push_back("--error-exitcode=1"); + Args.push_back("-q"); + Args.push_back(tool.c_str()); } else - args[n++] = ToolName; + Args.push_back(ToolName); - args[n++] = "-as-child"; - args[n++] = "-child-output"; - args[n++] = OutputFilename.c_str(); + Args.push_back("-as-child"); + Args.push_back("-child-output"); + Args.push_back(OutputFilename.c_str()); std::vector<std::string> pass_args; for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) { pass_args.push_back( std::string("-load")); @@ -185,11 +182,11 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes, pass_args.push_back( std::string("-") + (*I)->getPassArgument() ); for (std::vector<std::string>::const_iterator I = pass_args.begin(), E = pass_args.end(); I != E; ++I ) - args[n++] = I->c_str(); - args[n++] = inputFilename.c_str(); + Args.push_back(I->c_str()); + Args.push_back(inputFilename.c_str()); for (unsigned i = 0; i < NumExtraArgs; ++i) - args[n++] = *ExtraArgs; - args[n++] = 0; + Args.push_back(*ExtraArgs); + Args.push_back(0); sys::Path prog; if (UseValgrind) @@ -201,7 +198,8 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes, sys::Path Nowhere; const sys::Path *Redirects[3] = {0, &Nowhere, &Nowhere}; - int result = sys::Program::ExecuteAndWait(prog, args, 0, (SilencePasses ? Redirects : 0), + int result = sys::Program::ExecuteAndWait(prog, Args.data(), 0, + (SilencePasses ? Redirects : 0), Timeout, MemoryLimit, &ErrMsg); // If we are supposed to delete the bitcode file or if the passes crashed, |