From f3c740eb2c29c6767e3e06e1f84f7c3e40e12a5f Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 22 Sep 2009 05:38:01 +0000 Subject: [PATCH] Allow PCH files to be read from stdin. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82525 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/PCHReader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index e85f58b0e9..c493e39776 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1388,8 +1388,13 @@ PCHReader::PCHReadResult PCHReader::ReadPCH(const std::string &FileName) { this->FileName = FileName; // Open the PCH file. + // + // FIXME: This shouldn't be here, we should just take a raw_ostream. std::string ErrStr; - Buffer.reset(llvm::MemoryBuffer::getFile(FileName.c_str(), &ErrStr)); + if (FileName == "-") + Buffer.reset(llvm::MemoryBuffer::getSTDIN()); + else + Buffer.reset(llvm::MemoryBuffer::getFile(FileName.c_str(), &ErrStr)); if (!Buffer) { Error(ErrStr.c_str()); return IgnorePCH;