aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h')
-rw-r--r--contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h b/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h
new file mode 100644
index 000000000000..b556fbf6832a
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/TextAPI/DylibReader.h
@@ -0,0 +1,48 @@
+//===- 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