Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:37

0001 //===- TextAPI/DylibReader.h - TAPI MachO Dylib Reader ----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// Defines the MachO Dynamic Library Reader.
0010 ///
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_TEXTAPI_DYLIBREADER_H
0014 #define LLVM_TEXTAPI_DYLIBREADER_H
0015 
0016 #include "llvm/ADT/StringMap.h"
0017 #include "llvm/Support/Error.h"
0018 #include "llvm/Support/MemoryBuffer.h"
0019 #include "llvm/TextAPI/ArchitectureSet.h"
0020 #include "llvm/TextAPI/RecordsSlice.h"
0021 
0022 namespace llvm::MachO::DylibReader {
0023 
0024 struct ParseOption {
0025   /// Determines arch slice to parse.
0026   ArchitectureSet Archs = ArchitectureSet::All();
0027   /// Capture Mach-O header from binary, primarily load commands.
0028   bool MachOHeader = true;
0029   /// Capture defined symbols out of export trie and n-list.
0030   bool SymbolTable = true;
0031   /// Capture undefined symbols too.
0032   bool Undefineds = true;
0033 };
0034 
0035 /// Parse Mach-O dynamic libraries to extract TAPI attributes.
0036 ///
0037 /// \param Buffer Data that points to dylib.
0038 /// \param Options Determines which attributes to extract.
0039 /// \return List of record slices.
0040 Expected<Records> readFile(MemoryBufferRef Buffer, const ParseOption &Opt);
0041 
0042 /// Get TAPI file representation of binary dylib.
0043 ///
0044 /// \param Buffer Data that points to dylib.
0045 Expected<std::unique_ptr<InterfaceFile>> get(MemoryBufferRef Buffer);
0046 
0047 using SymbolToSourceLocMap = llvm::StringMap<RecordLoc>;
0048 /// Get the source location for each symbol from dylib.
0049 ///
0050 /// \param DSYM Path to DSYM file.
0051 /// \param T Requested target slice for dylib.
0052 SymbolToSourceLocMap accumulateSourceLocFromDSYM(const StringRef DSYM,
0053                                                  const Target &T);
0054 
0055 } // namespace llvm::MachO::DylibReader
0056 
0057 #endif // LLVM_TEXTAPI_DYLIBREADER_H