clang 18.0.0git
APINotesWriter.h
Go to the documentation of this file.
1//===-- APINotesWriter.h - API Notes 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_CLANG_APINOTES_WRITER_H
10#define LLVM_CLANG_APINOTES_WRITER_H
11
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Support/VersionTuple.h"
15#include "llvm/Support/raw_ostream.h"
16
17#include <memory>
18
19namespace clang {
20class FileEntry;
21
22namespace api_notes {
24 class Implementation;
25 std::unique_ptr<Implementation> Implementation;
26
27public:
28 APINotesWriter(llvm::StringRef ModuleName, const FileEntry *SF);
30
31 APINotesWriter(const APINotesWriter &) = delete;
33
34 void writeToStream(llvm::raw_ostream &OS);
35
36 /// Add information about a specific Objective-C class or protocol or a C++
37 /// namespace.
38 ///
39 /// \param Name The name of this class/protocol/namespace.
40 /// \param Kind Whether this is a class, a protocol, or a namespace.
41 /// \param Info Information about this class/protocol/namespace.
42 ///
43 /// \returns the ID of the class, protocol, or namespace, which can be used to
44 /// add properties and methods to the class/protocol/namespace.
45 ContextID addObjCContext(std::optional<ContextID> ParentCtxID,
46 llvm::StringRef Name, ContextKind Kind,
47 const ObjCContextInfo &Info,
48 llvm::VersionTuple SwiftVersion);
49
50 /// Add information about a specific Objective-C property.
51 ///
52 /// \param CtxID The context in which this property resides.
53 /// \param Name The name of this property.
54 /// \param Info Information about this property.
55 void addObjCProperty(ContextID CtxID, llvm::StringRef Name,
56 bool IsInstanceProperty, const ObjCPropertyInfo &Info,
57 llvm::VersionTuple SwiftVersion);
58
59 /// Add information about a specific Objective-C method.
60 ///
61 /// \param CtxID The context in which this method resides.
62 /// \param Selector The selector that names this method.
63 /// \param IsInstanceMethod Whether this method is an instance method
64 /// (vs. a class method).
65 /// \param Info Information about this method.
67 bool IsInstanceMethod, const ObjCMethodInfo &Info,
68 llvm::VersionTuple SwiftVersion);
69
70 /// Add information about a global variable.
71 ///
72 /// \param Name The name of this global variable.
73 /// \param Info Information about this global variable.
74 void addGlobalVariable(std::optional<Context> Ctx, llvm::StringRef Name,
75 const GlobalVariableInfo &Info,
76 llvm::VersionTuple SwiftVersion);
77
78 /// Add information about a global function.
79 ///
80 /// \param Name The name of this global function.
81 /// \param Info Information about this global function.
82 void addGlobalFunction(std::optional<Context> Ctx, llvm::StringRef Name,
83 const GlobalFunctionInfo &Info,
84 llvm::VersionTuple SwiftVersion);
85
86 /// Add information about an enumerator.
87 ///
88 /// \param Name The name of this enumerator.
89 /// \param Info Information about this enumerator.
90 void addEnumConstant(llvm::StringRef Name, const EnumConstantInfo &Info,
91 llvm::VersionTuple SwiftVersion);
92
93 /// Add information about a tag (struct/union/enum/C++ class).
94 ///
95 /// \param Name The name of this tag.
96 /// \param Info Information about this tag.
97 void addTag(std::optional<Context> Ctx, llvm::StringRef Name,
98 const TagInfo &Info, llvm::VersionTuple SwiftVersion);
99
100 /// Add information about a typedef.
101 ///
102 /// \param Name The name of this typedef.
103 /// \param Info Information about this typedef.
104 void addTypedef(std::optional<Context> Ctx, llvm::StringRef Name,
105 const TypedefInfo &Info, llvm::VersionTuple SwiftVersion);
106};
107} // namespace api_notes
108} // namespace clang
109
110#endif // LLVM_CLANG_APINOTES_WRITER_H
Cached information about one file (either on disk or in the virtual file system).
Definition: FileEntry.h:366
Smart pointer class that efficiently represents Objective-C method names.
void addObjCMethod(ContextID CtxID, ObjCSelectorRef Selector, bool IsInstanceMethod, const ObjCMethodInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific Objective-C method.
APINotesWriter & operator=(const APINotesWriter &)=delete
void addEnumConstant(llvm::StringRef Name, const EnumConstantInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about an enumerator.
void addGlobalFunction(std::optional< Context > Ctx, llvm::StringRef Name, const GlobalFunctionInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a global function.
void addObjCProperty(ContextID CtxID, llvm::StringRef Name, bool IsInstanceProperty, const ObjCPropertyInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific Objective-C property.
void addGlobalVariable(std::optional< Context > Ctx, llvm::StringRef Name, const GlobalVariableInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a global variable.
void addTypedef(std::optional< Context > Ctx, llvm::StringRef Name, const TypedefInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a typedef.
void writeToStream(llvm::raw_ostream &OS)
APINotesWriter(const APINotesWriter &)=delete
ContextID addObjCContext(std::optional< ContextID > ParentCtxID, llvm::StringRef Name, ContextKind Kind, const ObjCContextInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific Objective-C class or protocol or a C++ namespace.
void addTag(std::optional< Context > Ctx, llvm::StringRef Name, const TagInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a tag (struct/union/enum/C++ class).
Opaque context ID used to refer to an Objective-C class or protocol or a C++ namespace.
Definition: Types.h:745
Describes API notes data for an enumerator.
Definition: Types.h:646
Describes API notes data for a global function.
Definition: Types.h:640
Describes API notes data for a global variable.
Definition: Types.h:634
Describes API notes data for an Objective-C class or protocol.
Definition: Types.h:192
Describes API notes data for an Objective-C method.
Definition: Types.h:597
Describes API notes data for an Objective-C property.
Definition: Types.h:354
Describes API notes data for a tag.
Definition: Types.h:652
Describes API notes data for a typedef.
Definition: Types.h:713
A temporary reference to an Objective-C selector, suitable for referencing selector data on the stack...
Definition: Types.h:771