[llvm-commits] [llvm] r104875 - /llvm/trunk/tools/opt/opt.cpp
Dan Gohman
gohman at apple.com
Thu May 27 12:52:20 PDT 2010
Author: djg
Date: Thu May 27 14:52:20 2010
New Revision: 104875
URL: http://llvm.org/viewvc/llvm-project?rev=104875&view=rev
Log:
Don't create an output stream when output is disabled.
Modified:
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=104875&r1=104874&r2=104875&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Thu May 27 14:52:20 2010
@@ -379,26 +379,28 @@
// Figure out what stream we are supposed to write to...
// FIXME: outs() is not binary!
raw_ostream *Out = 0;
- bool DeleteStream = true;
- if (OutputFilename == "-") {
- Out = &outs(); // Default to printing to stdout...
- DeleteStream = false;
- } else {
- if (NoOutput || AnalyzeOnly) {
- errs() << "WARNING: The -o (output filename) option is ignored when\n"
- "the --disable-output or --analyze options are used.\n";
+ bool DeleteStream = false;
+ if (!NoOutput && !AnalyzeOnly) {
+ if (OutputFilename == "-") {
+ Out = &outs(); // Default to printing to stdout...
} else {
- // Make sure that the Output file gets unlinked from the disk if we get a
- // SIGINT
- sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
- std::string ErrorInfo;
- Out = new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
- raw_fd_ostream::F_Binary);
- if (!ErrorInfo.empty()) {
- errs() << ErrorInfo << '\n';
- delete Out;
- return 1;
+ if (NoOutput || AnalyzeOnly) {
+ errs() << "WARNING: The -o (output filename) option is ignored when\n"
+ "the --disable-output or --analyze options are used.\n";
+ } else {
+ // Make sure that the Output file gets unlinked from the disk if we get
+ // a SIGINT.
+ sys::RemoveFileOnSignal(sys::Path(OutputFilename));
+
+ std::string ErrorInfo;
+ Out = new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
+ raw_fd_ostream::F_Binary);
+ if (!ErrorInfo.empty()) {
+ errs() << ErrorInfo << '\n';
+ delete Out;
+ return 1;
+ }
+ DeleteStream = true;
}
}
}
More information about the llvm-commits
mailing list