LLVM 20.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"
20#include "llvm/Support/Error.h"
24
25namespace llvm {
26
27class raw_ostream;
28
29namespace object {
30
31class TapiFile : public SymbolicFile {
32public:
33 TapiFile(MemoryBufferRef Source, const MachO::InterfaceFile &Interface,
35 ~TapiFile() override;
36
37 void moveSymbolNext(DataRefImpl &DRI) const override;
38
39 Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override;
40
42
43 basic_symbol_iterator symbol_begin() const override;
44
45 basic_symbol_iterator symbol_end() const override;
46
48
49 bool hasSegmentInfo() { return FileKind >= MachO::FileType::TBD_V5; }
50
51 static bool classof(const Binary *v) { return v->isTapiFile(); }
52
53 bool is64Bit() const override { return MachO::is64Bit(Arch); }
54
55private:
56 struct Symbol {
57 StringRef Prefix;
58 StringRef Name;
59 uint32_t Flags;
61
62 constexpr Symbol(StringRef Prefix, StringRef Name, uint32_t Flags,
64 : Prefix(Prefix), Name(Name), Flags(Flags), Type(Type) {}
65 };
66
67 std::vector<Symbol> Symbols;
69 MachO::FileType FileKind;
70};
71
72} // end namespace object.
73} // end namespace llvm.
74
75#endif // LLVM_OBJECT_TAPIFILE_H
raw_pwrite_stream & OS
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Tagged union holding either a T or a Error.
Definition: Error.h:481
Defines the interface file.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Expected< SymbolRef::Type > getSymbolType(DataRefImpl DRI) const
Definition: TapiFile.cpp:96
static bool classof(const Binary *v)
Definition: TapiFile.h:51
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
Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override
Definition: TapiFile.cpp:89
bool is64Bit() const override
Definition: TapiFile.h:53
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:52
FileType
Defines the file type TextAPI files can represent.
Definition: FileTypes.h:15
@ TBD_V5
Text-based stub file (.tbd) version 5.0.
Definition: FileTypes.h:41
bool is64Bit(Architecture)
Check if architecture is 64 bit.
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
Definition: Architecture.h:27
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18