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 // This file declares the browser-specific compile server. | 10 // This file declares the browser-specific compile server. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 LastError.assign(Ctx->getErrorStatus()->value()); | 68 LastError.assign(Ctx->getErrorStatus()->value()); |
69 // Reset some state. The InputStream is deleted by the compiler | 69 // Reset some state. The InputStream is deleted by the compiler |
70 // so only reset this to nullptr. Free and flush the rest | 70 // so only reset this to nullptr. Free and flush the rest |
71 // of the streams. | 71 // of the streams. |
72 InputStream = nullptr; | 72 InputStream = nullptr; |
73 EmitStream.reset(nullptr); | 73 EmitStream.reset(nullptr); |
74 ELFStream.reset(nullptr); | 74 ELFStream.reset(nullptr); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 class StringStream { | |
79 public: | |
80 StringStream() : StrBuf(Buffer) {} | |
81 std::string getContents() { return StrBuf.str(); } | |
jvoung (off chromium)
2015/04/20 21:41:57
Might be able to return a reference to the string
Karl
2015/04/22 22:23:50
Done.
| |
82 Ostream &getStream() { return StrBuf; } | |
83 private: | |
84 std::string Buffer; | |
85 llvm::raw_string_ostream StrBuf; | |
86 }; | |
87 | |
78 // This currently only handles a single compile request, hence one copy | 88 // This currently only handles a single compile request, hence one copy |
79 // of the state. | 89 // of the state. |
80 std::unique_ptr<GlobalContext> Ctx; | 90 std::unique_ptr<GlobalContext> Ctx; |
81 // A borrowed reference to the current InputStream. The compiler owns | 91 // A borrowed reference to the current InputStream. The compiler owns |
82 // the actual reference so the server must be careful not to access | 92 // the actual reference so the server must be careful not to access |
83 // after the compiler is done. | 93 // after the compiler is done. |
84 llvm::QueueStreamer *InputStream; | 94 llvm::QueueStreamer *InputStream; |
85 std::unique_ptr<Ostream> LogStream; | 95 std::unique_ptr<Ostream> LogStream; |
86 std::unique_ptr<llvm::raw_fd_ostream> EmitStream; | 96 std::unique_ptr<llvm::raw_fd_ostream> EmitStream; |
97 std::unique_ptr<StringStream> ErrorStream; | |
87 std::unique_ptr<ELFStreamer> ELFStream; | 98 std::unique_ptr<ELFStreamer> ELFStream; |
88 ClFlags Flags; | 99 ClFlags Flags; |
89 ClFlagsExtra ExtraFlags; | 100 ClFlagsExtra ExtraFlags; |
90 std::thread CompileThread; | 101 std::thread CompileThread; |
91 }; | 102 }; |
92 | 103 |
93 } // end of namespace Ice | 104 } // end of namespace Ice |
94 | 105 |
95 #endif // SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H | 106 #endif // SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H |
OLD | NEW |