clang 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
clang::extractapi::SymbolGraphSerializer Class Reference

The visitor that organizes API information in the Symbol Graph format. More...

#include "clang/ExtractAPI/Serialization/SymbolGraphSerializer.h"

Inheritance diagram for clang::extractapi::SymbolGraphSerializer:
Inheritance graph
[legend]

Public Member Functions

bool traverseAPIRecord (const APIRecord *Record)
 
bool visitAPIRecord (const APIRecord *Record)
 
bool visitGlobalFunctionRecord (const GlobalFunctionRecord *Record)
 Visit a global function record.
 
bool visitCXXClassRecord (const CXXClassRecord *Record)
 
bool visitClassTemplateRecord (const ClassTemplateRecord *Record)
 
bool visitClassTemplatePartialSpecializationRecord (const ClassTemplatePartialSpecializationRecord *Record)
 
bool visitCXXMethodRecord (const CXXMethodRecord *Record)
 
bool visitCXXMethodTemplateRecord (const CXXMethodTemplateRecord *Record)
 
bool visitCXXFieldTemplateRecord (const CXXFieldTemplateRecord *Record)
 
bool visitConceptRecord (const ConceptRecord *Record)
 
bool visitGlobalVariableTemplateRecord (const GlobalVariableTemplateRecord *Record)
 
bool visitGlobalVariableTemplatePartialSpecializationRecord (const GlobalVariableTemplatePartialSpecializationRecord *Record)
 
bool visitGlobalFunctionTemplateRecord (const GlobalFunctionTemplateRecord *Record)
 
bool visitObjCContainerRecord (const ObjCContainerRecord *Record)
 
bool visitObjCInterfaceRecord (const ObjCInterfaceRecord *Record)
 
bool traverseObjCCategoryRecord (const ObjCCategoryRecord *Record)
 
bool walkUpFromObjCCategoryRecord (const ObjCCategoryRecord *Record)
 
bool visitObjCCategoryRecord (const ObjCCategoryRecord *Record)
 
bool visitObjCMethodRecord (const ObjCMethodRecord *Record)
 
bool visitObjCInstanceVariableRecord (const ObjCInstanceVariableRecord *Record)
 
bool walkUpFromTypedefRecord (const TypedefRecord *Record)
 
bool visitTypedefRecord (const TypedefRecord *Record)
 
 SymbolGraphSerializer (const APISet &API, const APIIgnoresList &IgnoresList, bool EmitSymbolLabelsForTesting=false, bool ForceEmitToMainModule=false, bool SkipSymbolsInCategoriesToExternalTypes=false)
 
- Public Member Functions inherited from clang::extractapi::APISetVisitor< SymbolGraphSerializer >
bool traverseAPISet ()
 
bool traverseAPIRecord (const APIRecord *Record)
 
bool walkUpFromAPIRecord (const APIRecord *Record)
 
bool visitAPIRecord (const APIRecord *Record)
 
bool traverseRecordContext (const RecordContext *)
 
 APISetVisitor ()=delete
 
 APISetVisitor (const APISetVisitor &)=delete
 
 APISetVisitor (APISetVisitor &&)=delete
 
APISetVisitoroperator= (const APISetVisitor &)=delete
 
APISetVisitoroperator= (APISetVisitor &&)=delete
 

Static Public Member Functions

static void serializeMainSymbolGraph (raw_ostream &OS, const APISet &API, const APIIgnoresList &IgnoresList, SymbolGraphSerializerOption Options={})
 
static void serializeWithExtensionGraphs (raw_ostream &MainOutput, const APISet &API, const APIIgnoresList &IgnoresList, llvm::function_ref< std::unique_ptr< llvm::raw_pwrite_stream >(llvm::Twine BaseFileName)> CreateOutputStream, SymbolGraphSerializerOption Options={})
 
static std::optional< Object > serializeSingleSymbolSGF (StringRef USR, const APISet &API)
 Serialize a single symbol SGF.
 

Additional Inherited Members

- Protected Member Functions inherited from clang::extractapi::APISetVisitor< SymbolGraphSerializer >
 APISetVisitor (const APISet &API)
 
 ~APISetVisitor ()=default
 
SymbolGraphSerializergetDerived ()
 
- Protected Attributes inherited from clang::extractapi::APISetVisitor< SymbolGraphSerializer >
const APISetAPI
 

Detailed Description

The visitor that organizes API information in the Symbol Graph format.

The Symbol Graph format (https://github.com/apple/swift-docc-symbolkit) models an API set as a directed graph, where nodes are symbol declarations, and edges are relationships between the connected symbols.

Definition at line 74 of file SymbolGraphSerializer.h.

Constructor & Destructor Documentation

◆ SymbolGraphSerializer()

clang::extractapi::SymbolGraphSerializer::SymbolGraphSerializer ( const APISet API,
const APIIgnoresList IgnoresList,
bool  EmitSymbolLabelsForTesting = false,
bool  ForceEmitToMainModule = false,
bool  SkipSymbolsInCategoriesToExternalTypes = false 
)
inline

Definition at line 273 of file SymbolGraphSerializer.h.

Member Function Documentation

◆ serializeMainSymbolGraph()

void SymbolGraphSerializer::serializeMainSymbolGraph ( raw_ostream &  OS,
const APISet API,
const APIIgnoresList IgnoresList,
SymbolGraphSerializerOption  Options = {} 
)
static

◆ serializeSingleSymbolSGF()

std::optional< Object > SymbolGraphSerializer::serializeSingleSymbolSGF ( StringRef  USR,
const APISet API 
)
static

Serialize a single symbol SGF.

This is primarily used for libclang.

Returns
an optional JSON Object representing the payload that libclang expects for providing symbol information for a single symbol. If this is not a known symbol returns std::nullopt.

Definition at line 1079 of file SymbolGraphSerializer.cpp.

References clang::extractapi::APIRecord::Access, clang::extractapi::APISetVisitor< SymbolGraphSerializer >::API, clang::extractapi::APISet::findRecordForUSR(), clang::extractapi::AccessControl::getAccess(), clang::PresumedLoc::getFilename(), clang::extractapi::APISet::getLanguage(), clang::extractapi::APIRecord::IsFromSystemHeader, clang::extractapi::APIRecord::Location, clang::extractapi::APISet::ProductName, and clang::extractapi::APIRecord::USR.

◆ serializeWithExtensionGraphs()

void SymbolGraphSerializer::serializeWithExtensionGraphs ( raw_ostream &  MainOutput,
const APISet API,
const APIIgnoresList IgnoresList,
llvm::function_ref< std::unique_ptr< llvm::raw_pwrite_stream >(llvm::Twine BaseFileName)>  CreateOutputStream,
SymbolGraphSerializerOption  Options = {} 
)
static

◆ traverseAPIRecord()

bool SymbolGraphSerializer::traverseAPIRecord ( const APIRecord Record)

◆ traverseObjCCategoryRecord()

bool SymbolGraphSerializer::traverseObjCCategoryRecord ( const ObjCCategoryRecord Record)

◆ visitAPIRecord()

bool SymbolGraphSerializer::visitAPIRecord ( const APIRecord Record)

Definition at line 796 of file SymbolGraphSerializer.cpp.

◆ visitClassTemplatePartialSpecializationRecord()

bool SymbolGraphSerializer::visitClassTemplatePartialSpecializationRecord ( const ClassTemplatePartialSpecializationRecord Record)

Definition at line 829 of file SymbolGraphSerializer.cpp.

◆ visitClassTemplateRecord()

bool SymbolGraphSerializer::visitClassTemplateRecord ( const ClassTemplateRecord Record)

Definition at line 820 of file SymbolGraphSerializer.cpp.

◆ visitConceptRecord()

bool SymbolGraphSerializer::visitConceptRecord ( const ConceptRecord Record)

Definition at line 865 of file SymbolGraphSerializer.cpp.

◆ visitCXXClassRecord()

bool SymbolGraphSerializer::visitCXXClassRecord ( const CXXClassRecord Record)

Definition at line 810 of file SymbolGraphSerializer.cpp.

◆ visitCXXFieldTemplateRecord()

bool SymbolGraphSerializer::visitCXXFieldTemplateRecord ( const CXXFieldTemplateRecord Record)

Definition at line 856 of file SymbolGraphSerializer.cpp.

◆ visitCXXMethodRecord()

bool SymbolGraphSerializer::visitCXXMethodRecord ( const CXXMethodRecord Record)

Definition at line 838 of file SymbolGraphSerializer.cpp.

◆ visitCXXMethodTemplateRecord()

bool SymbolGraphSerializer::visitCXXMethodTemplateRecord ( const CXXMethodTemplateRecord Record)

Definition at line 847 of file SymbolGraphSerializer.cpp.

◆ visitGlobalFunctionRecord()

bool SymbolGraphSerializer::visitGlobalFunctionRecord ( const GlobalFunctionRecord Record)

Visit a global function record.

Definition at line 801 of file SymbolGraphSerializer.cpp.

◆ visitGlobalFunctionTemplateRecord()

bool SymbolGraphSerializer::visitGlobalFunctionTemplateRecord ( const GlobalFunctionTemplateRecord Record)

Definition at line 892 of file SymbolGraphSerializer.cpp.

◆ visitGlobalVariableTemplatePartialSpecializationRecord()

bool SymbolGraphSerializer::visitGlobalVariableTemplatePartialSpecializationRecord ( const GlobalVariableTemplatePartialSpecializationRecord Record)

Definition at line 882 of file SymbolGraphSerializer.cpp.

◆ visitGlobalVariableTemplateRecord()

bool SymbolGraphSerializer::visitGlobalVariableTemplateRecord ( const GlobalVariableTemplateRecord Record)

Definition at line 873 of file SymbolGraphSerializer.cpp.

◆ visitObjCCategoryRecord()

bool SymbolGraphSerializer::visitObjCCategoryRecord ( const ObjCCategoryRecord Record)

Definition at line 947 of file SymbolGraphSerializer.cpp.

Referenced by walkUpFromObjCCategoryRecord().

◆ visitObjCContainerRecord()

bool SymbolGraphSerializer::visitObjCContainerRecord ( const ObjCContainerRecord Record)

Definition at line 901 of file SymbolGraphSerializer.cpp.

◆ visitObjCInstanceVariableRecord()

bool SymbolGraphSerializer::visitObjCInstanceVariableRecord ( const ObjCInstanceVariableRecord Record)

Definition at line 968 of file SymbolGraphSerializer.cpp.

◆ visitObjCInterfaceRecord()

bool SymbolGraphSerializer::visitObjCInterfaceRecord ( const ObjCInterfaceRecord Record)

Definition at line 913 of file SymbolGraphSerializer.cpp.

◆ visitObjCMethodRecord()

bool SymbolGraphSerializer::visitObjCMethodRecord ( const ObjCMethodRecord Record)

Definition at line 959 of file SymbolGraphSerializer.cpp.

◆ visitTypedefRecord()

bool SymbolGraphSerializer::visitTypedefRecord ( const TypedefRecord Record)

Definition at line 982 of file SymbolGraphSerializer.cpp.

Referenced by walkUpFromTypedefRecord().

◆ walkUpFromObjCCategoryRecord()

bool SymbolGraphSerializer::walkUpFromObjCCategoryRecord ( const ObjCCategoryRecord Record)

Definition at line 942 of file SymbolGraphSerializer.cpp.

References visitObjCCategoryRecord().

Referenced by traverseObjCCategoryRecord().

◆ walkUpFromTypedefRecord()

bool SymbolGraphSerializer::walkUpFromTypedefRecord ( const TypedefRecord Record)

Definition at line 974 of file SymbolGraphSerializer.cpp.

References visitTypedefRecord().


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