freebsd-dev/contrib/llvm/lib/Support/Program.cpp
Dimitry Andric f785676f2a Upgrade our copy of llvm/clang to 3.4 release. This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.

The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3.  The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.

Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>

MFC after:	1 month
2014-02-16 19:44:07 +00:00

68 lines
2.3 KiB
C++

//===-- Program.cpp - Implement OS Program Concept --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This header file implements the operating system Program concept.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/Program.h"
#include "llvm/Config/config.h"
#include "llvm/Support/system_error.h"
using namespace llvm;
using namespace sys;
//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only TRULY operating system
//=== independent code.
//===----------------------------------------------------------------------===//
static bool Execute(ProcessInfo &PI, StringRef Program, const char **args,
const char **env, const StringRef **Redirects,
unsigned memoryLimit, std::string *ErrMsg);
int sys::ExecuteAndWait(StringRef Program, const char **args, const char **envp,
const StringRef **redirects, unsigned secondsToWait,
unsigned memoryLimit, std::string *ErrMsg,
bool *ExecutionFailed) {
ProcessInfo PI;
if (Execute(PI, Program, args, envp, redirects, memoryLimit, ErrMsg)) {
if (ExecutionFailed)
*ExecutionFailed = false;
ProcessInfo Result = Wait(PI, secondsToWait, true, ErrMsg);
return Result.ReturnCode;
}
if (ExecutionFailed)
*ExecutionFailed = true;
return -1;
}
ProcessInfo sys::ExecuteNoWait(StringRef Program, const char **args,
const char **envp, const StringRef **redirects,
unsigned memoryLimit, std::string *ErrMsg,
bool *ExecutionFailed) {
ProcessInfo PI;
if (ExecutionFailed)
*ExecutionFailed = false;
if (!Execute(PI, Program, args, envp, redirects, memoryLimit, ErrMsg))
if (ExecutionFailed)
*ExecutionFailed = true;
return PI;
}
// Include the platform-specific parts of this class.
#ifdef LLVM_ON_UNIX
#include "Unix/Program.inc"
#endif
#ifdef LLVM_ON_WIN32
#include "Windows/Program.inc"
#endif