Daniel Dunbar | 48f7ce8 | 2009-09-24 06:23:57 +0000 | [diff] [blame] | 1 | //===- not.cpp - The 'not' testing tool -----------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Michael J. Spencer | 1f6efa3 | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 10 | #include "llvm/Support/Path.h" |
| 11 | #include "llvm/Support/Program.h" |
Dan Gohman | 9dbb79a | 2010-10-29 20:20:29 +0000 | [diff] [blame] | 12 | #include "llvm/Support/raw_ostream.h" |
Daniel Dunbar | 48f7ce8 | 2009-09-24 06:23:57 +0000 | [diff] [blame] | 13 | using namespace llvm; |
| 14 | |
| 15 | int main(int argc, const char **argv) { |
| 16 | sys::Path Program = sys::Program::FindProgramByName(argv[1]); |
Dan Gohman | 9dbb79a | 2010-10-29 20:20:29 +0000 | [diff] [blame] | 17 | |
| 18 | std::string ErrMsg; |
| 19 | int Result = sys::Program::ExecuteAndWait(Program, argv + 1, 0, 0, 0, 0, |
| 20 | &ErrMsg); |
| 21 | if (Result < 0) { |
| 22 | errs() << "Error: " << ErrMsg << "\n"; |
| 23 | return 1; |
| 24 | } |
| 25 | |
| 26 | return Result == 0; |
Daniel Dunbar | 48f7ce8 | 2009-09-24 06:23:57 +0000 | [diff] [blame] | 27 | } |