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 |