From 2cf17a4f0fdc593cd2e98bf9b407deaf0535cb46 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Tue, 24 Aug 2004 14:05:30 +0000 Subject: [PATCH] - Unify format of output messages - All errors throw std::string - Default output file name to a.out (if we're linking) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16025 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvmc/llvmc.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/llvmc/llvmc.cpp b/tools/llvmc/llvmc.cpp index cd7c0ab5d27..c87c6523f15 100644 --- a/tools/llvmc/llvmc.cpp +++ b/tools/llvmc/llvmc.cpp @@ -214,11 +214,14 @@ int main(int argc, char **argv) { // Deal with unimplemented options. if (PipeCommands) - std::cerr << argv[0] << ": Not implemented yet: -pipe"; + throw "Not implemented yet: -pipe"; + + if (OutputFilename.empty()) + if (OptLevel == CompilerDriver::LINKING) + OutputFilename = "a.out"; + else + throw "An output file must be specified. Please use the -o option"; - // Default the output file, only if we're going to try to link - if (OutputFilename.empty() && OptLevel == CompilerDriver::LINKING) - OutputFilename = "a.out"; // Construct the ConfigDataProvider object LLVMC_ConfigDataProvider Provider; @@ -283,15 +286,15 @@ int main(int argc, char **argv) { // Tell the driver to do its thing int result = CD.execute(InpList,OutputFilename); if (result != 0) { - std::cerr << argv[0] << ": Error executing actions. Terminated.\n"; + throw "Error executing actions. Terminated.\n"; return result; } // All is good, return success return 0; } catch (std::string& msg) { - std::cerr << msg << "\n"; + std::cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << "Unexpected unknown exception occurred.\n"; + std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } }