15#ifndef LLVM_CLANG_APINOTES_READER_H
16#define LLVM_CLANG_APINOTES_READER_H
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/Support/Error.h"
21#include "llvm/Support/MemoryBuffer.h"
22#include "llvm/Support/VersionTuple.h"
36 APINotesReader(llvm::MemoryBuffer *InputBuffer,
37 llvm::VersionTuple SwiftVersion, llvm::Error &Err);
45 Create(std::unique_ptr<llvm::MemoryBuffer> InputBuffer,
46 llvm::VersionTuple SwiftVersion);
51 APINotesReader &
operator=(
const APINotesReader &) =
delete;
62 std::optional<unsigned> Selected;
71 llvm::VersionTuple Version,
75 std::optional<unsigned>
getSelected()
const {
return Selected; }
78 unsigned size()
const {
return Results.size(); }
81 const std::pair<llvm::VersionTuple, T> *
begin()
const {
82 assert(!Results.empty());
83 return Results.begin();
85 const std::pair<llvm::VersionTuple, T> *
end()
const {
91 assert(
index < Results.size());
92 return Results[
index];
133 VersionedInfo<ObjCPropertyInfo>
146 bool IsInstanceMethod);
163 llvm::StringRef Name);
168 VersionedInfo<CXXMethodInfo>
177 VersionedInfo<GlobalVariableInfo>
179 std::optional<Context> Ctx = std::nullopt);
186 VersionedInfo<GlobalFunctionInfo>
188 std::optional<Context> Ctx = std::nullopt);
193 VersionedInfo<GlobalFunctionInfo>
196 std::optional<Context> Ctx = std::nullopt);
212 std::optional<ContextID>
214 std::optional<Context> ParentCtx = std::nullopt);
222 VersionedInfo<TagInfo>
lookupTag(llvm::StringRef Name,
223 std::optional<Context> Ctx = std::nullopt);
230 VersionedInfo<TypedefInfo>
232 std::optional<Context> Ctx = std::nullopt);
239 std::optional<ContextID>
241 std::optional<ContextID> ParentNamespaceID = std::nullopt);
244 VersionedInfo<CXXMethodInfo> lookupCXXMethodImpl(
ContextID CtxID,
245 llvm::StringRef Name);
246 template <
typename ParameterT>
247 VersionedInfo<CXXMethodInfo>
248 lookupCXXMethodImpl(
ContextID CtxID, llvm::StringRef Name,
251 VersionedInfo<GlobalFunctionInfo>
252 lookupGlobalFunctionImpl(llvm::StringRef Name, std::optional<Context> Ctx);
253 template <
typename ParameterT>
254 VersionedInfo<GlobalFunctionInfo>
255 lookupGlobalFunctionImpl(llvm::StringRef Name,
257 std::optional<Context> Ctx);
Smart pointer class that efficiently represents Objective-C method names.
VersionedInfo(std::nullopt_t)
Form an empty set of versioned information.
const std::pair< llvm::VersionTuple, T > & operator[](unsigned index) const
Access a specific versioned result.
const std::pair< llvm::VersionTuple, T > * end() const
unsigned size() const
Return the number of versioned results we know about.
std::optional< unsigned > getSelected() const
Retrieve the selected index in the result set.
const std::pair< llvm::VersionTuple, T > * begin() const
Access all versioned results.
VersionedInfo< ContextInfo > lookupObjCClassInfo(llvm::StringRef Name)
Look for information regarding the given Objective-C class.
VersionedInfo< FieldInfo > lookupField(ContextID CtxID, llvm::StringRef Name)
Look for information regarding the given field of a C struct.
VersionedInfo< CXXMethodInfo > lookupCXXMethod(ContextID CtxID, llvm::StringRef Name)
Look for information regarding the given C++ method in the given C++ tag context.
VersionedInfo< TagInfo > lookupTag(llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
Look for information regarding the given tag (struct/union/enum/C++ class).
VersionedInfo< GlobalFunctionInfo > lookupGlobalFunction(llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
Look for information regarding the given global function.
VersionedInfo< ObjCPropertyInfo > lookupObjCProperty(ContextID CtxID, llvm::StringRef Name, bool IsInstance)
Look for information regarding the given Objective-C property in the given context.
VersionedInfo< ObjCMethodInfo > lookupObjCMethod(ContextID CtxID, ObjCSelectorRef Selector, bool IsInstanceMethod)
Look for information regarding the given Objective-C method in the given context.
VersionedInfo< GlobalVariableInfo > lookupGlobalVariable(llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
Look for information regarding the given global variable.
std::optional< ContextID > lookupNamespaceID(llvm::StringRef Name, std::optional< ContextID > ParentNamespaceID=std::nullopt)
Look for the context ID of the given C++ namespace.
std::optional< ContextID > lookupTagID(llvm::StringRef Name, std::optional< Context > ParentCtx=std::nullopt)
Look for the context ID of the given C++ tag.
VersionedInfo< TypedefInfo > lookupTypedef(llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
Look for information regarding the given typedef.
std::optional< ContextID > lookupObjCClassID(llvm::StringRef Name)
Look for the context ID of the given Objective-C class.
APINotesReader & operator=(const APINotesReader &)=delete
VersionedInfo< ContextInfo > lookupObjCProtocolInfo(llvm::StringRef Name)
Look for information regarding the given Objective-C protocol.
std::optional< ContextID > lookupObjCProtocolID(llvm::StringRef Name)
Look for the context ID of the given Objective-C protocol.
VersionedInfo< EnumConstantInfo > lookupEnumConstant(llvm::StringRef Name)
Look for information regarding the given enumerator.
APINotesReader(const APINotesReader &)=delete
Opaque context ID used to refer to an Objective-C class or protocol or a C++ namespace.
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
A temporary reference to an Objective-C selector, suitable for referencing selector data on the stack...