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

Side by Side Diff: src/IceCompileServer.h

Issue 1494753003: cleanup main (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: else clause no longer needed Created 5 years 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/IceBuildDefs.h ('k') | src/main.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.h - Compile server ----------*- C++ -*-===// 1 //===- subzero/src/IceCompileServer.h - Compile server ----------*- C++ -*-===//
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 23 matching lines...) Expand all
34 /// (which has the output stream), and a set of arguments. The CompileServer 34 /// (which has the output stream), and a set of arguments. The CompileServer
35 /// takes over the current thread to listen to requests, and compile requests 35 /// takes over the current thread to listen to requests, and compile requests
36 /// are handled on separate threads. 36 /// are handled on separate threads.
37 /// 37 ///
38 /// Currently, this only handles a single request. 38 /// Currently, this only handles a single request.
39 /// 39 ///
40 /// When run on the commandline, it receives and therefore dispatches the 40 /// When run on the commandline, it receives and therefore dispatches the
41 /// request immediately. When run in the browser, it blocks waiting for a 41 /// request immediately. When run in the browser, it blocks waiting for a
42 /// request. 42 /// request.
43 class CompileServer { 43 class CompileServer {
44 CompileServer() = delete;
45 CompileServer(const CompileServer &) = delete; 44 CompileServer(const CompileServer &) = delete;
46 CompileServer &operator=(const CompileServer &) = delete; 45 CompileServer &operator=(const CompileServer &) = delete;
47 46
48 public: 47 public:
49 explicit CompileServer(Compiler &Comp) : Comp(Comp) {} 48 CompileServer() = default;
50 49
51 virtual ~CompileServer() = default; 50 virtual ~CompileServer() = default;
52 51
53 virtual void run() = 0; 52 virtual void run() = 0;
54 53
55 virtual ErrorCode &getErrorCode() { return LastError; } 54 virtual ErrorCode &getErrorCode() { return LastError; }
56 void transferErrorCode(ErrorCodes Code) { LastError.assign(Code); } 55 void transferErrorCode(ErrorCodes Code) { LastError.assign(Code); }
57 56
57 int runAndReturnErrorCode() {
58 run();
59 return getErrorCode().value();
60 }
61
58 protected: 62 protected:
59 Compiler &getCompiler() const { return Comp; } 63 Compiler &getCompiler() { return Comp; }
60 64
61 Compiler &Comp; 65 Compiler Comp;
62 ErrorCode LastError; 66 ErrorCode LastError;
63 }; 67 };
64 68
65 /// Commandline variant of the compile server. 69 /// Commandline variant of the compile server.
66 class CLCompileServer : public CompileServer { 70 class CLCompileServer : public CompileServer {
67 CLCompileServer() = delete; 71 CLCompileServer() = delete;
68 CLCompileServer(const CLCompileServer &) = delete; 72 CLCompileServer(const CLCompileServer &) = delete;
69 CLCompileServer &operator=(const CLCompileServer &) = delete; 73 CLCompileServer &operator=(const CLCompileServer &) = delete;
70 74
71 public: 75 public:
72 CLCompileServer(Compiler &Comp, int argc, char **argv) 76 CLCompileServer(int argc, char **argv) : argc(argc), argv(argv) {}
73 : CompileServer(Comp), argc(argc), argv(argv) {}
74 77
75 ~CLCompileServer() final = default; 78 ~CLCompileServer() final = default;
76 79
77 void run() final; 80 void run() final;
78 81
79 private: 82 private:
80 int argc; 83 int argc;
81 char **argv; 84 char **argv;
82 std::unique_ptr<GlobalContext> Ctx; 85 std::unique_ptr<GlobalContext> Ctx;
83 }; 86 };
84 87
85 } // end of namespace Ice 88 } // end of namespace Ice
86 89
87 #endif // SUBZERO_SRC_ICECOMPILESERVER_H 90 #endif // SUBZERO_SRC_ICECOMPILESERVER_H
OLDNEW
« no previous file with comments | « src/IceBuildDefs.h ('k') | src/main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698