LLVM 22.0.0git
TapiFile.h
Go to the documentation of this file.
1//===- TapiFile.h - Text-based Dynamic Library Stub -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the TapiFile interface.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_OBJECT_TAPIFILE_H
14#define LLVM_OBJECT_TAPIFILE_H
15
16#include "llvm/ADT/StringRef.h"
17#include "llvm/Object/Binary.h"
21#include "llvm/Support/Error.h"
25
26namespace llvm {
27
28class raw_ostream;
29
30namespace object {
31
33public:
34 TapiFile(MemoryBufferRef Source, const MachO::InterfaceFile &Interface,
36 ~TapiFile() override;
37
38 void moveSymbolNext(DataRefImpl &DRI) const override;
39
40 Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override;
41
43
44 basic_symbol_iterator symbol_begin() const override;
45
46 basic_symbol_iterator symbol_end() const override;
47
49
50 bool hasSegmentInfo() { return FileKind >= MachO::FileType::TBD_V5; }
51
52 static bool classof(const Binary *v) { return v->isTapiFile(); }
53
54 bool is64Bit() const override { return MachO::is64Bit(Arch); }
55
56private:
57 struct Symbol {
58 StringRef Prefix;
59 StringRef Name;
60 uint32_t Flags;
62
63 constexpr Symbol(StringRef Prefix, StringRef Name, uint32_t Flags,
65 : Prefix(Prefix), Name(Name), Flags(Flags), Type(Type) {}
66 };
67
68 std::vector<Symbol> Symbols;
69 MachO::Architecture Arch;
70 MachO::FileType FileKind;
71};
72
73} // end namespace object.
74} // end namespace llvm.
75
76#endif // LLVM_OBJECT_TAPIFILE_H
#define LLVM_ABI
Definition Compiler.h:213
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
Definition UDTLayout.cpp:35
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Defines the interface file.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
SymbolicFile(unsigned int Type, MemoryBufferRef Source)
static bool classof(const Binary *v)
Definition TapiFile.h:52
void moveSymbolNext(DataRefImpl &DRI) const override
Definition TapiFile.cpp:87
Expected< uint32_t > getSymbolFlags(DataRefImpl DRI) const override
Definition TapiFile.cpp:101
basic_symbol_iterator symbol_end() const override
Definition TapiFile.cpp:112
TapiFile(MemoryBufferRef Source, const MachO::InterfaceFile &Interface, MachO::Architecture Arch)
Definition TapiFile.cpp:49
Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override
Definition TapiFile.cpp:89
bool is64Bit() const override
Definition TapiFile.h:54
basic_symbol_iterator symbol_begin() const override
Definition TapiFile.cpp:106
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
@ TBD_V5
Text-based stub file (.tbd) version 5.0.
Definition FileTypes.h:41
LLVM_ABI bool is64Bit(Architecture)
Check if architecture is 64 bit.
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
content_iterator< BasicSymbolRef > basic_symbol_iterator
This is an optimization pass for GlobalISel generic memory operations.