clang 17.0.0git
|
APISet holds the set of API records collected from given inputs. More...
#include "clang/ExtractAPI/API.h"
Public Types | |
template<typename RecordTy , typename = std::enable_if_t<std::is_base_of<APIRecord, RecordTy>::value>> | |
using | RecordMap = llvm::MapVector< StringRef, std::unique_ptr< RecordTy > > |
A mapping type to store a set of APIRecords with the USR as the key. | |
Public Member Functions | |
GlobalVariableRecord * | addGlobalVar (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeadin, bool IsFromSystemHeaderg) |
Create and add a global variable record into the API set. | |
GlobalFunctionRecord * | addGlobalFunction (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader) |
Create and add a function record into the API set. | |
EnumConstantRecord * | addEnumConstant (EnumRecord *Enum, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader) |
Create and add an enum constant record into the API set. | |
EnumRecord * | addEnum (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader) |
Create and add an enum record into the API set. | |
StructFieldRecord * | addStructField (StructRecord *Struct, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader) |
Create and add a struct field record into the API set. | |
StructRecord * | addStruct (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader) |
Create and add a struct record into the API set. | |
ObjCCategoryRecord * | addObjCCategory (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference Interface, bool IsFromSystemHeader) |
Create and add an Objective-C category record into the API set. | |
ObjCInterfaceRecord * | addObjCInterface (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference SuperClass, bool IsFromSystemHeader) |
Create and add an Objective-C interface record into the API set. | |
ObjCMethodRecord * | addObjCMethod (ObjCContainerRecord *Container, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsInstanceMethod, bool IsFromSystemHeader) |
Create and add an Objective-C method record into the API set. | |
ObjCPropertyRecord * | addObjCProperty (ObjCContainerRecord *Container, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, ObjCPropertyRecord::AttributeKind Attributes, StringRef GetterName, StringRef SetterName, bool IsOptional, bool IsInstanceProperty, bool IsFromSystemHeader) |
Create and add an Objective-C property record into the API set. | |
ObjCInstanceVariableRecord * | addObjCInstanceVariable (ObjCContainerRecord *Container, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, ObjCInstanceVariableRecord::AccessControl Access, bool IsFromSystemHeader) |
Create and add an Objective-C instance variable record into the API set. | |
ObjCProtocolRecord * | addObjCProtocol (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader) |
Create and add an Objective-C protocol record into the API set. | |
MacroDefinitionRecord * | addMacroDefinition (StringRef Name, StringRef USR, PresumedLoc Loc, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader) |
Create a macro definition record into the API set. | |
TypedefRecord * | addTypedef (StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference UnderlyingType, bool IsFromSystemHeader) |
Create a typedef record into the API set. | |
const llvm::Triple & | getTarget () const |
Get the target triple for the ExtractAPI invocation. | |
Language | getLanguage () const |
Get the language used by the APIs. | |
const RecordMap< GlobalFunctionRecord > & | getGlobalFunctions () const |
const RecordMap< GlobalVariableRecord > & | getGlobalVariables () const |
const RecordMap< EnumRecord > & | getEnums () const |
const RecordMap< StructRecord > & | getStructs () const |
const RecordMap< ObjCCategoryRecord > & | getObjCCategories () const |
const RecordMap< ObjCInterfaceRecord > & | getObjCInterfaces () const |
const RecordMap< ObjCProtocolRecord > & | getObjCProtocols () const |
const RecordMap< MacroDefinitionRecord > & | getMacros () const |
const RecordMap< TypedefRecord > & | getTypedefs () const |
APIRecord * | findRecordForUSR (StringRef USR) const |
Finds the APIRecord for a given USR. | |
StringRef | recordUSR (const Decl *D) |
Generate and store the USR of declaration D . | |
StringRef | recordUSRForMacro (StringRef Name, SourceLocation SL, const SourceManager &SM) |
Generate and store the USR for a macro Name . | |
StringRef | copyString (StringRef String) |
Copy String into the Allocator in this APISet. | |
APISet (const llvm::Triple &Target, Language Lang, const std::string &ProductName) | |
Public Attributes | |
const std::string | ProductName |
APISet holds the set of API records collected from given inputs.
using clang::extractapi::APISet::RecordMap = llvm::MapVector<StringRef, std::unique_ptr<RecordTy> > |
|
inline |
Definition at line 832 of file API.h.
References clang::Target.
EnumRecord * APISet::addEnum | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an enum record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 85 of file API.cpp.
References clang::Declaration.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitEnumDecl().
EnumConstantRecord * APISet::addEnumConstant | ( | EnumRecord * | Enum, |
StringRef | Name, | ||
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an enum constant record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 69 of file API.cpp.
References clang::Declaration, and Enum.
GlobalFunctionRecord * APISet::addGlobalFunction | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
LinkageInfo | Linkage, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
FunctionSignature | Signature, | ||
bool | IsFromSystemHeader | ||
) |
Create and add a function record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 57 of file API.cpp.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitFunctionDecl().
GlobalVariableRecord * APISet::addGlobalVar | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
LinkageInfo | Linkage, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeadin, | ||
bool | IsFromSystemHeaderg | ||
) |
Create and add a global variable record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 48 of file API.cpp.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitVarDecl().
MacroDefinitionRecord * APISet::addMacroDefinition | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
bool | IsFromSystemHeader | ||
) |
Create a macro definition record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSRForMacro(StringRef Name,
SourceLocation SL, const SourceManager &SM) is a helper method to generate the USR for the macro and keep it alive in APISet.
Definition at line 229 of file API.cpp.
References clang::Declaration.
ObjCCategoryRecord * APISet::addObjCCategory | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
SymbolReference | Interface, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an Objective-C category record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 123 of file API.cpp.
References clang::Declaration, and clang::extractapi::SymbolReference::USR.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitObjCCategoryDecl().
ObjCInstanceVariableRecord * APISet::addObjCInstanceVariable | ( | ObjCContainerRecord * | Container, |
StringRef | Name, | ||
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
ObjCInstanceVariableRecord::AccessControl | Access, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an Objective-C instance variable record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 202 of file API.cpp.
References clang::Declaration.
ObjCInterfaceRecord * APISet::addObjCInterface | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
LinkageInfo | Linkage, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
SymbolReference | SuperClass, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an Objective-C interface record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 144 of file API.cpp.
References clang::Declaration.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitObjCInterfaceDecl().
ObjCMethodRecord * APISet::addObjCMethod | ( | ObjCContainerRecord * | Container, |
StringRef | Name, | ||
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
FunctionSignature | Signature, | ||
bool | IsInstanceMethod, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an Objective-C method record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 156 of file API.cpp.
References clang::Declaration.
ObjCPropertyRecord * APISet::addObjCProperty | ( | ObjCContainerRecord * | Container, |
StringRef | Name, | ||
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
ObjCPropertyRecord::AttributeKind | Attributes, | ||
StringRef | GetterName, | ||
StringRef | SetterName, | ||
bool | IsOptional, | ||
bool | IsInstanceProperty, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an Objective-C property record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 178 of file API.cpp.
References clang::Declaration.
ObjCProtocolRecord * APISet::addObjCProtocol | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
bool | IsFromSystemHeader | ||
) |
Create and add an Objective-C protocol record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 216 of file API.cpp.
References clang::Declaration.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitObjCProtocolDecl().
StructRecord * APISet::addStruct | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
bool | IsFromSystemHeader | ||
) |
Create and add a struct record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 112 of file API.cpp.
References clang::Declaration.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitRecordDecl().
StructFieldRecord * APISet::addStructField | ( | StructRecord * | Struct, |
StringRef | Name, | ||
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
bool | IsFromSystemHeader | ||
) |
Create and add a struct field record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 96 of file API.cpp.
References clang::Declaration.
TypedefRecord * APISet::addTypedef | ( | StringRef | Name, |
StringRef | USR, | ||
PresumedLoc | Loc, | ||
AvailabilitySet | Availability, | ||
const DocComment & | Comment, | ||
DeclarationFragments | Declaration, | ||
DeclarationFragments | SubHeading, | ||
SymbolReference | UnderlyingType, | ||
bool | IsFromSystemHeader | ||
) |
Create a typedef record into the API set.
Note: the caller is responsible for keeping the StringRef Name
and USR
alive. APISet::copyString provides a way to copy strings into APISet itself, and APISet::recordUSR(const Decl *D) is a helper method to generate the USR for D
and keep it alive in APISet.
Definition at line 238 of file API.cpp.
References clang::Declaration.
Referenced by clang::extractapi::ExtractAPIVisitor::VisitTypedefNameDecl().
StringRef APISet::copyString | ( | StringRef | String | ) |
Copy String
into the Allocator in this APISet.
Definition at line 271 of file API.cpp.
References memcpy().
Referenced by clang::extractapi::TypedefUnderlyingTypeResolver::getSymbolReferenceForType(), recordUSR(), recordUSRForMacro(), and clang::extractapi::ExtractAPIVisitor::VisitEnumDecl().
APIRecord * APISet::findRecordForUSR | ( | StringRef | USR | ) | const |
Finds the APIRecord for a given USR.
Definition at line 248 of file API.cpp.
Referenced by clang::extractapi::SymbolGraphSerializer::serializeSingleSymbolSGF().
|
inline |
Definition at line 793 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
Definition at line 787 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
Definition at line 790 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
Get the language used by the APIs.
Definition at line 785 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serializeSingleSymbolSGF().
|
inline |
Definition at line 804 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
|
inline |
Definition at line 798 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
Definition at line 801 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
Definition at line 794 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
|
inline |
|
inline |
Definition at line 805 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serialize().
StringRef APISet::recordUSR | ( | const Decl * | D | ) |
Generate and store the USR of declaration D
.
Note: The USR string is stored in and owned by Allocator.
Definition at line 258 of file API.cpp.
References copyString(), and clang::index::generateUSRForDecl().
Referenced by clang::extractapi::ExtractAPIVisitor::VisitEnumDecl(), clang::extractapi::ExtractAPIVisitor::VisitFunctionDecl(), clang::extractapi::ExtractAPIVisitor::VisitObjCCategoryDecl(), clang::extractapi::ExtractAPIVisitor::VisitObjCInterfaceDecl(), clang::extractapi::ExtractAPIVisitor::VisitObjCProtocolDecl(), clang::extractapi::ExtractAPIVisitor::VisitRecordDecl(), clang::extractapi::ExtractAPIVisitor::VisitTypedefNameDecl(), and clang::extractapi::ExtractAPIVisitor::VisitVarDecl().
StringRef APISet::recordUSRForMacro | ( | StringRef | Name, |
SourceLocation | SL, | ||
const SourceManager & | SM | ||
) |
Generate and store the USR for a macro Name
.
Note: The USR string is stored in and owned by Allocator.
Definition at line 264 of file API.cpp.
References copyString(), clang::index::generateUSRForMacro(), and SM.
const std::string clang::extractapi::APISet::ProductName |
Definition at line 857 of file API.h.
Referenced by clang::extractapi::SymbolGraphSerializer::serializeSingleSymbolSGF().