Make sys::Program::ExecuteAndWait not throw exceptions and update any
affected code. It now return -9999 to signal that the program couldn't be
executed. Only one case (in bugpoint) actually examines the result code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29785
91177308-0d34-0410-b5e6-
96231b3b80d8
/// called then a std::string is thrown.
/// @returns an integer result code indicating the status of the program.
/// A zero or positive value indicates the result code of the program. A
- /// negative value is the signal number on which it terminated.
+ /// negative value is the signal number on which it terminated. A value of
+ /// -9999 indicates the program could not be executed.
/// @throws std::string on a variety of error conditions or if the invoked
/// program aborted abnormally.
/// @see FindProgrambyName
using namespace cl;
// Globals for name and overview of program
-static const char *ProgramName = "<unknown>";
+static const char *ProgramName = "<premain>";
static const char *ProgramOverview = 0;
// This collects additional help to be printed.
args.push_back(PSFilename.c_str());
args.push_back(0);
- sys::Program::ExecuteAndWait(gv, &args[0]);
+ if (sys::Program::ExecuteAndWait(gv, &args[0])) {
+ std::cerr << "Error viewing graph: 'gv' not in path?\n";
+ }
}
PSFilename.eraseFromDisk();
#elif HAVE_DOTTY
unsigned secondsToWait
) {
if (!path.canExecute())
- throw path.toString() + " is not executable";
+ return -9999;
#ifdef HAVE_SYS_WAIT_H
// Create a child process.
std::cout << "Success!\n";
else if (result > 0)
std::cout << "Exited with error code '" << result << "'\n";
+ else if (result == -9999)
+ std::cout << "Program not executable\n";
else if (result < 0)
std::cout << "Crashed with signal #" << abs(result) << "\n";
if (result & 0x01000000)
sys::Path ErrorFilename("error_messages");
ErrorFilename.makeUnique();
RunProgramWithTimeout(ProgPath, Args, sys::Path(""), ErrorFilename,
- ErrorFilename);
+ ErrorFilename); // FIXME: check return code
// Print out the error messages generated by GCC if possible...
std::ifstream ErrorFile(ErrorFilename.c_str());
args.push_back(tmpAsmFilePath.c_str());
args.push_back(0);
- int R1 = sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1);
+ sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1);
tmpAsmFilePath.eraseFromDisk();
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/Timer.h"
-#include "llvm/Analysis/LinkAllAnalyses.h"
-#include "llvm/Transforms/LinkAllPasses.h"
+#include "llvm/LinkAllPasses.h"
#include "llvm/LinkAllVMCore.h"
#include <fstream>
#include <memory>