diff options
author | Devang Patel <dpatel@apple.com> | 2006-10-09 20:20:13 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-10-09 20:20:13 +0000 |
commit | 9f5d48bcb1c6e72363567089242960bfde5171bb (patch) | |
tree | 65a232a9fe57b3e64eea62b46f78583de63abade /tools/lto | |
parent | 54e4c02d8e7ca49b89a1f39824a7617920dd43f0 (diff) | |
download | external_llvm-9f5d48bcb1c6e72363567089242960bfde5171bb.zip external_llvm-9f5d48bcb1c6e72363567089242960bfde5171bb.tar.gz external_llvm-9f5d48bcb1c6e72363567089242960bfde5171bb.tar.bz2 |
Do error checking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r-- | tools/lto/lto.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index aeced8d..a64130d 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -344,6 +344,10 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string ErrMsg; sys::Path TempDir = sys::Path::GetTemporaryDirectory(&ErrMsg); + if (TempDir.isEmpty()) { + std::cerr << "lto: " << ErrMsg << "\n"; + return LTO_WRITE_FAILURE; + } sys::Path tmpAsmFilePath(TempDir); if (!tmpAsmFilePath.appendComponent("lto")) { std::cerr << "lto: " << ErrMsg << "\n"; @@ -399,7 +403,10 @@ LTO::optimizeModules(const std::string &OutputFilename, args.push_back(tmpAsmFilePath.c_str()); args.push_back(0); - sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1); + if (sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1, &ErrMsg)) { + std::cerr << "lto: " << ErrMsg << "\n"; + return LTO_ASM_FAILURE; + } tmpAsmFilePath.eraseFromDisk(); TempDir.eraseFromDisk(true); |