StringRef StdErrFile,
unsigned NumSeconds = 0,
unsigned MemoryLimit = 0,
- std::string *ErrMsg = 0) {
+ std::string *ErrMsg = nullptr) {
const StringRef *Redirects[3] = { &StdInFile, &StdOutFile, &StdErrFile };
#if 0 // For debug purposes
}
#endif
- return sys::ExecuteAndWait(ProgramPath, Args, 0, Redirects,
+ return sys::ExecuteAndWait(ProgramPath, Args, nullptr, Redirects,
NumSeconds, MemoryLimit, ErrMsg);
}
#endif
// Run the program remotely with the remote client
- int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, 0,
+ int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, nullptr,
Redirects, NumSeconds, MemoryLimit);
// Has the remote client fail?
// Rerun the compiler, capturing any error messages to print them.
SmallString<128> ErrorFilename;
int ErrorFD;
- error_code EC = sys::fs::createTemporaryFile(
+ std::error_code EC = sys::fs::createTemporaryFile(
"bugpoint.program_error_messages", "", ErrorFD, ErrorFilename);
if (EC) {
errs() << "Error making unique filename: " << EC.message() << "\n";
exit(1);
}
+
+#ifdef _WIN32
+ // Close ErrorFD immediately, or it couldn't be reopened on Win32.
+ // FIXME: We may have an option in openFileForWrite(), not to use ResultFD
+ // but to close it.
+ delete new raw_fd_ostream(ErrorFD, true);
+#endif
+
RunProgramWithTimeout(ProgPath, Args, "", ErrorFilename.str(),
ErrorFilename.str(), Timeout, MemoryLimit);
// FIXME: check return code ?
// Add optional parameters to the running program from Argv
for (unsigned i=0, e = Args.size(); i != e; ++i)
LLIArgs.push_back(Args[i].c_str());
- LLIArgs.push_back(0);
+ LLIArgs.push_back(nullptr);
outs() << "<lli>"; outs().flush();
DEBUG(errs() << "\nAbout to run:\t";
}
Message = "Cannot find `lli' in executable directory!\n";
- return 0;
+ return nullptr;
}
//===---------------------------------------------------------------------===//
for (std::size_t i = 0; i < CompilerArgs.size(); ++i)
ProgramArgs.push_back(CompilerArgs.at(i).c_str());
ProgramArgs.push_back(Bitcode.c_str());
- ProgramArgs.push_back(0);
+ ProgramArgs.push_back(nullptr);
// Add optional parameters to the running program from Argv
for (unsigned i = 0, e = CompilerArgs.size(); i != e; ++i)
for (std::size_t i = 0; i < ExecutorArgs.size(); ++i)
ProgramArgs.push_back(ExecutorArgs.at(i).c_str());
ProgramArgs.push_back(Bitcode.c_str());
- ProgramArgs.push_back(0);
+ ProgramArgs.push_back(nullptr);
// Add optional parameters to the running program from Argv
for (unsigned i = 0, e = Args.size(); i != e; ++i)
std::vector<std::string> Args;
lexCommand(Message, CompileCommandLine, CmdPath, Args);
if (CmdPath.empty())
- return 0;
+ return nullptr;
return new CustomCompiler(CmdPath, Args);
}
std::vector<std::string> Args;
lexCommand(Message, ExecCommandLine, CmdPath, Args);
if (CmdPath.empty())
- return 0;
+ return nullptr;
return new CustomExecutor(CmdPath, Args);
}
const char *Suffix = (UseIntegratedAssembler ? ".llc.o" : ".llc.s");
SmallString<128> UniqueFile;
- error_code EC =
+ std::error_code EC =
sys::fs::createUniqueFile(Bitcode + "-%%%%%%%" + Suffix, UniqueFile);
if (EC) {
errs() << "Error making unique filename: " << EC.message() << "\n";
if (UseIntegratedAssembler)
LLCArgs.push_back("-filetype=obj");
- LLCArgs.push_back (0);
+ LLCArgs.push_back (nullptr);
outs() << (UseIntegratedAssembler ? "<llc-ia>" : "<llc>");
outs().flush();
PrependMainExecutablePath("llc", Argv0, (void *)(intptr_t) & createLLC);
if (LLCPath.empty()) {
Message = "Cannot find `llc' in executable directory!\n";
- return 0;
+ return nullptr;
}
GCC *gcc = GCC::create(Message, GCCBinary, GCCArgs);
// Add optional parameters to the running program from Argv
for (unsigned i=0, e = Args.size(); i != e; ++i)
JITArgs.push_back(Args[i].c_str());
- JITArgs.push_back(0);
+ JITArgs.push_back(nullptr);
outs() << "<jit>"; outs().flush();
DEBUG(errs() << "\nAbout to run:\t";
}
Message = "Cannot find `lli' in executable directory!\n";
- return 0;
+ return nullptr;
}
//===---------------------------------------------------------------------===//
GCCArgs.push_back("-o");
SmallString<128> OutputBinary;
- error_code EC =
+ std::error_code EC =
sys::fs::createUniqueFile(ProgramFile + "-%%%%%%%.gcc.exe", OutputBinary);
if (EC) {
errs() << "Error making unique filename: " << EC.message() << "\n";
#endif
if (TargetTriple.getArch() == Triple::sparc)
GCCArgs.push_back("-mcpu=v9");
- GCCArgs.push_back(0); // NULL terminator
+ GCCArgs.push_back(nullptr); // NULL terminator
outs() << "<gcc>"; outs().flush();
DEBUG(errs() << "\nAbout to run:\t";
// Add optional parameters to the running program from Argv
for (unsigned i = 0, e = Args.size(); i != e; ++i)
ProgramArgs.push_back(Args[i].c_str());
- ProgramArgs.push_back(0); // NULL terminator
+ ProgramArgs.push_back(nullptr); // NULL terminator
// Now that we have a binary, run it!
outs() << "<program>"; outs().flush();
const std::vector<std::string> &ArgsForGCC,
std::string &Error) {
SmallString<128> UniqueFilename;
- error_code EC = sys::fs::createUniqueFile(
+ std::error_code EC = sys::fs::createUniqueFile(
InputFile + "-%%%%%%%" + LTDL_SHLIB_EXT, UniqueFilename);
if (EC) {
errs() << "Error making unique filename: " << EC.message() << "\n";
// command line, so this should be safe.
for (unsigned i = 0, e = ArgsForGCC.size(); i != e; ++i)
GCCArgs.push_back(ArgsForGCC[i].c_str());
- GCCArgs.push_back(0); // NULL terminator
+ GCCArgs.push_back(nullptr); // NULL terminator
std::string GCCPath = sys::FindProgramByName(GCCBinary);
if (GCCPath.empty()) {
Message = "Cannot find `"+ GCCBinary +"' in PATH!\n";
- return 0;
+ return nullptr;
}
std::string RemoteClientPath;