mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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
@@ -26,6 +26,7 @@
|
||||
#include "llvm/Object/ELFObjectFile.h"
|
||||
#include "llvm/Object/MachOUniversal.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <io.h>
|
||||
@@ -137,11 +138,11 @@ public:
|
||||
for (SectionRef S : O->sections()) {
|
||||
if (!needToRelocate(S))
|
||||
continue;
|
||||
StringRef Content;
|
||||
if (auto EC = S.getContents(Content))
|
||||
reportError(EC);
|
||||
std::memcpy(&Memory[getSectionAddress(S)], Content.data(),
|
||||
Content.size());
|
||||
llvm::Expected<llvm::StringRef> Content = S.getContents();
|
||||
if (!Content)
|
||||
reportError(errorToErrorCode(Content.takeError()));
|
||||
std::memcpy(&Memory[getSectionAddress(S)], Content->data(),
|
||||
Content->size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user