diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /tools/bugpoint/ToolRunner.cpp | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'tools/bugpoint/ToolRunner.cpp')
-rw-r--r-- | tools/bugpoint/ToolRunner.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 4a2401b530..51091e297d 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -141,13 +141,13 @@ static std::string ProcessFailure(StringRef ProgPath, const char** Args, // Rerun the compiler, capturing any error messages to print them. SmallString<128> ErrorFilename; - int ErrorFD; std::error_code EC = sys::fs::createTemporaryFile( - "bugpoint.program_error_messages", "", ErrorFD, ErrorFilename); + "bugpoint.program_error_messages", "", ErrorFilename); if (EC) { errs() << "Error making unique filename: " << EC.message() << "\n"; exit(1); } + RunProgramWithTimeout(ProgPath, Args, "", ErrorFilename.str(), ErrorFilename.str(), Timeout, MemoryLimit); // FIXME: check return code ? @@ -427,13 +427,14 @@ static void lexCommand(std::string &Message, const std::string &CommandLine, pos = CommandLine.find_first_of(delimiters, lastPos); } - CmdPath = sys::FindProgramByName(Command); - if (CmdPath.empty()) { + auto Path = sys::findProgramByName(Command); + if (!Path) { Message = std::string("Cannot find '") + Command + - "' in PATH!\n"; + "' in PATH: " + Path.getError().message() + "\n"; return; } + CmdPath = *Path; Message = "Found command in: " + CmdPath + "\n"; } @@ -907,16 +908,24 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType, GCC *GCC::create(std::string &Message, const std::string &GCCBinary, const std::vector<std::string> *Args) { - std::string GCCPath = sys::FindProgramByName(GCCBinary); - if (GCCPath.empty()) { - Message = "Cannot find `"+ GCCBinary +"' in PATH!\n"; + auto GCCPath = sys::findProgramByName(GCCBinary); + if (!GCCPath) { + Message = "Cannot find `" + GCCBinary + "' in PATH: " + + GCCPath.getError().message() + "\n"; return nullptr; } std::string RemoteClientPath; - if (!RemoteClient.empty()) - RemoteClientPath = sys::FindProgramByName(RemoteClient); + if (!RemoteClient.empty()) { + auto Path = sys::findProgramByName(RemoteClient); + if (!Path) { + Message = "Cannot find `" + RemoteClient + "' in PATH: " + + Path.getError().message() + "\n"; + return nullptr; + } + RemoteClientPath = *Path; + } - Message = "Found gcc: " + GCCPath + "\n"; - return new GCC(GCCPath, RemoteClientPath, Args); + Message = "Found gcc: " + *GCCPath + "\n"; + return new GCC(*GCCPath, RemoteClientPath, Args); } |