llvm.org GIT mirror llvm / ed3e8b4
Don't silently ignore errors when opening output streams. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55120 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
2 changed file(s) with 12 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
124124 sys::RemoveFileOnSignal(sys::Path(OutputFilename));
125125
126126 std::string error;
127 return new raw_fd_ostream(OutputFilename.c_str(), error);
127 raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), error);
128 if (!error.empty()) {
129 std::cerr << error << '\n';
130 delete Out;
131 return 0;
132 }
133
134 return Out;
128135 }
129136
130137 if (InputFilename == "-") {
169176 std::string error;
170177 raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), error);
171178 if (!error.empty()) {
172 std::cerr << error;
179 std::cerr << error << '\n';
173180 delete Out;
174181 return 0;
175182 }
162162 sys::RemoveFileOnSignal(uniqueAsmPath);
163163
164164 // generate assembly code
165 std::string error;
166165 bool genResult = false;
167166 {
168 raw_fd_ostream asmFile(uniqueAsmPath.c_str(), error);
167 raw_fd_ostream asmFile(uniqueAsmPath.c_str(), errMsg);
168 if (!errMsg.empty())
169 return NULL;
169170 genResult = this->generateAssemblyCode(asmFile, errMsg);
170171 }
171172 if ( genResult ) {