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 // This file defines the basic commandline-based compile server. | 10 // This file defines the basic commandline-based compile server. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include <fstream> | 14 #include <fstream> |
15 #include <iostream> | 15 #include <iostream> |
16 #include <thread> | 16 #include <thread> |
17 | 17 |
18 #include "llvm/Support/FileSystem.h" | 18 #include "llvm/Support/FileSystem.h" |
19 #include "llvm/Support/raw_os_ostream.h" | 19 #include "llvm/Support/raw_os_ostream.h" |
| 20 #include "llvm/Support/Signals.h" |
20 #include "llvm/Support/SourceMgr.h" | 21 #include "llvm/Support/SourceMgr.h" |
21 #include "llvm/Support/StreamingMemoryObject.h" | 22 #include "llvm/Support/StreamingMemoryObject.h" |
22 | 23 |
23 #include "IceClFlags.h" | 24 #include "IceClFlags.h" |
24 #include "IceClFlagsExtra.h" | 25 #include "IceClFlagsExtra.h" |
25 #include "IceCompileServer.h" | 26 #include "IceCompileServer.h" |
26 #include "IceELFStreamer.h" | 27 #include "IceELFStreamer.h" |
27 #include "IceGlobalContext.h" | 28 #include "IceGlobalContext.h" |
28 | 29 |
29 namespace Ice { | 30 namespace Ice { |
(...skipping 12 matching lines...) Expand all Loading... |
42 | 43 |
43 ErrorCodes getReturnValue(const Ice::ClFlagsExtra &Flags, ErrorCodes Val) { | 44 ErrorCodes getReturnValue(const Ice::ClFlagsExtra &Flags, ErrorCodes Val) { |
44 if (Flags.getAlwaysExitSuccess()) | 45 if (Flags.getAlwaysExitSuccess()) |
45 return EC_None; | 46 return EC_None; |
46 return Val; | 47 return Val; |
47 } | 48 } |
48 | 49 |
49 } // end of anonymous namespace | 50 } // end of anonymous namespace |
50 | 51 |
51 void CLCompileServer::run() { | 52 void CLCompileServer::run() { |
| 53 if (ALLOW_DUMP) { |
| 54 llvm::sys::PrintStackTraceOnErrorSignal(); |
| 55 } |
52 ClFlags::parseFlags(argc, argv); | 56 ClFlags::parseFlags(argc, argv); |
53 ClFlags Flags; | 57 ClFlags Flags; |
54 ClFlagsExtra ExtraFlags; | 58 ClFlagsExtra ExtraFlags; |
55 ClFlags::getParsedClFlags(Flags); | 59 ClFlags::getParsedClFlags(Flags); |
56 ClFlags::getParsedClFlagsExtra(ExtraFlags); | 60 ClFlags::getParsedClFlagsExtra(ExtraFlags); |
57 | 61 |
58 std::error_code EC; | 62 std::error_code EC; |
59 std::unique_ptr<Ostream> Ls = makeStream(ExtraFlags.getLogFilename(), EC); | 63 std::unique_ptr<Ostream> Ls = makeStream(ExtraFlags.getLogFilename(), EC); |
60 if (EC) { | 64 if (EC) { |
61 llvm::report_fatal_error("Unable to open log file"); | 65 llvm::report_fatal_error("Unable to open log file"); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 }); | 117 }); |
114 CompileThread.join(); | 118 CompileThread.join(); |
115 } else { | 119 } else { |
116 getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream)); | 120 getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream)); |
117 } | 121 } |
118 transferErrorCode(getReturnValue( | 122 transferErrorCode(getReturnValue( |
119 ExtraFlags, static_cast<ErrorCodes>(Ctx->getErrorStatus()->value()))); | 123 ExtraFlags, static_cast<ErrorCodes>(Ctx->getErrorStatus()->value()))); |
120 } | 124 } |
121 | 125 |
122 } // end of namespace Ice | 126 } // end of namespace Ice |
OLD | NEW |