summaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm18/include/llvm/TextAPI/DylibReader.h
blob: 45399134698ba8c79a244e8074ebc89b22ec1ca9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//===- TextAPI/DylibReader.h - TAPI MachO Dylib Reader ----------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
///
/// Defines the MachO Dynamic Library Reader.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_TEXTAPI_DYLIBREADER_H
#define LLVM_TEXTAPI_DYLIBREADER_H

#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/TextAPI/ArchitectureSet.h"
#include "llvm/TextAPI/RecordsSlice.h"

namespace llvm::MachO::DylibReader {

struct ParseOption {
  /// Determines arch slice to parse.
  ArchitectureSet Archs = ArchitectureSet::All();
  /// Capture Mach-O header from binary, primarily load commands.
  bool MachOHeader = true;
  /// Capture defined symbols out of export trie and n-list.
  bool SymbolTable = true;
  /// Capture undefined symbols too.
  bool Undefineds = true;
};

/// Parse Mach-O dynamic libraries to extract TAPI attributes.
///
/// \param Buffer Data that points to dylib.
/// \param Options Determines which attributes to extract.
/// \return List of record slices.
Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt);

/// Get TAPI file representation of binary dylib.
///
/// \param Buffer Data that points to dylib.
Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer);

} // namespace llvm::MachO::DylibReader

#endif // LLVM_TEXTAPI_DYLIBREADER_H

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif