mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SectionRef::getContents() now returns Expected
Updated uses of object::SectionRef::getContents() since it now returns an Expected<StringRef> instead of modifying the one it's passed. See also: git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360892 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
committed by
Gwen Mittertreiner
parent
dff6b6e258
commit
67cfef2d60
@@ -169,10 +169,15 @@ collectASTModules(llvm::cl::list<std::string> &InputNames,
|
||||
(ELF && Name == swift::ELFASTSectionName) ||
|
||||
(COFF && Name == swift::COFFASTSectionName)) {
|
||||
uint64_t Size = Section.getSize();
|
||||
StringRef ContentsReference;
|
||||
Section.getContents(ContentsReference);
|
||||
|
||||
llvm::Expected<llvm::StringRef> ContentsReference = Section.getContents();
|
||||
if (!ContentsReference) {
|
||||
llvm::outs() << "error: " << name << " "
|
||||
<< errorToErrorCode(OF.takeError()).message() << "\n";
|
||||
return false;
|
||||
}
|
||||
char *Module = Alloc.Allocate<char>(Size);
|
||||
std::memcpy(Module, (void *)ContentsReference.begin(), Size);
|
||||
std::memcpy(Module, (void *)ContentsReference->begin(), Size);
|
||||
Modules.push_back({Module, Size});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user