aboutsummaryrefslogtreecommitdiff
path: root/lib/Object/IRObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/IRObjectFile.cpp')
-rw-r--r--lib/Object/IRObjectFile.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp
index 1ecb26d60bce..636f1521262f 100644
--- a/lib/Object/IRObjectFile.cpp
+++ b/lib/Object/IRObjectFile.cpp
@@ -1,9 +1,8 @@
//===- IRObjectFile.cpp - IR object file implementation ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -43,10 +42,9 @@ void IRObjectFile::moveSymbolNext(DataRefImpl &Symb) const {
Symb.p += sizeof(ModuleSymbolTable::Symbol);
}
-std::error_code IRObjectFile::printSymbolName(raw_ostream &OS,
- DataRefImpl Symb) const {
+Error IRObjectFile::printSymbolName(raw_ostream &OS, DataRefImpl Symb) const {
SymTab.printSymbolName(OS, getSym(Symb));
- return std::error_code();
+ return Error::success();
}
uint32_t IRObjectFile::getSymbolFlags(DataRefImpl Symb) const {
@@ -76,10 +74,12 @@ Expected<MemoryBufferRef>
IRObjectFile::findBitcodeInObject(const ObjectFile &Obj) {
for (const SectionRef &Sec : Obj.sections()) {
if (Sec.isBitcode()) {
- StringRef SecContents;
- if (std::error_code EC = Sec.getContents(SecContents))
- return errorCodeToError(EC);
- return MemoryBufferRef(SecContents, Obj.getFileName());
+ Expected<StringRef> Contents = Sec.getContents();
+ if (!Contents)
+ return Contents.takeError();
+ if (Contents->size() <= 1)
+ return errorCodeToError(object_error::bitcode_section_not_found);
+ return MemoryBufferRef(*Contents, Obj.getFileName());
}
}