StringRef Name;
Section.getName(Name);
if ((!IsCOFF && Name == "__clangast") || (IsCOFF && Name == "clangast")) {
- Section.getContents(PCH);
- return PCH;
+ if (Expected<StringRef> E = Section.getContents())
+ return *E;
+ else {
+ handleAllErrors(E.takeError(), [&](const llvm::ErrorInfoBase &EIB) {
+ EIB.log(llvm::errs());
+ });
+ return "";
+ }
}
}
}
// TODO: Instead of copying the input file as is, deactivate the section
// that is no longer needed.
- StringRef Content;
- CurrentSection->getContents(Content);
+ Expected<StringRef> Content = CurrentSection->getContents();
+ if (!Content) {
+ consumeError(Content.takeError());
+ return;
+ }
- if (Content.size() < 2)
+ if (Content->size() < 2)
OS.write(Input.getBufferStart(), Input.getBufferSize());
else
- OS.write(Content.data(), Content.size());
+ OS.write(Content->data(), Content->size());
}
void WriteHeader(raw_fd_ostream &OS,