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