- Unify format of output messages

- All errors throw std::string
- Default output file name to a.out (if we're linking)

llvm-svn: 16025
This commit is contained in:
Reid Spencer 2004-08-24 14:05:30 +00:00
parent 5b902eba71
commit a86672b929
1 changed files with 10 additions and 7 deletions

View 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";
}
}