Print the tool name when an error comes from so that I can tell which
authorChris Lattner <sabre@nondot.org>
Tue, 30 Jul 2002 21:43:25 +0000 (21:43 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 30 Jul 2002 21:43:25 +0000 (21:43 +0000)
tool of a pipeline is having issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3168 91177308-0d34-0410-b5e6-96231b3b80d8

tools/as/as.cpp
tools/gccas/gccas.cpp
tools/link/link.cpp
tools/llvm-as/as.cpp
tools/llvm-as/llvm-as.cpp
tools/llvm-link/llvm-link.cpp
tools/opt/opt.cpp

index 36f845687838cd1fafa77b588b30244157dc8ebb..7593cef4b0f125b21ce197a0866bfef7490c4e76 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc, char **argv) {
     // Parse the file now...
     std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
     if (M.get() == 0) {
-      cerr << "assembly didn't read correctly.\n";
+      cerr << argv[0] << ": assembly didn't read correctly.\n";
       return 1;
     }
   
@@ -49,7 +49,8 @@ int main(int argc, char **argv) {
     if (OutputFilename != "") {   // Specified an output filename?
       if (!Force && std::ifstream(OutputFilename.c_str())) {
         // If force is not specified, make sure not to overwrite a file!
-        cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+        cerr << argv[0] << ": error opening '" << OutputFilename
+             << "': file exists!\n"
              << "Use -f command line argument to force output\n";
         return 1;
       }
@@ -71,7 +72,8 @@ int main(int argc, char **argv) {
 
         if (!Force && std::ifstream(OutputFilename.c_str())) {
           // If force is not specified, make sure not to overwrite a file!
-          cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+          cerr << argv[0] << ": error opening '" << OutputFilename
+               << "': file exists!\n"
                << "Use -f command line argument to force output\n";
           return 1;
         }
@@ -84,13 +86,13 @@ int main(int argc, char **argv) {
     }
   
     if (!Out->good()) {
-      cerr << "Error opening " << OutputFilename << "!\n";
+      cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
       return 1;
     }
    
     WriteBytecodeToFile(M.get(), *Out);
   } catch (const ParseException &E) {
-    cerr << E.getMessage() << std::endl;
+    cerr << argv[0] << ": " << E.getMessage() << "\n";
     return 1;
   }
 
index 974e9e26f4b5375ff4ce59a5ece21b4c90e551c8..13a4a4111e886fc4fd90aa7d15043ff5464bd444 100644 (file)
@@ -102,12 +102,12 @@ int main(int argc, char **argv) {
     // Parse the file now...
     M.reset(ParseAssemblyFile(InputFilename));
   } catch (const ParseException &E) {
-    cerr << E.getMessage() << "\n";
+    cerr << argv[0] << ": " << E.getMessage() << "\n";
     return 1;
   }
 
   if (M.get() == 0) {
-    cerr << "assembly didn't read correctly.\n";
+    cerr << argv[0] << ": assembly didn't read correctly.\n";
     return 1;
   }
   
@@ -124,7 +124,7 @@ int main(int argc, char **argv) {
 
   std::ofstream Out(OutputFilename.c_str(), std::ios::out);
   if (!Out.good()) {
-    cerr << "Error opening " << OutputFilename << "!\n";
+    cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
     return 1;
   }
 
index 7f48cc4b7b129c2e826c3e50d2245c6e7189d7b0..075e7075e8414e526821552ba14adcedbaae6bf8 100644 (file)
@@ -109,7 +109,7 @@ int main(int argc, char **argv) {
     if (Verbose) cerr << "Linking in '" << InputFilenames[i] << "'\n";
 
     if (LinkModules(Composite.get(), M.get(), &ErrorMessage)) {
-      cerr << "Error linking in '" << InputFilenames[i] << "': "
+      cerr << argv[0] << ": error linking in '" << InputFilenames[i] << "': "
           << ErrorMessage << "\n";
       return 1;
     }
@@ -121,13 +121,14 @@ int main(int argc, char **argv) {
   if (OutputFilename != "-") {
     if (!Force && std::ifstream(OutputFilename.c_str())) {
       // If force is not specified, make sure not to overwrite a file!
-      cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+      cerr << argv[0] << ": error opening '" << OutputFilename
+           << "': file exists!\n"
            << "Use -f command line argument to force output\n";
       return 1;
     }
     Out = new std::ofstream(OutputFilename.c_str());
     if (!Out->good()) {
-      cerr << "Error opening '" << OutputFilename << "'!\n";
+      cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
       return 1;
     }
 
index 36f845687838cd1fafa77b588b30244157dc8ebb..7593cef4b0f125b21ce197a0866bfef7490c4e76 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc, char **argv) {
     // Parse the file now...
     std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
     if (M.get() == 0) {
-      cerr << "assembly didn't read correctly.\n";
+      cerr << argv[0] << ": assembly didn't read correctly.\n";
       return 1;
     }
   
@@ -49,7 +49,8 @@ int main(int argc, char **argv) {
     if (OutputFilename != "") {   // Specified an output filename?
       if (!Force && std::ifstream(OutputFilename.c_str())) {
         // If force is not specified, make sure not to overwrite a file!
-        cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+        cerr << argv[0] << ": error opening '" << OutputFilename
+             << "': file exists!\n"
              << "Use -f command line argument to force output\n";
         return 1;
       }
@@ -71,7 +72,8 @@ int main(int argc, char **argv) {
 
         if (!Force && std::ifstream(OutputFilename.c_str())) {
           // If force is not specified, make sure not to overwrite a file!
-          cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+          cerr << argv[0] << ": error opening '" << OutputFilename
+               << "': file exists!\n"
                << "Use -f command line argument to force output\n";
           return 1;
         }
@@ -84,13 +86,13 @@ int main(int argc, char **argv) {
     }
   
     if (!Out->good()) {
-      cerr << "Error opening " << OutputFilename << "!\n";
+      cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
       return 1;
     }
    
     WriteBytecodeToFile(M.get(), *Out);
   } catch (const ParseException &E) {
-    cerr << E.getMessage() << std::endl;
+    cerr << argv[0] << ": " << E.getMessage() << "\n";
     return 1;
   }
 
index 36f845687838cd1fafa77b588b30244157dc8ebb..7593cef4b0f125b21ce197a0866bfef7490c4e76 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc, char **argv) {
     // Parse the file now...
     std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename));
     if (M.get() == 0) {
-      cerr << "assembly didn't read correctly.\n";
+      cerr << argv[0] << ": assembly didn't read correctly.\n";
       return 1;
     }
   
@@ -49,7 +49,8 @@ int main(int argc, char **argv) {
     if (OutputFilename != "") {   // Specified an output filename?
       if (!Force && std::ifstream(OutputFilename.c_str())) {
         // If force is not specified, make sure not to overwrite a file!
-        cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+        cerr << argv[0] << ": error opening '" << OutputFilename
+             << "': file exists!\n"
              << "Use -f command line argument to force output\n";
         return 1;
       }
@@ -71,7 +72,8 @@ int main(int argc, char **argv) {
 
         if (!Force && std::ifstream(OutputFilename.c_str())) {
           // If force is not specified, make sure not to overwrite a file!
-          cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+          cerr << argv[0] << ": error opening '" << OutputFilename
+               << "': file exists!\n"
                << "Use -f command line argument to force output\n";
           return 1;
         }
@@ -84,13 +86,13 @@ int main(int argc, char **argv) {
     }
   
     if (!Out->good()) {
-      cerr << "Error opening " << OutputFilename << "!\n";
+      cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
       return 1;
     }
    
     WriteBytecodeToFile(M.get(), *Out);
   } catch (const ParseException &E) {
-    cerr << E.getMessage() << std::endl;
+    cerr << argv[0] << ": " << E.getMessage() << "\n";
     return 1;
   }
 
index 7f48cc4b7b129c2e826c3e50d2245c6e7189d7b0..075e7075e8414e526821552ba14adcedbaae6bf8 100644 (file)
@@ -109,7 +109,7 @@ int main(int argc, char **argv) {
     if (Verbose) cerr << "Linking in '" << InputFilenames[i] << "'\n";
 
     if (LinkModules(Composite.get(), M.get(), &ErrorMessage)) {
-      cerr << "Error linking in '" << InputFilenames[i] << "': "
+      cerr << argv[0] << ": error linking in '" << InputFilenames[i] << "': "
           << ErrorMessage << "\n";
       return 1;
     }
@@ -121,13 +121,14 @@ int main(int argc, char **argv) {
   if (OutputFilename != "-") {
     if (!Force && std::ifstream(OutputFilename.c_str())) {
       // If force is not specified, make sure not to overwrite a file!
-      cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+      cerr << argv[0] << ": error opening '" << OutputFilename
+           << "': file exists!\n"
            << "Use -f command line argument to force output\n";
       return 1;
     }
     Out = new std::ofstream(OutputFilename.c_str());
     if (!Out->good()) {
-      cerr << "Error opening '" << OutputFilename << "'!\n";
+      cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n";
       return 1;
     }
 
index 463b37c387f7eaec19fdaa8d0b18a5239adcd9fc..6f7343bae3dd876af85645a049535178ae3fad0a 100644 (file)
@@ -1,5 +1,5 @@
 //===----------------------------------------------------------------------===//
-// LLVM 'OPT' UTILITY 
+// LLVM Modular Optimizer Utility: opt
 //
 // Optimizations may be specified an arbitrary number of times on the command
 // line, they are run in the order specified.
@@ -67,7 +67,7 @@ int main(int argc, char **argv) {
   // Load the input module...
   std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename));
   if (M.get() == 0) {
-    cerr << "bytecode didn't read correctly.\n";
+    cerr << argv[0] << ": bytecode didn't read correctly.\n";
     return 1;
   }
 
@@ -76,14 +76,15 @@ int main(int argc, char **argv) {
   if (OutputFilename != "") {
     if (!Force && std::ifstream(OutputFilename.c_str())) {
       // If force is not specified, make sure not to overwrite a file!
-      cerr << "Error opening '" << OutputFilename << "': File exists!\n"
+      cerr << argv[0] << ": error opening '" << OutputFilename
+           << "': file exists!\n"
            << "Use -f command line argument to force output\n";
       return 1;
     }
     Out = new std::ofstream(OutputFilename.c_str());
 
     if (!Out->good()) {
-      cerr << "Error opening " << OutputFilename << "!\n";
+      cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
       return 1;
     }
 
@@ -106,7 +107,7 @@ int main(int argc, char **argv) {
     else if (Opt->getDataCtor())
       Passes.add(Opt->getDataCtor()(TD));  // Pass dummy target data...
     else
-      cerr << "Cannot create pass: " << Opt->getPassName() << "\n";
+      cerr << argv[0] << ": cannot create pass: " << Opt->getPassName() << "\n";
 
     if (PrintEachXForm)
       Passes.add(new PrintModulePass(&cerr));