#include "clang/ExtractAPI/Serialization/SymbolGraphSerializer.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Version.h"
#include "clang/ExtractAPI/API.h"
#include "clang/ExtractAPI/DeclarationFragments.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include <iterator>
#include <optional>
#include <type_traits>
usingnamespaceclang;
usingnamespaceclang::extractapi;
usingnamespacellvm;
namespace {
void serializeObject(Object &Paren, StringRef Key,
std::optional<Object> &&Obj) { … }
void serializeArray(Object &Paren, StringRef Key,
std::optional<Array> &&Array) { … }
template <typename ContainerTy>
void serializeArray(Object &Paren, StringRef Key, ContainerTy &&C) { … }
std::optional<Object> serializeSemanticVersion(const VersionTuple &V) { … }
Object serializeOperatingSystem(const Triple &T) { … }
Object serializePlatform(const Triple &T) { … }
Object serializeSourcePosition(const PresumedLoc &Loc) { … }
Object serializeSourceLocation(const PresumedLoc &Loc,
bool IncludeFileURI = false) { … }
Object serializeSourceRange(const PresumedLoc &BeginLoc,
const PresumedLoc &EndLoc) { … }
std::optional<Array> serializeAvailability(const AvailabilityInfo &Avail) { … }
StringRef getLanguageName(Language Lang) { … }
Object serializeIdentifier(const APIRecord &Record, Language Lang) { … }
std::optional<Object> serializeDocComment(const DocComment &Comment) { … }
std::optional<Array>
serializeDeclarationFragments(const DeclarationFragments &DF) { … }
Object serializeNames(const APIRecord *Record) { … }
Object serializeSymbolKind(APIRecord::RecordKind RK, Language Lang) { … }
Object serializeSymbolKind(const APIRecord &Record, Language Lang) { … }
template <typename RecordTy>
void serializeFunctionSignatureMixin(Object &Paren, const RecordTy &Record) { … }
template <typename RecordTy>
void serializeTemplateMixin(Object &Paren, const RecordTy &Record) { … }
Array generateParentContexts(const SmallVectorImpl<SymbolReference> &Parents,
Language Lang) { … }
SmallVector<SymbolReference, 8>
generateHierarchyFromRecord(const APIRecord *Record) { … }
SymbolReference getHierarchyReference(const APIRecord *Record,
const APISet &API) { … }
}
Object *ExtendedModule::addSymbol(Object &&Symbol) { … }
void ExtendedModule::addRelationship(Object &&Relationship) { … }
const VersionTuple SymbolGraphSerializer::FormatVersion{ … };
Object SymbolGraphSerializer::serializeMetadata() const { … }
Object
SymbolGraphSerializer::serializeModuleObject(StringRef ModuleName) const { … }
bool SymbolGraphSerializer::shouldSkip(const APIRecord *Record) const { … }
ExtendedModule &SymbolGraphSerializer::getModuleForCurrentSymbol() { … }
Array SymbolGraphSerializer::serializePathComponents(
const APIRecord *Record) const { … }
StringRef SymbolGraphSerializer::getRelationshipString(RelationshipKind Kind) { … }
void SymbolGraphSerializer::serializeRelationship(RelationshipKind Kind,
const SymbolReference &Source,
const SymbolReference &Target,
ExtendedModule &Into) { … }
StringRef SymbolGraphSerializer::getConstraintString(ConstraintKind Kind) { … }
void SymbolGraphSerializer::serializeAPIRecord(const APIRecord *Record) { … }
bool SymbolGraphSerializer::traverseAPIRecord(const APIRecord *Record) { … }
bool SymbolGraphSerializer::visitAPIRecord(const APIRecord *Record) { … }
bool SymbolGraphSerializer::visitGlobalFunctionRecord(
const GlobalFunctionRecord *Record) { … }
bool SymbolGraphSerializer::visitCXXClassRecord(const CXXClassRecord *Record) { … }
bool SymbolGraphSerializer::visitClassTemplateRecord(
const ClassTemplateRecord *Record) { … }
bool SymbolGraphSerializer::visitClassTemplatePartialSpecializationRecord(
const ClassTemplatePartialSpecializationRecord *Record) { … }
bool SymbolGraphSerializer::visitCXXMethodRecord(
const CXXMethodRecord *Record) { … }
bool SymbolGraphSerializer::visitCXXMethodTemplateRecord(
const CXXMethodTemplateRecord *Record) { … }
bool SymbolGraphSerializer::visitCXXFieldTemplateRecord(
const CXXFieldTemplateRecord *Record) { … }
bool SymbolGraphSerializer::visitConceptRecord(const ConceptRecord *Record) { … }
bool SymbolGraphSerializer::visitGlobalVariableTemplateRecord(
const GlobalVariableTemplateRecord *Record) { … }
bool SymbolGraphSerializer::
visitGlobalVariableTemplatePartialSpecializationRecord(
const GlobalVariableTemplatePartialSpecializationRecord *Record) { … }
bool SymbolGraphSerializer::visitGlobalFunctionTemplateRecord(
const GlobalFunctionTemplateRecord *Record) { … }
bool SymbolGraphSerializer::visitObjCContainerRecord(
const ObjCContainerRecord *Record) { … }
bool SymbolGraphSerializer::visitObjCInterfaceRecord(
const ObjCInterfaceRecord *Record) { … }
bool SymbolGraphSerializer::traverseObjCCategoryRecord(
const ObjCCategoryRecord *Record) { … }
bool SymbolGraphSerializer::walkUpFromObjCCategoryRecord(
const ObjCCategoryRecord *Record) { … }
bool SymbolGraphSerializer::visitObjCCategoryRecord(
const ObjCCategoryRecord *Record) { … }
bool SymbolGraphSerializer::visitObjCMethodRecord(
const ObjCMethodRecord *Record) { … }
bool SymbolGraphSerializer::visitObjCInstanceVariableRecord(
const ObjCInstanceVariableRecord *Record) { … }
bool SymbolGraphSerializer::walkUpFromTypedefRecord(
const TypedefRecord *Record) { … }
bool SymbolGraphSerializer::visitTypedefRecord(const TypedefRecord *Record) { … }
void SymbolGraphSerializer::serializeSingleRecord(const APIRecord *Record) { … }
Object SymbolGraphSerializer::serializeGraph(StringRef ModuleName,
ExtendedModule &&EM) { … }
void SymbolGraphSerializer::serializeGraphToStream(
raw_ostream &OS, SymbolGraphSerializerOption Options, StringRef ModuleName,
ExtendedModule &&EM) { … }
void SymbolGraphSerializer::serializeMainSymbolGraph(
raw_ostream &OS, const APISet &API, const APIIgnoresList &IgnoresList,
SymbolGraphSerializerOption Options) { … }
void SymbolGraphSerializer::serializeWithExtensionGraphs(
raw_ostream &MainOutput, const APISet &API,
const APIIgnoresList &IgnoresList,
llvm::function_ref<std::unique_ptr<llvm::raw_pwrite_stream>(Twine BaseName)>
CreateOutputStream,
SymbolGraphSerializerOption Options) { … }
std::optional<Object>
SymbolGraphSerializer::serializeSingleSymbolSGF(StringRef USR,
const APISet &API) { … }