Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: src/IceCompileServer.cpp

Issue 1848303003: Simplify references to command line flags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceClFlags.cpp ('k') | src/IceCompiler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 std::error_code &EC) { 89 std::error_code &EC) {
90 if (Filename == "-") { 90 if (Filename == "-") {
91 return std::unique_ptr<Ostream>(new llvm::raw_os_ostream(std::cout)); 91 return std::unique_ptr<Ostream>(new llvm::raw_os_ostream(std::cout));
92 } else { 92 } else {
93 return std::unique_ptr<Ostream>( 93 return std::unique_ptr<Ostream>(
94 new llvm::raw_fd_ostream(Filename, EC, llvm::sys::fs::F_None)); 94 new llvm::raw_fd_ostream(Filename, EC, llvm::sys::fs::F_None));
95 } 95 }
96 } 96 }
97 97
98 ErrorCodes getReturnValue(ErrorCodes Val) { 98 ErrorCodes getReturnValue(ErrorCodes Val) {
99 if (GlobalContext::Flags.getAlwaysExitSuccess()) 99 if (getFlags().getAlwaysExitSuccess())
100 return EC_None; 100 return EC_None;
101 return Val; 101 return Val;
102 } 102 }
103 103
104 // Reports fatal error message, and then exits with success status 0. 104 // Reports fatal error message, and then exits with success status 0.
105 void reportFatalErrorThenExitSuccess(void *UserData, const std::string &Reason, 105 void reportFatalErrorThenExitSuccess(void *UserData, const std::string &Reason,
106 bool GenCrashDag) { 106 bool GenCrashDag) {
107 (void)UserData; 107 (void)UserData;
108 (void)GenCrashDag; 108 (void)GenCrashDag;
109 109
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 } 153 }
154 154
155 } // end of anonymous namespace 155 } // end of anonymous namespace
156 156
157 void CLCompileServer::run() { 157 void CLCompileServer::run() {
158 if (BuildDefs::dump()) { 158 if (BuildDefs::dump()) {
159 llvm::sys::PrintStackTraceOnErrorSignal(); 159 llvm::sys::PrintStackTraceOnErrorSignal();
160 } 160 }
161 ClFlags::parseFlags(argc, argv); 161 ClFlags::parseFlags(argc, argv);
162 ClFlags &Flags = GlobalContext::Flags; 162 ClFlags &Flags = ClFlags::Flags;
163 ClFlags::getParsedClFlags(Flags); 163 ClFlags::getParsedClFlags(Flags);
164 164
165 // Override report_fatal_error if we want to exit with 0 status. 165 // Override report_fatal_error if we want to exit with 0 status.
166 if (Flags.getAlwaysExitSuccess()) 166 if (Flags.getAlwaysExitSuccess())
167 llvm::install_fatal_error_handler(reportFatalErrorThenExitSuccess, this); 167 llvm::install_fatal_error_handler(reportFatalErrorThenExitSuccess, this);
168 168
169 std::error_code EC; 169 std::error_code EC;
170 std::unique_ptr<Ostream> Ls = makeStream(Flags.getLogFilename(), EC); 170 std::unique_ptr<Ostream> Ls = makeStream(Flags.getLogFilename(), EC);
171 if (EC) { 171 if (EC) {
172 llvm::report_fatal_error("Unable to open log file"); 172 llvm::report_fatal_error("Unable to open log file");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 Err.print(Flags.getAppName().c_str(), *Ls); 222 Err.print(Flags.getAppName().c_str(), *Ls);
223 return transferErrorCode(getReturnValue(Ice::EC_Bitcode)); 223 return transferErrorCode(getReturnValue(Ice::EC_Bitcode));
224 } 224 }
225 225
226 if (Flags.getGenerateBuildAtts()) { 226 if (Flags.getGenerateBuildAtts()) {
227 dumpBuildAttributes(*Os.get()); 227 dumpBuildAttributes(*Os.get());
228 return transferErrorCode(getReturnValue(Ice::EC_None)); 228 return transferErrorCode(getReturnValue(Ice::EC_None));
229 } 229 }
230 230
231 Ctx.reset(new GlobalContext(Ls.get(), Os.get(), Ls.get(), ELFStr.get())); 231 Ctx.reset(new GlobalContext(Ls.get(), Os.get(), Ls.get(), ELFStr.get()));
232 if (Ctx->getFlags().getNumTranslationThreads() != 0) { 232 if (getFlags().getNumTranslationThreads() != 0) {
233 std::thread CompileThread([this, &Flags, &InputStream]() { 233 std::thread CompileThread([this, &Flags, &InputStream]() {
234 Ctx->initParserThread(); 234 Ctx->initParserThread();
235 getCompiler().run(Flags, *Ctx.get(), std::move(InputStream)); 235 getCompiler().run(Flags, *Ctx.get(), std::move(InputStream));
236 }); 236 });
237 CompileThread.join(); 237 CompileThread.join();
238 } else { 238 } else {
239 getCompiler().run(Flags, *Ctx.get(), std::move(InputStream)); 239 getCompiler().run(Flags, *Ctx.get(), std::move(InputStream));
240 } 240 }
241 transferErrorCode( 241 transferErrorCode(
242 getReturnValue(static_cast<ErrorCodes>(Ctx->getErrorStatus()->value()))); 242 getReturnValue(static_cast<ErrorCodes>(Ctx->getErrorStatus()->value())));
243 Ctx->dumpConstantLookupCounts(); 243 Ctx->dumpConstantLookupCounts();
244 Ctx->dumpStrings(); 244 Ctx->dumpStrings();
245 } 245 }
246 246
247 } // end of namespace Ice 247 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceClFlags.cpp ('k') | src/IceCompiler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698