summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-18 18:46:08 +0000
committerChris Lattner <sabre@nondot.org>2003-06-18 18:46:08 +0000
commit422de25579d1f4b87a06c609eaa1130827eb65f4 (patch)
tree60d0f53d82ecdbd9a4d23c3fd9ab5f26dc0d338c
parenta436926e24ca50ae9a6800270fbcc879c82761f6 (diff)
downloadbcm5719-llvm-422de25579d1f4b87a06c609eaa1130827eb65f4.tar.gz
bcm5719-llvm-422de25579d1f4b87a06c609eaa1130827eb65f4.zip
Reindent code to match the rest of the file
llvm-svn: 6772
-rw-r--r--llvm/tools/llc/llc.cpp68
1 files changed, 30 insertions, 38 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 485b25ef532..3bd35f1f746 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -134,8 +134,28 @@ main(int argc, char **argv)
// Figure out where we are going to send the output...
std::ostream *Out = 0;
- if (OutputFilename != "")
- { // Specified an output filename?
+ 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!
+ std::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());
+
+ // Make sure that the Out file gets unlink'd from the disk if we get a
+ // SIGINT
+ RemoveFileOnSignal(OutputFilename);
+ } else {
+ if (InputFilename == "-") {
+ OutputFilename = "-";
+ Out = &std::cout;
+ } else {
+ std::string OutputFilename = GetFileNameRoot(InputFilename);
+ OutputFilename += ".s";
+
if (!Force && std::ifstream(OutputFilename.c_str())) {
// If force is not specified, make sure not to overwrite a file!
std::cerr << argv[0] << ": error opening '" << OutputFilename
@@ -143,47 +163,19 @@ main(int argc, char **argv)
<< "Use -f command line argument to force output\n";
return 1;
}
+
Out = new std::ofstream(OutputFilename.c_str());
-
+ if (!Out->good()) {
+ std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
+ delete Out;
+ return 1;
+ }
+
// Make sure that the Out file gets unlink'd from the disk if we get a
// SIGINT
RemoveFileOnSignal(OutputFilename);
}
- else
- {
- if (InputFilename == "-")
- {
- OutputFilename = "-";
- Out = &std::cout;
- }
- else
- {
- std::string OutputFilename = GetFileNameRoot(InputFilename);
- OutputFilename += ".s";
-
- if (!Force && std::ifstream(OutputFilename.c_str()))
- {
- // If force is not specified, make sure not to overwrite a file!
- std::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())
- {
- std::cerr << argv[0] << ": error opening " << OutputFilename
- << "!\n";
- delete Out;
- return 1;
- }
-
- // Make sure that the Out file gets unlink'd from the disk if we get a
- // SIGINT
- RemoveFileOnSignal(OutputFilename);
- }
- }
+ }
// Ask the target to add backend passes as neccesary
if (Target.addPassesToEmitAssembly(Passes, *Out)) {
OpenPOWER on IntegriCloud