LLVM 22.0.0git
TextAPIWriter.h
Go to the documentation of this file.
1//===--- TextAPIWriter.h - Text API Writer ----------------------*- 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_TEXTAPIWRITER_H
10#define LLVM_TEXTAPI_TEXTAPIWRITER_H
11
15
16namespace llvm {
17
18class Error;
19class raw_ostream;
20
21namespace MachO {
22
24public:
25 TextAPIWriter() = delete;
26
27 /// Write TAPI text file contents into stream.
28 ///
29 /// \param OS Stream to write to.
30 /// \param File Library attributes to write as text file.
31 /// \param FileKind File format to write text file as. If not specified, it
32 /// will read from File.
33 /// \param Compact Whether to limit whitespace in text file.
34 LLVM_ABI static Error
36 const FileType FileKind = FileType::Invalid,
37 bool Compact = false);
38
39 /// Get TAPI FileType from the input string.
40 ///
41 /// \param FT String of input to map to FileType.
42 static FileType parseFileType(const StringRef FT) {
43 return StringSwitch<FileType>(FT)
44 .Case("tbd-v1", FileType::TBD_V1)
45 .Case("tbd-v2", FileType::TBD_V2)
46 .Case("tbd-v3", FileType::TBD_V3)
47 .Case("tbd-v4", FileType::TBD_V4)
48 .Case("tbd-v5", FileType::TBD_V5)
50 }
51};
52
53} // end namespace MachO.
54} // end namespace llvm.
55
56#endif // LLVM_TEXTAPI_TEXTAPIWRITER_H
#define LLVM_ABI
Definition Compiler.h:213
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Defines the interface file.
static LLVM_ABI Error writeToStream(raw_ostream &OS, const InterfaceFile &File, const FileType FileKind=FileType::Invalid, bool Compact=false)
Write TAPI text file contents into stream.
static FileType parseFileType(const StringRef FT)
Get TAPI FileType from the input string.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
FileType
Defines the file type TextAPI files can represent.
Definition FileTypes.h:15
@ Invalid
Invalid file type.
Definition FileTypes.h:17
@ TBD_V1
Text-based stub file (.tbd) version 1.0.
Definition FileTypes.h:29
@ TBD_V3
Text-based stub file (.tbd) version 3.0.
Definition FileTypes.h:35
@ TBD_V5
Text-based stub file (.tbd) version 5.0.
Definition FileTypes.h:41
@ TBD_V4
Text-based stub file (.tbd) version 4.0.
Definition FileTypes.h:38
@ TBD_V2
Text-based stub file (.tbd) version 2.0.
Definition FileTypes.h:32
This is an optimization pass for GlobalISel generic memory operations.