Allow PCH files to be read from stdin.

llvm-svn: 82525
This commit is contained in:
Daniel Dunbar 2009-09-22 05:38:01 +00:00
parent b5cbf77c2e
commit 2d925ebd0a
1 changed files with 6 additions and 1 deletions

View File

@ -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;