diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 |
| commit | 54db30ce18663e6c2991958f3b5d18362e8e93c4 (patch) | |
| tree | 4aa6442802570767398cc83ba484e97b1309bdc2 /contrib/llvm/lib/Object/IRObjectFile.cpp | |
| parent | 35284c22e9c8348159b7ce032ea45f2cdeb65298 (diff) | |
| parent | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Object/IRObjectFile.cpp')
| -rw-r--r-- | contrib/llvm/lib/Object/IRObjectFile.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/contrib/llvm/lib/Object/IRObjectFile.cpp b/contrib/llvm/lib/Object/IRObjectFile.cpp index 1ecb26d60bce..636f1521262f 100644 --- a/contrib/llvm/lib/Object/IRObjectFile.cpp +++ b/contrib/llvm/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()); } } |
