From 5ea15fab19eb005c6032ea453c7a01ae32269336 Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Wed, 20 Dec 2023 08:47:10 -0800 Subject: [TextAPI] Add support to convert RecordSlices -> InterfaceFile (#75007) Introduce RecordVisitor. This is used for different clients that want to extract information out of RecordSlice types. The first and immediate use case is for serializing symbol information into TBD files. --- llvm/lib/TextAPI/BinaryReader/DylibReader.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/TextAPI/BinaryReader/DylibReader.cpp') diff --git a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp index b01130c..40b57b5 100644 --- a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp +++ b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp @@ -417,3 +417,13 @@ Expected DylibReader::readFile(MemoryBufferRef Buffer, return make_error(TextAPIErrorCode::EmptyResults); return Results; } + +Expected> +DylibReader::get(MemoryBufferRef Buffer) { + ParseOption Options; + auto SlicesOrErr = readFile(Buffer, Options); + if (!SlicesOrErr) + return SlicesOrErr.takeError(); + + return convertToInterfaceFile(*SlicesOrErr); +} -- cgit v1.1