From 1214e71d771ca1083b5cb7d12e515d10b6537db2 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Wed, 22 Jan 2014 21:52:35 +0000 Subject: Eliminate inappropriate use of FindProgramByName() from lli git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199835 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lli/lli.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'tools') diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 2ee7979301..e6d4087476 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -94,12 +94,11 @@ namespace { // execution. The child process will be executed and will communicate with // lli via stdin/stdout pipes. cl::opt - MCJITRemoteProcess("mcjit-remote-process", - cl::desc("Specify the filename of the process to launch " - "for remote MCJIT execution. If none is specified," - "\n\tremote execution will be simulated in-process."), - cl::value_desc("filename"), - cl::init("")); + ChildExecPath("mcjit-remote-process", + cl::desc("Specify the filename of the process to launch " + "for remote MCJIT execution. If none is specified," + "\n\tremote execution will be simulated in-process."), + cl::value_desc("filename"), cl::init("")); // Determine optimization level. cl::opt @@ -663,18 +662,17 @@ int main(int argc, char **argv, char * const *envp) { // and send it to the target. OwningPtr Target; - if (!MCJITRemoteProcess.empty()) { // Remote execution on a child process + if (!ChildExecPath.empty()) { // Remote execution on a child process if (!RemoteTarget::hostSupportsExternalRemoteTarget()) { errs() << "Warning: host does not support external remote targets.\n" << " Defaulting to simulated remote execution\n"; Target.reset(RemoteTarget::createRemoteTarget()); } else { - std::string ChildEXE = sys::FindProgramByName(MCJITRemoteProcess); - if (ChildEXE == "") { - errs() << "Unable to find child target: '\''" << MCJITRemoteProcess << "\'\n"; + if (!sys::fs::exists(ChildExecPath)) { + errs() << "Unable to find child target: '" << ChildExecPath << "'\n"; return -1; } - Target.reset(RemoteTarget::createExternalRemoteTarget(ChildEXE)); + Target.reset(RemoteTarget::createExternalRemoteTarget(ChildExecPath)); } } else { // No child process name provided, use simulated remote execution. -- cgit v1.2.3