clang 24.0.0git
clang::api_notes::APINotesReader Class Reference

A class that reads API notes data from a binary file that was written by the APINotesWriter. More...

#include "clang/APINotes/APINotesReader.h"

Classes

class  Implementation
class  VersionedInfo
 Captures the completed versioned information for a particular part of API notes, including both unversioned API notes and each versioned API note for that particular entity. More...

Public Member Functions

 ~APINotesReader ()
 APINotesReader (const APINotesReader &)=delete
APINotesReaderoperator= (const APINotesReader &)=delete
std::optional< ContextIDlookupObjCClassID (llvm::StringRef Name)
 Look for the context ID of the given Objective-C class.
VersionedInfo< ContextInfolookupObjCClassInfo (llvm::StringRef Name)
 Look for information regarding the given Objective-C class.
std::optional< ContextIDlookupObjCProtocolID (llvm::StringRef Name)
 Look for the context ID of the given Objective-C protocol.
VersionedInfo< ContextInfolookupObjCProtocolInfo (llvm::StringRef Name)
 Look for information regarding the given Objective-C protocol.
VersionedInfo< ObjCPropertyInfolookupObjCProperty (ContextID CtxID, llvm::StringRef Name, bool IsInstance)
 Look for information regarding the given Objective-C property in the given context.
VersionedInfo< ObjCMethodInfolookupObjCMethod (ContextID CtxID, ObjCSelectorRef Selector, bool IsInstanceMethod)
 Look for information regarding the given Objective-C method in the given context.
VersionedInfo< FieldInfolookupField (ContextID CtxID, llvm::StringRef Name)
 Look for information regarding the given field of a C struct.
VersionedInfo< CXXMethodInfolookupCXXMethod (ContextID CtxID, llvm::StringRef Name)
 Look for information regarding the given C++ method in the given C++ tag context.
VersionedInfo< CXXMethodInfolookupCXXMethod (ContextID CtxID, llvm::StringRef Name, llvm::ArrayRef< std::string > Parameters)
 Look for information regarding the given C++ method with an exact parameter selector.
std::optional< APINotesFunctionSelectorKeygetCXXMethodSelectorKey (ContextID CtxID, llvm::StringRef Name)
 Build the selector key for the given C++ method.
std::optional< APINotesFunctionSelectorKeygetCXXMethodSelectorKey (ContextID CtxID, llvm::StringRef Name, llvm::ArrayRef< std::string > Parameters)
 Build the selector key for the given C++ method with an exact parameter selector.
VersionedInfo< GlobalVariableInfolookupGlobalVariable (llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
 Look for information regarding the given global variable.
VersionedInfo< GlobalFunctionInfolookupGlobalFunction (llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
 Look for information regarding the given global function.
VersionedInfo< GlobalFunctionInfolookupGlobalFunction (llvm::StringRef Name, llvm::ArrayRef< std::string > Parameters, std::optional< Context > Ctx=std::nullopt)
 Look for information regarding the given global function with an exact parameter selector.
std::optional< APINotesFunctionSelectorKeygetGlobalFunctionSelectorKey (llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
 Build the selector key for the given global function.
std::optional< APINotesFunctionSelectorKeygetGlobalFunctionSelectorKey (llvm::StringRef Name, llvm::ArrayRef< std::string > Parameters, std::optional< Context > Ctx=std::nullopt)
 Build the selector key for the given global function with an exact parameter selector.
void collectExactFunctionParameterSelectors (llvm::SmallVectorImpl< APINotesFunctionSelectorKey > &Selectors)
 Collect exact parameter selector keys stored by this reader.
std::optional< llvm::SmallVector< std::string, 4 > > getParameterSelectorSpellingsForDiagnostics (const APINotesFunctionSelectorKey &Key)
 Reconstruct parameter selector strings for a stored exact selector key.
VersionedInfo< EnumConstantInfolookupEnumConstant (llvm::StringRef Name)
 Look for information regarding the given enumerator.
std::optional< ContextIDlookupTagID (llvm::StringRef Name, std::optional< Context > ParentCtx=std::nullopt)
 Look for the context ID of the given C++ tag.
VersionedInfo< TagInfolookupTag (llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
 Look for information regarding the given tag (struct/union/enum/C++ class).
VersionedInfo< TypedefInfolookupTypedef (llvm::StringRef Name, std::optional< Context > Ctx=std::nullopt)
 Look for information regarding the given typedef.
std::optional< ContextIDlookupNamespaceID (llvm::StringRef Name, std::optional< ContextID > ParentNamespaceID=std::nullopt)
 Look for the context ID of the given C++ namespace.
template<typename ParameterT>
auto lookupCXXMethodImpl (ContextID CtxID, llvm::StringRef Name, llvm::ArrayRef< ParameterT > Parameters) -> VersionedInfo< CXXMethodInfo >
template<typename ParameterT>
auto lookupGlobalFunctionImpl (llvm::StringRef Name, llvm::ArrayRef< ParameterT > Parameters, std::optional< Context > Ctx) -> VersionedInfo< GlobalFunctionInfo >

Static Public Member Functions

static llvm::Expected< std::unique_ptr< APINotesReader > > Create (std::unique_ptr< llvm::MemoryBuffer > InputBuffer, llvm::VersionTuple SwiftVersion)
 Create a new API notes reader from the given memory buffer, which contains the contents of a binary API notes file.

Detailed Description

A class that reads API notes data from a binary file that was written by the APINotesWriter.

Definition at line 33 of file APINotesReader.h.

Constructor & Destructor Documentation

◆ ~APINotesReader()

clang::api_notes::APINotesReader::~APINotesReader ( )

◆ APINotesReader()

clang::api_notes::APINotesReader::APINotesReader ( const APINotesReader & )
delete

Member Function Documentation

◆ collectExactFunctionParameterSelectors()

◆ Create()

llvm::Expected< std::unique_ptr< APINotesReader > > clang::api_notes::APINotesReader::Create ( std::unique_ptr< llvm::MemoryBuffer > InputBuffer,
llvm::VersionTuple SwiftVersion )
static

Create a new API notes reader from the given memory buffer, which contains the contents of a binary API notes file.

Returns
the new API notes reader, or an error if one occurred.

Definition at line 2235 of file APINotesReader.cpp.

◆ getCXXMethodSelectorKey() [1/2]

std::optional< APINotesFunctionSelectorKey > clang::api_notes::APINotesReader::getCXXMethodSelectorKey ( ContextID CtxID,
llvm::StringRef Name )

Build the selector key for the given C++ method.

Definition at line 2421 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getFunctionKey(), and clang::api_notes::ContextID::Value.

◆ getCXXMethodSelectorKey() [2/2]

std::optional< APINotesFunctionSelectorKey > clang::api_notes::APINotesReader::getCXXMethodSelectorKey ( ContextID CtxID,
llvm::StringRef Name,
llvm::ArrayRef< std::string > Parameters )

Build the selector key for the given C++ method with an exact parameter selector.

Definition at line 2430 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getFunctionKey(), and clang::api_notes::ContextID::Value.

◆ getGlobalFunctionSelectorKey() [1/2]

std::optional< APINotesFunctionSelectorKey > clang::api_notes::APINotesReader::getGlobalFunctionSelectorKey ( llvm::StringRef Name,
llvm::ArrayRef< std::string > Parameters,
std::optional< Context > Ctx = std::nullopt )

Build the selector key for the given global function with an exact parameter selector.

Definition at line 2518 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getFunctionKey().

◆ getGlobalFunctionSelectorKey() [2/2]

std::optional< APINotesFunctionSelectorKey > clang::api_notes::APINotesReader::getGlobalFunctionSelectorKey ( llvm::StringRef Name,
std::optional< Context > Ctx = std::nullopt )

Build the selector key for the given global function.

Definition at line 2508 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getFunctionKey().

◆ getParameterSelectorSpellingsForDiagnostics()

std::optional< llvm::SmallVector< std::string, 4 > > clang::api_notes::APINotesReader::getParameterSelectorSpellingsForDiagnostics ( const APINotesFunctionSelectorKey & Key)

◆ lookupCXXMethod() [1/2]

auto clang::api_notes::APINotesReader::lookupCXXMethod ( ContextID CtxID,
llvm::StringRef Name )

Look for information regarding the given C++ method in the given C++ tag context.

Parameters
CtxIDThe ID that references the parent context, i.e. a C++ tag.
NameThe name of the C++ method we're looking for.
Returns
Information about the method, if known.

Definition at line 2409 of file APINotesReader.cpp.

◆ lookupCXXMethod() [2/2]

auto clang::api_notes::APINotesReader::lookupCXXMethod ( ContextID CtxID,
llvm::StringRef Name,
llvm::ArrayRef< std::string > Parameters )

Look for information regarding the given C++ method with an exact parameter selector.

An empty parameter list uses an exact zero-parameter key, and a non-empty list uses an exact ordered parameter key.

Definition at line 2414 of file APINotesReader.cpp.

◆ lookupCXXMethodImpl()

template<typename ParameterT>
auto clang::api_notes::APINotesReader::lookupCXXMethodImpl ( ContextID CtxID,
llvm::StringRef Name,
llvm::ArrayRef< ParameterT > Parameters ) -> VersionedInfo<CXXMethodInfo>

◆ lookupEnumConstant()

auto clang::api_notes::APINotesReader::lookupEnumConstant ( llvm::StringRef Name)

Look for information regarding the given enumerator.

Parameters
NameThe name of the enumerator.
Returns
information about the enumerator, if known.

Definition at line 2593 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::EnumConstantTable, clang::api_notes::APINotesReader::Implementation::getIdentifier(), and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupField()

auto clang::api_notes::APINotesReader::lookupField ( ContextID CtxID,
llvm::StringRef Name )

Look for information regarding the given field of a C struct.

Parameters
NameThe name of the field.
Returns
information about the field, if known.

Definition at line 2392 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::FieldTable, clang::api_notes::APINotesReader::Implementation::getIdentifier(), and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupGlobalFunction() [1/2]

auto clang::api_notes::APINotesReader::lookupGlobalFunction ( llvm::StringRef Name,
llvm::ArrayRef< std::string > Parameters,
std::optional< Context > Ctx = std::nullopt )

Look for information regarding the given global function with an exact parameter selector.

An empty parameter list uses an exact zero-parameter key, and a non-empty list uses an exact ordered parameter key.

Definition at line 2501 of file APINotesReader.cpp.

◆ lookupGlobalFunction() [2/2]

auto clang::api_notes::APINotesReader::lookupGlobalFunction ( llvm::StringRef Name,
std::optional< Context > Ctx = std::nullopt )

Look for information regarding the given global function.

Parameters
NameThe name of the global function.
Returns
information about the global function, if known.

Definition at line 2495 of file APINotesReader.cpp.

◆ lookupGlobalFunctionImpl()

template<typename ParameterT>
auto clang::api_notes::APINotesReader::lookupGlobalFunctionImpl ( llvm::StringRef Name,
llvm::ArrayRef< ParameterT > Parameters,
std::optional< Context > Ctx ) -> VersionedInfo<GlobalFunctionInfo>

◆ lookupGlobalVariable()

auto clang::api_notes::APINotesReader::lookupGlobalVariable ( llvm::StringRef Name,
std::optional< Context > Ctx = std::nullopt )

Look for information regarding the given global variable.

Parameters
NameThe name of the global variable.
Returns
information about the global variable, if known.

Definition at line 2476 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getIdentifier(), clang::api_notes::APINotesReader::Implementation::GlobalVariableTable, and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupNamespaceID()

auto clang::api_notes::APINotesReader::lookupNamespaceID ( llvm::StringRef Name,
std::optional< ContextID > ParentNamespaceID = std::nullopt )

Look for the context ID of the given C++ namespace.

Parameters
NameThe name of the class we're looking for.
Returns
The ID, if known.

Definition at line 2664 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::ContextIDTable, clang::api_notes::APINotesReader::Implementation::getIdentifier(), and clang::api_notes::Namespace.

◆ lookupObjCClassID()

auto clang::api_notes::APINotesReader::lookupObjCClassID ( llvm::StringRef Name)

Look for the context ID of the given Objective-C class.

Parameters
NameThe name of the class we're looking for.
Returns
The ID, if known.

Definition at line 2285 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::ContextIDTable, clang::api_notes::APINotesReader::Implementation::getIdentifier(), and clang::api_notes::ObjCClass.

Referenced by lookupObjCClassInfo().

◆ lookupObjCClassInfo()

auto clang::api_notes::APINotesReader::lookupObjCClassInfo ( llvm::StringRef Name)

Look for information regarding the given Objective-C class.

Parameters
NameThe name of the class we're looking for.
Returns
The information about the class, if known.

Definition at line 2304 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::ContextInfoTable, lookupObjCClassID(), and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupObjCMethod()

auto clang::api_notes::APINotesReader::lookupObjCMethod ( ContextID CtxID,
ObjCSelectorRef Selector,
bool IsInstanceMethod )

Look for information regarding the given Objective-C method in the given context.

Parameters
CtxIDThe ID that references the context we are looking for.
SelectorThe selector naming the method we're looking for.
IsInstanceMethodWhether we are looking for an instance method.
Returns
Information about the method, if known.

Definition at line 2373 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getSelector(), clang::api_notes::APINotesReader::Implementation::ObjCMethodTable, and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupObjCProperty()

auto clang::api_notes::APINotesReader::lookupObjCProperty ( ContextID CtxID,
llvm::StringRef Name,
bool IsInstance )

Look for information regarding the given Objective-C property in the given context.

Parameters
CtxIDThe ID that references the context we are looking for.
NameThe name of the property we're looking for.
IsInstanceWhether we are looking for an instance property (vs. a class property).
Returns
Information about the property, if known.

Definition at line 2355 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getIdentifier(), clang::api_notes::APINotesReader::Implementation::ObjCPropertyTable, and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupObjCProtocolID()

auto clang::api_notes::APINotesReader::lookupObjCProtocolID ( llvm::StringRef Name)

Look for the context ID of the given Objective-C protocol.

Parameters
NameThe name of the protocol we're looking for.
Returns
The ID of the protocol, if known.

Definition at line 2320 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::ContextIDTable, clang::api_notes::APINotesReader::Implementation::getIdentifier(), and clang::api_notes::ObjCProtocol.

Referenced by lookupObjCProtocolInfo().

◆ lookupObjCProtocolInfo()

auto clang::api_notes::APINotesReader::lookupObjCProtocolInfo ( llvm::StringRef Name)

Look for information regarding the given Objective-C protocol.

Parameters
NameThe name of the protocol we're looking for.
Returns
The information about the protocol, if known.

Definition at line 2339 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::ContextInfoTable, lookupObjCProtocolID(), and clang::api_notes::APINotesReader::Implementation::SwiftVersion.

◆ lookupTag()

auto clang::api_notes::APINotesReader::lookupTag ( llvm::StringRef Name,
std::optional< Context > Ctx = std::nullopt )

Look for information regarding the given tag (struct/union/enum/C++ class).

Parameters
NameThe name of the tag.
Returns
information about the tag, if known.

Definition at line 2627 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getIdentifier(), clang::api_notes::APINotesReader::Implementation::SwiftVersion, and clang::api_notes::APINotesReader::Implementation::TagTable.

◆ lookupTagID()

auto clang::api_notes::APINotesReader::lookupTagID ( llvm::StringRef Name,
std::optional< Context > ParentCtx = std::nullopt )

Look for the context ID of the given C++ tag.

Parameters
NameThe name of the tag we're looking for.
ParentCtxThe context in which this tag is declared, e.g. a C++ namespace.
Returns
The ID, if known.

Definition at line 2609 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::ContextIDTable, clang::api_notes::APINotesReader::Implementation::getIdentifier(), and clang::api_notes::Tag.

◆ lookupTypedef()

auto clang::api_notes::APINotesReader::lookupTypedef ( llvm::StringRef Name,
std::optional< Context > Ctx = std::nullopt )

Look for information regarding the given typedef.

Parameters
NameThe name of the typedef.
Returns
information about the typedef, if known.

Definition at line 2645 of file APINotesReader.cpp.

References clang::api_notes::APINotesReader::Implementation::getIdentifier(), clang::api_notes::APINotesReader::Implementation::SwiftVersion, and clang::api_notes::APINotesReader::Implementation::TypedefTable.

◆ operator=()

APINotesReader & clang::api_notes::APINotesReader::operator= ( const APINotesReader & )
delete

The documentation for this class was generated from the following files: