forked from OSchip/llvm-project
parent
adf21f2a56
commit
43f0aa6caf
|
@ -59,15 +59,15 @@ collectReplacementsFromDirectory(const llvm::StringRef Directory,
|
|||
|
||||
TURFiles.push_back(I->path());
|
||||
|
||||
std::unique_ptr<MemoryBuffer> Out;
|
||||
std::error_code BufferError = MemoryBuffer::getFile(I->path(), Out);
|
||||
if (BufferError) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> Out =
|
||||
MemoryBuffer::getFile(I->path());
|
||||
if (std::error_code BufferError = Out.getError()) {
|
||||
errs() << "Error reading " << I->path() << ": " << BufferError.message()
|
||||
<< "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
yaml::Input YIn(Out->getBuffer(), nullptr, &eatDiagnostics);
|
||||
yaml::Input YIn(Out.get()->getBuffer(), nullptr, &eatDiagnostics);
|
||||
tooling::TranslationUnitReplacements TU;
|
||||
YIn >> TU;
|
||||
if (YIn.error()) {
|
||||
|
|
|
@ -123,23 +123,27 @@ std::error_code
|
|||
IncludeExcludeInfo::readListFromFile(StringRef IncludeListFile,
|
||||
StringRef ExcludeListFile) {
|
||||
if (!IncludeListFile.empty()) {
|
||||
std::unique_ptr<MemoryBuffer> FileBuf;
|
||||
if (std::error_code Err = MemoryBuffer::getFile(IncludeListFile, FileBuf)) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> FileBuf =
|
||||
MemoryBuffer::getFile(IncludeListFile);
|
||||
if (std::error_code Err = FileBuf.getError()) {
|
||||
errs() << "Unable to read from include file.\n";
|
||||
return Err;
|
||||
}
|
||||
if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), IncludeList,
|
||||
/*Separator=*/"\n"))
|
||||
if (std::error_code Err =
|
||||
parseCLInput(FileBuf.get()->getBuffer(), IncludeList,
|
||||
/*Separator=*/"\n"))
|
||||
return Err;
|
||||
}
|
||||
if (!ExcludeListFile.empty()) {
|
||||
std::unique_ptr<MemoryBuffer> FileBuf;
|
||||
if (std::error_code Err = MemoryBuffer::getFile(ExcludeListFile, FileBuf)) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> FileBuf =
|
||||
MemoryBuffer::getFile(ExcludeListFile);
|
||||
if (std::error_code Err = FileBuf.getError()) {
|
||||
errs() << "Unable to read from exclude file.\n";
|
||||
return Err;
|
||||
}
|
||||
if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), ExcludeList,
|
||||
/*Separator=*/"\n"))
|
||||
if (std::error_code Err =
|
||||
parseCLInput(FileBuf.get()->getBuffer(), ExcludeList,
|
||||
/*Separator=*/"\n"))
|
||||
return Err;
|
||||
}
|
||||
return std::error_code();
|
||||
|
|
|
@ -230,14 +230,14 @@ getHeaderFileNames(SmallVectorImpl<std::string> &HeaderFileNames,
|
|||
HeaderDirectory = HeaderPrefix;
|
||||
|
||||
// Read the header list file into a buffer.
|
||||
std::unique_ptr<MemoryBuffer> listBuffer;
|
||||
if (std::error_code ec = MemoryBuffer::getFile(ListFileName, listBuffer)) {
|
||||
return ec;
|
||||
}
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> listBuffer =
|
||||
MemoryBuffer::getFile(ListFileName);
|
||||
if (std::error_code EC = listBuffer.getError())
|
||||
return EC;
|
||||
|
||||
// Parse the header list into strings.
|
||||
SmallVector<StringRef, 32> Strings;
|
||||
listBuffer->getBuffer().split(Strings, "\n", -1, false);
|
||||
listBuffer.get()->getBuffer().split(Strings, "\n", -1, false);
|
||||
|
||||
// Collect the header file names from the string list.
|
||||
for (SmallVectorImpl<StringRef>::iterator I = Strings.begin(),
|
||||
|
|
Loading…
Reference in New Issue