llvm.org GIT mirror llvm / e96eec0
Add a helper that either opens a file or stdin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36835 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
1 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
7575 /// getSTDIN - Read all of stdin into a file buffer, and return it. This
7676 /// fails if stdin is empty.
7777 static MemoryBuffer *getSTDIN();
78
79
80 /// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
81 /// if the Filename is "-".
82 static MemoryBuffer *getFileOrSTDIN(const char *FilenameStart,unsigned FnSize,
83 int64_t FileSize = -1) {
84 if (FnSize == 1 && FilenameStart[0] == '-')
85 return getSTDIN();
86 return getFile(FilenameStart, FnSize, FileSize);
87 }
88
7889 };
7990
8091 } // end namespace llvm