Index: src/IceCompileServer.cpp |
diff --git a/src/IceCompileServer.cpp b/src/IceCompileServer.cpp |
index e700b1ee125674aecefa28ac0db77bbe87479675..e93f47daa50f93bf08f00e0b3747ba2df92d5e55 100644 |
--- a/src/IceCompileServer.cpp |
+++ b/src/IceCompileServer.cpp |
@@ -50,8 +50,12 @@ class TextDataStreamer : public llvm::DataStreamer { |
public: |
TextDataStreamer() = default; |
~TextDataStreamer() final = default; |
- static TextDataStreamer *create(const std::string &Filename, |
- std::string *Err); |
+#ifdef PNACL_LLVM |
+ using CreateType = TextDataStreamer *; |
+#else // !PNACL_LLVM |
+ using CreateType = std::unique_ptr<TextDataStreamer>; |
+#endif // !PNACL_LLVM |
+ static CreateType create(const std::string &Filename, std::string *Err); |
size_t GetBytes(unsigned char *Buf, size_t Len) final; |
private: |
@@ -59,8 +63,9 @@ private: |
size_t Cursor = 0; |
}; |
-TextDataStreamer *TextDataStreamer::create(const std::string &Filename, |
- std::string *Err) { |
+TextDataStreamer::CreateType |
+TextDataStreamer::create(const std::string &Filename, std::string *Err) { |
+#ifdef PNACL_LLVM |
TextDataStreamer *Streamer = new TextDataStreamer(); |
llvm::raw_string_ostream ErrStrm(*Err); |
if (std::error_code EC = llvm::readNaClRecordTextAndBuildBitcode( |
@@ -72,6 +77,9 @@ TextDataStreamer *TextDataStreamer::create(const std::string &Filename, |
} |
ErrStrm.flush(); |
return Streamer; |
+#else // !PNACL_LLVM |
+ return CreateType(); |
+#endif // !PNACL_LLVM |
} |
size_t TextDataStreamer::GetBytes(unsigned char *Buf, size_t Len) { |