OLD | NEW |
1 //===- subzero/src/IceBrowserCompileServer.h - Browser server ---*- C++ -*-===// | 1 //===- subzero/src/IceBrowserCompileServer.h - Browser 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 LastError.assign(Ctx->getErrorStatus()->value()); | 70 LastError.assign(Ctx->getErrorStatus()->value()); |
71 // Reset some state. The InputStream is deleted by the compiler so only | 71 // Reset some state. The InputStream is deleted by the compiler so only |
72 // reset this to nullptr. Free and flush the rest of the streams. | 72 // reset this to nullptr. Free and flush the rest of the streams. |
73 InputStream = nullptr; | 73 InputStream = nullptr; |
74 EmitStream.reset(nullptr); | 74 EmitStream.reset(nullptr); |
75 ELFStream.reset(nullptr); | 75 ELFStream.reset(nullptr); |
76 } | 76 } |
77 | 77 |
78 StringStream &getErrorStream() { return *ErrorStream; } | 78 StringStream &getErrorStream() { return *ErrorStream; } |
79 | 79 |
80 void setFatalError(const IceString &Reason); | 80 void setFatalError(const std::string &Reason); |
81 | 81 |
82 private: | 82 private: |
83 class StringStream { | 83 class StringStream { |
84 public: | 84 public: |
85 StringStream() : StrBuf(Buffer) {} | 85 StringStream() : StrBuf(Buffer) {} |
86 const IceString &getContents() { return StrBuf.str(); } | 86 const std::string &getContents() { return StrBuf.str(); } |
87 Ostream &getStream() { return StrBuf; } | 87 Ostream &getStream() { return StrBuf; } |
88 | 88 |
89 private: | 89 private: |
90 std::string Buffer; | 90 std::string Buffer; |
91 llvm::raw_string_ostream StrBuf; | 91 llvm::raw_string_ostream StrBuf; |
92 }; | 92 }; |
93 /// This currently only handles a single compile request, hence one copy of | 93 /// This currently only handles a single compile request, hence one copy of |
94 /// the state. | 94 /// the state. |
95 std::unique_ptr<GlobalContext> Ctx; | 95 std::unique_ptr<GlobalContext> Ctx; |
96 /// A borrowed reference to the current InputStream. The compiler owns the | 96 /// A borrowed reference to the current InputStream. The compiler owns the |
97 /// actual reference so the server must be careful not to access after the | 97 /// actual reference so the server must be careful not to access after the |
98 /// compiler is done. | 98 /// compiler is done. |
99 llvm::QueueStreamer *InputStream = nullptr; | 99 llvm::QueueStreamer *InputStream = nullptr; |
100 std::unique_ptr<Ostream> LogStream; | 100 std::unique_ptr<Ostream> LogStream; |
101 std::unique_ptr<llvm::raw_fd_ostream> EmitStream; | 101 std::unique_ptr<llvm::raw_fd_ostream> EmitStream; |
102 std::unique_ptr<StringStream> ErrorStream; | 102 std::unique_ptr<StringStream> ErrorStream; |
103 std::unique_ptr<ELFStreamer> ELFStream; | 103 std::unique_ptr<ELFStreamer> ELFStream; |
104 ClFlags *Flags; | 104 ClFlags *Flags; |
105 std::thread CompileThread; | 105 std::thread CompileThread; |
106 std::atomic<bool> HadError; | 106 std::atomic<bool> HadError; |
107 }; | 107 }; |
108 | 108 |
109 } // end of namespace Ice | 109 } // end of namespace Ice |
110 | 110 |
111 #endif // SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H | 111 #endif // SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H |
OLD | NEW |