1 //===--- TextAPIReader.h - Text API Reader ----------------------*- 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 #ifndef LLVM_TEXTAPI_TEXTAPIREADER_H
10 #define LLVM_TEXTAPI_TEXTAPIREADER_H
11 
12 #include "llvm/Support/Error.h"
13 
14 namespace llvm {
15 
16 class MemoryBufferRef;
17 
18 namespace MachO {
19 
20 class InterfaceFile;
21 enum FileType : unsigned;
22 
23 class TextAPIReader {
24 public:
25   ///  Determine whether input can be interpreted as TAPI text file.
26   ///  This allows one to exit early when file is not recognized as TAPI file
27   ///  as opposed to `get` which attempts to full parse and load of library
28   ///  attributes.
29   ///
30   /// \param InputBuffer Buffer holding contents of TAPI text file.
31   /// \return The file format version of TAPI text file.
32   static Expected<FileType> canRead(MemoryBufferRef InputBuffer);
33 
34   /// Parse and get an InterfaceFile that represents the full
35   /// library.
36   ///
37   /// \param InputBuffer Buffer holding contents of TAPI text file.
38   static Expected<std::unique_ptr<InterfaceFile>>
39   get(MemoryBufferRef InputBuffer);
40 
41   TextAPIReader() = delete;
42 };
43 
44 } // end namespace MachO.
45 } // end namespace llvm.
46 
47 #endif // LLVM_TEXTAPI_TEXTAPIREADER_H
48