aboutsummaryrefslogtreecommitdiff
path: root/lib/Object/ObjectFile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
commit1d5ae1026e831016fc29fd927877c86af904481f (patch)
tree2cdfd12620fcfa5d9e4a0389f85368e8e36f63f9 /lib/Object/ObjectFile.cpp
parente6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff)
Notes
Diffstat (limited to 'lib/Object/ObjectFile.cpp')
-rw-r--r--lib/Object/ObjectFile.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp
index 101f5dcc0821..e0e63a5a7d76 100644
--- a/lib/Object/ObjectFile.cpp
+++ b/lib/Object/ObjectFile.cpp
@@ -67,8 +67,10 @@ Error ObjectFile::printSymbolName(raw_ostream &OS, DataRefImpl Symb) const {
uint32_t ObjectFile::getSymbolAlignment(DataRefImpl DRI) const { return 0; }
bool ObjectFile::isSectionBitcode(DataRefImpl Sec) const {
- if (Expected<StringRef> NameOrErr = getSectionName(Sec))
+ Expected<StringRef> NameOrErr = getSectionName(Sec);
+ if (NameOrErr)
return *NameOrErr == ".llvmbc";
+ consumeError(NameOrErr.takeError());
return false;
}
@@ -82,7 +84,8 @@ bool ObjectFile::isBerkeleyData(DataRefImpl Sec) const {
return isSectionData(Sec);
}
-section_iterator ObjectFile::getRelocatedSection(DataRefImpl Sec) const {
+Expected<section_iterator>
+ObjectFile::getRelocatedSection(DataRefImpl Sec) const {
return section_iterator(SectionRef(Sec, this));
}
@@ -103,7 +106,7 @@ Triple ObjectFile::makeTriple() const {
TheTriple.setObjectFormat(Triple::MachO);
if (isCOFF()) {
- const auto COFFObj = dyn_cast<COFFObjectFile>(this);
+ const auto COFFObj = cast<COFFObjectFile>(this);
if (COFFObj->getArch() == Triple::thumb)
TheTriple.setTriple("thumbv7-windows");
}
@@ -127,6 +130,8 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, file_magic Type) {
case file_magic::pdb:
case file_magic::minidump:
return errorCodeToError(object_error::invalid_file_type);
+ case file_magic::tapi_file:
+ return errorCodeToError(object_error::invalid_file_type);
case file_magic::elf:
case file_magic::elf_relocatable:
case file_magic::elf_executable: