diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/llvm12/lib/Object/TapiUniversal.cpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Object/TapiUniversal.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Object/TapiUniversal.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/contrib/libs/llvm12/lib/Object/TapiUniversal.cpp b/contrib/libs/llvm12/lib/Object/TapiUniversal.cpp index 48cb949cb6..4cadf22fe7 100644 --- a/contrib/libs/llvm12/lib/Object/TapiUniversal.cpp +++ b/contrib/libs/llvm12/lib/Object/TapiUniversal.cpp @@ -1,61 +1,61 @@ -//===- TapiUniversal.cpp --------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// This file defines the Text-based Dynamic Library Stub format. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Object/TapiUniversal.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Object/Error.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/TextAPI/MachO/TextAPIReader.h" - -using namespace llvm; -using namespace MachO; -using namespace object; - -TapiUniversal::TapiUniversal(MemoryBufferRef Source, Error &Err) - : Binary(ID_TapiUniversal, Source) { - Expected<std::unique_ptr<InterfaceFile>> Result = TextAPIReader::get(Source); - ErrorAsOutParameter ErrAsOuParam(&Err); - if (!Result) { - Err = Result.takeError(); - return; - } - ParsedFile = std::move(Result.get()); - - auto FlattenObjectInfo = [this](const auto &File) { - StringRef Name = File->getInstallName(); - for (const Architecture Arch : File->getArchitectures()) - Libraries.emplace_back(Library({Name, Arch})); - }; - - FlattenObjectInfo(ParsedFile); - // Get inlined documents from tapi file. - for (const std::shared_ptr<InterfaceFile> &File : ParsedFile->documents()) - FlattenObjectInfo(File); -} - -TapiUniversal::~TapiUniversal() = default; - -Expected<std::unique_ptr<TapiFile>> -TapiUniversal::ObjectForArch::getAsObjectFile() const { - return std::unique_ptr<TapiFile>(new TapiFile(Parent->getMemoryBufferRef(), - *Parent->ParsedFile.get(), - Parent->Libraries[Index].Arch)); -} - -Expected<std::unique_ptr<TapiUniversal>> -TapiUniversal::create(MemoryBufferRef Source) { - Error Err = Error::success(); - std::unique_ptr<TapiUniversal> Ret(new TapiUniversal(Source, Err)); - if (Err) - return std::move(Err); - return std::move(Ret); -} +//===- TapiUniversal.cpp --------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// This file defines the Text-based Dynamic Library Stub format. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Object/TapiUniversal.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Object/Error.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/TextAPI/MachO/TextAPIReader.h" + +using namespace llvm; +using namespace MachO; +using namespace object; + +TapiUniversal::TapiUniversal(MemoryBufferRef Source, Error &Err) + : Binary(ID_TapiUniversal, Source) { + Expected<std::unique_ptr<InterfaceFile>> Result = TextAPIReader::get(Source); + ErrorAsOutParameter ErrAsOuParam(&Err); + if (!Result) { + Err = Result.takeError(); + return; + } + ParsedFile = std::move(Result.get()); + + auto FlattenObjectInfo = [this](const auto &File) { + StringRef Name = File->getInstallName(); + for (const Architecture Arch : File->getArchitectures()) + Libraries.emplace_back(Library({Name, Arch})); + }; + + FlattenObjectInfo(ParsedFile); + // Get inlined documents from tapi file. + for (const std::shared_ptr<InterfaceFile> &File : ParsedFile->documents()) + FlattenObjectInfo(File); +} + +TapiUniversal::~TapiUniversal() = default; + +Expected<std::unique_ptr<TapiFile>> +TapiUniversal::ObjectForArch::getAsObjectFile() const { + return std::unique_ptr<TapiFile>(new TapiFile(Parent->getMemoryBufferRef(), + *Parent->ParsedFile.get(), + Parent->Libraries[Index].Arch)); +} + +Expected<std::unique_ptr<TapiUniversal>> +TapiUniversal::create(MemoryBufferRef Source) { + Error Err = Error::success(); + std::unique_ptr<TapiUniversal> Ret(new TapiUniversal(Source, Err)); + if (Err) + return std::move(Err); + return std::move(Ret); +} |