OLD | NEW |
1 //===- subzero/src/IceCompileServer.cpp - Compile server ------------------===// | 1 //===- subzero/src/IceCompileServer.cpp - Compile server ------------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Note: This code is (mostly) copied from llvm/lib/Support/ErrorHandling.cpp | 103 // Note: This code is (mostly) copied from llvm/lib/Support/ErrorHandling.cpp |
104 | 104 |
105 // Blast the result out to stderr. We don't try hard to make sure this | 105 // Blast the result out to stderr. We don't try hard to make sure this |
106 // succeeds (e.g. handling EINTR) and we can't use errs() here because | 106 // succeeds (e.g. handling EINTR) and we can't use errs() here because |
107 // raw ostreams can call report_fatal_error. | 107 // raw ostreams can call report_fatal_error. |
108 llvm::SmallVector<char, 64> Buffer; | 108 llvm::SmallVector<char, 64> Buffer; |
109 llvm::raw_svector_ostream OS(Buffer); | 109 llvm::raw_svector_ostream OS(Buffer); |
110 OS << "LLVM ERROR: " << Reason << "\n"; | 110 OS << "LLVM ERROR: " << Reason << "\n"; |
111 llvm::StringRef MessageStr = OS.str(); | 111 llvm::StringRef MessageStr = OS.str(); |
112 ssize_t written = | 112 ssize_t Written = |
113 ::fwrite(MessageStr.data(), sizeof(char), MessageStr.size(), ::stdout); | 113 std::fwrite(MessageStr.data(), sizeof(char), MessageStr.size(), stderr); |
114 (void)written; // If something went wrong, we deliberately just give up. | 114 (void)Written; // If something went wrong, we deliberately just give up. |
115 | 115 |
116 // If we reached here, we are failing ungracefully. Run the interrupt handlers | 116 // If we reached here, we are failing ungracefully. Run the interrupt handlers |
117 // to make sure any special cleanups get done, in particular that we remove | 117 // to make sure any special cleanups get done, in particular that we remove |
118 // files registered with RemoveFileOnSignal. | 118 // files registered with RemoveFileOnSignal. |
119 llvm::sys::RunInterruptHandlers(); | 119 llvm::sys::RunInterruptHandlers(); |
120 | 120 |
121 exit(0); | 121 exit(0); |
122 } | 122 } |
123 | 123 |
124 } // end of anonymous namespace | 124 } // end of anonymous namespace |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 }); | 201 }); |
202 CompileThread.join(); | 202 CompileThread.join(); |
203 } else { | 203 } else { |
204 getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream)); | 204 getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream)); |
205 } | 205 } |
206 transferErrorCode(getReturnValue( | 206 transferErrorCode(getReturnValue( |
207 ExtraFlags, static_cast<ErrorCodes>(Ctx->getErrorStatus()->value()))); | 207 ExtraFlags, static_cast<ErrorCodes>(Ctx->getErrorStatus()->value()))); |
208 } | 208 } |
209 | 209 |
210 } // end of namespace Ice | 210 } // end of namespace Ice |
OLD | NEW |