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

Unified Diff: src/IceCompileServer.cpp

Issue 997773002: Refactor Subzero initialization and add a browser callback handler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: remember to EOF Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: src/IceCompileServer.cpp
diff --git a/src/IceCompileServer.cpp b/src/IceCompileServer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..bfd735bbdb30c4792532e6e10a1923f90a5a785f
--- /dev/null
+++ b/src/IceCompileServer.cpp
@@ -0,0 +1,47 @@
+//===- subzero/src/IceCompileServer.cpp - Compile server ------------------===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the basic commandline-based compile server.
+//
+//===----------------------------------------------------------------------===//
+
+#include "IceCompileServer.h"
Jim Stichnoth 2015/03/13 04:55:00 Move this after the llvm/ includes?
jvoung (off chromium) 2015/03/18 15:39:09 Done.
+
+#include <thread>
+
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/raw_os_ostream.h"
+#include "llvm/Support/StreamingMemoryObject.h"
+
+namespace Ice {
+
+// Command-line variant.
+
+void CLCompileServer::run() {
+ std::thread CompileThread([this]() { getCompiler().run(argc, argv, *this); });
+ CompileThread.join();
+}
+
+std::unique_ptr<llvm::DataStreamer>
+CLCompileServer::getInputStream(const IceString &InputFilename,
+ std::string &ErrorString) {
+ std::unique_ptr<llvm::DataStreamer> Result(
+ llvm::getDataFileStreamer(InputFilename, &ErrorString));
+ return std::move(Result);
+}
+
+std::unique_ptr<llvm::raw_fd_ostream>
+CLCompileServer::getOutputStream(const IceString &OutputFilename,
+ std::error_code &EC) {
+ std::unique_ptr<llvm::raw_fd_ostream> Result(
+ new llvm::raw_fd_ostream(OutputFilename, EC, llvm::sys::fs::F_None));
+ return std::move(Result);
+}
+
+} // end of namespace Ice

Powered by Google App Engine
This is Rietveld 408576698