LLVM 20.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
14
15namespace llvm {
16
17class Error;
18class raw_ostream;
19
20namespace MachO {
21
23public:
24 TextAPIWriter() = delete;
25
26 /// Write TAPI text file contents into stream.
27 ///
28 /// \param OS Stream to write to.
29 /// \param File Library attributes to write as text file.
30 /// \param FileKind File format to write text file as. If not specified, it
31 /// will read from File.
32 /// \param Compact Whether to limit whitespace in text file.
33 static Error writeToStream(raw_ostream &OS, const InterfaceFile &File,
34 const FileType FileKind = FileType::Invalid,
35 bool Compact = false);
36
37 /// Get TAPI FileType from the input string.
38 ///
39 /// \param FT String of input to map to FileType.
40 static FileType parseFileType(const StringRef FT) {
41 return StringSwitch<FileType>(FT)
42 .Case("tbd-v1", FileType::TBD_V1)
43 .Case("tbd-v2", FileType::TBD_V2)
44 .Case("tbd-v3", FileType::TBD_V3)
45 .Case("tbd-v4", FileType::TBD_V4)
46 .Case("tbd-v5", FileType::TBD_V5)
48 }
49};
50
51} // end namespace MachO.
52} // end namespace llvm.
53
54#endif // LLVM_TEXTAPI_TEXTAPIWRITER_H
raw_pwrite_stream & OS
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:160
Defines the interface file.
static Error writeToStream(raw_ostream &OS, const InterfaceFile &File, const FileType FileKind=FileType::Invalid, bool Compact=false)
Write TAPI text file contents into stream.
Definition: TextStub.cpp:1137
static FileType parseFileType(const StringRef FT)
Get TAPI FileType from the input string.
Definition: TextAPIWriter.h:40
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:69
R Default(T Value)
Definition: StringSwitch.h:182
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
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.
Definition: AddressRanges.h:18