llvm.org GIT mirror llvm / dd5af27
keep only the StringRef version of getFileOrSTDIN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184826 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 7 years ago
9 changed file(s) with 10 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
118118 static error_code getFileOrSTDIN(StringRef Filename,
119119 OwningPtr &result,
120120 int64_t FileSize = -1);
121 static error_code getFileOrSTDIN(const char *Filename,
122 OwningPtr &result,
123 int64_t FileSize = -1);
124
125
121
126122 //===--------------------------------------------------------------------===//
127123 // Provided for performance analysis.
128124 //===--------------------------------------------------------------------===//
4242 Module *llvm::ParseAssemblyFile(const std::string &Filename, SMDiagnostic &Err,
4343 LLVMContext &Context) {
4444 OwningPtr File;
45 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), File)) {
45 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, File)) {
4646 Err = SMDiagnostic(Filename, SourceMgr::DK_Error,
4747 "Could not open input file: " + ec.message());
4848 return 0;
4747 Module *llvm::getLazyIRFileModule(const std::string &Filename, SMDiagnostic &Err,
4848 LLVMContext &Context) {
4949 OwningPtr File;
50 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), File)) {
50 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, File)) {
5151 Err = SMDiagnostic(Filename, SourceMgr::DK_Error,
5252 "Could not open input file: " + ec.message());
5353 return 0;
7878 Module *llvm::ParseIRFile(const std::string &Filename, SMDiagnostic &Err,
7979 LLVMContext &Context) {
8080 OwningPtr File;
81 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), File)) {
81 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, File)) {
8282 Err = SMDiagnostic(Filename, SourceMgr::DK_Error,
8383 "Could not open input file: " + ec.message());
8484 return 0;
172172 return getFile(Filename, result, FileSize);
173173 }
174174
175 error_code MemoryBuffer::getFileOrSTDIN(const char *Filename,
176 OwningPtr &result,
177 int64_t FileSize) {
178 if (strcmp(Filename, "-") == 0)
179 return getSTDIN(result);
180 return getFile(Filename, result, FileSize);
181 }
182
183175 //===----------------------------------------------------------------------===//
184176 // MemoryBuffer::getFile implementation.
185177 //===----------------------------------------------------------------------===//
8282 // Parse the input file.
8383 OwningPtr File;
8484 if (error_code ec =
85 MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), File)) {
85 MemoryBuffer::getFileOrSTDIN(InputFilename, File)) {
8686 errs() << "Could not open input file '" << InputFilename << "': "
8787 << ec.message() <<"\n";
8888 return 1;
480480 OwningPtr MemBuf;
481481
482482 if (error_code ec =
483 MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), MemBuf))
483 MemoryBuffer::getFileOrSTDIN(InputFilename, MemBuf))
484484 return Error("Error reading '" + InputFilename + "': " + ec.message());
485485
486486 if (MemBuf->getBufferSize() & 3)
294294 // get the sections and supply it to the section name parsing machinery.
295295 if (!DSYMFile.empty()) {
296296 OwningPtr Buf;
297 if (error_code ec = MemoryBuffer::getFileOrSTDIN(DSYMFile.c_str(), Buf)) {
297 if (error_code ec = MemoryBuffer::getFileOrSTDIN(DSYMFile, Buf)) {
298298 errs() << "llvm-objdump: " << Filename << ": " << ec.message() << '\n';
299299 return;
300300 }
666666 std::vector &CheckStrings) {
667667 OwningPtr File;
668668 if (error_code ec =
669 MemoryBuffer::getFileOrSTDIN(CheckFilename.c_str(), File)) {
669 MemoryBuffer::getFileOrSTDIN(CheckFilename, File)) {
670670 errs() << "Could not open check file '" << CheckFilename << "': "
671671 << ec.message() << '\n';
672672 return true;
10141014 // Open the file to check and add it to SourceMgr.
10151015 OwningPtr File;
10161016 if (error_code ec =
1017 MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), File)) {
1017 MemoryBuffer::getFileOrSTDIN(InputFilename, File)) {
10181018 errs() << "Could not open input file '" << InputFilename << "': "
10191019 << ec.message() << '\n';
10201020 return 2;
4444
4545 // Get the input data.
4646 OwningPtr In;
47 if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), In)) {
47 if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, In)) {
4848 errs() << argv[0] << ": error: Unable to get input '"
4949 << InputFilename << "': " << ec.message() << '\n';
5050 return 1;