summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-05-16 13:24:04 +0000
committerFangrui Song <maskray@google.com>2019-05-16 13:24:04 +0000
commitb6c6b38192cc34367f86bb3ff150157368b19dfe (patch)
treea25cec1597c8f02436c448fa57b3bff95faf5cd2 /lib/CodeGen/ObjectFilePCHContainerOperations.cpp
parent2b469b71cbf579c95af77cbdd667f17965a0fb0f (diff)
downloadclang-b6c6b38192cc34367f86bb3ff150157368b19dfe.tar.gz
Recommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>
r360876 didn't fix 2 call sites in clang. Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r--lib/CodeGen/ObjectFilePCHContainerOperations.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index db53959ea0..db6e73f409 100644
--- a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -337,8 +337,14 @@ ObjectFilePCHContainerReader::ExtractPCH(llvm::MemoryBufferRef Buffer) const {
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 "";
+ }
}
}
}