- Unify format of output messages
authorReid Spencer <rspencer@reidspencer.com>
Tue, 24 Aug 2004 14:05:30 +0000 (14:05 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 24 Aug 2004 14:05:30 +0000 (14:05 +0000)
- 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

index cd7c0ab5d2727078e8d3b88f644f4c66b35024e2..c87c6523f1520308ea0ae6eec1115c0a8fdaccff 100644 (file)
@@ -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";
   }
 }