OLD | NEW |
(Empty) | |
| 1 //===- subzero/src/IceCompileServer.cpp - Compile server ------------------===// |
| 2 // |
| 3 // The Subzero Code Generator |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 // |
| 10 // This file defines the basic commandline-based compile server. |
| 11 // |
| 12 //===----------------------------------------------------------------------===// |
| 13 |
| 14 #include "IceCompileServer.h" |
| 15 |
| 16 #include <thread> |
| 17 |
| 18 #include "llvm/Support/FileSystem.h" |
| 19 #include "llvm/Support/raw_os_ostream.h" |
| 20 #include "llvm/Support/StreamingMemoryObject.h" |
| 21 |
| 22 namespace Ice { |
| 23 |
| 24 // Command-line variant. |
| 25 |
| 26 void CLCompileServer::run() { |
| 27 std::thread CompileThread([this]() { getCompiler().run(argc, argv, *this); }); |
| 28 CompileThread.join(); |
| 29 } |
| 30 |
| 31 std::unique_ptr<llvm::DataStreamer> |
| 32 CLCompileServer::getInputStream(const IceString &InputFilename, |
| 33 std::string &ErrorString) { |
| 34 std::unique_ptr<llvm::DataStreamer> Result( |
| 35 llvm::getDataFileStreamer(InputFilename, &ErrorString)); |
| 36 return std::move(Result); |
| 37 } |
| 38 |
| 39 std::unique_ptr<llvm::raw_fd_ostream> |
| 40 CLCompileServer::getOutputStream(const IceString &OutputFilename, |
| 41 std::error_code &EC) { |
| 42 std::unique_ptr<llvm::raw_fd_ostream> Result( |
| 43 new llvm::raw_fd_ostream(OutputFilename, EC, llvm::sys::fs::F_None)); |
| 44 return std::move(Result); |
| 45 } |
| 46 |
| 47 } // end of namespace Ice |
OLD | NEW |