Mercurial > hg > CbC > CbC_llvm
diff lib/Object/IRObjectFile.cpp @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
line wrap: on
line diff
--- a/lib/Object/IRObjectFile.cpp Sun Dec 23 19:23:36 2018 +0900 +++ b/lib/Object/IRObjectFile.cpp Wed Aug 14 19:46:37 2019 +0900 @@ -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 @@ 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 @@ 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()); } }