Skip to content

[clang-doc][NFC] Use LLVM style naming in YAMLGenerator.cpp #136393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions clang-tools-extra/clang-doc/YAMLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ template <> struct ScalarTraits<std::array<unsigned char, 20>> {
std::array<unsigned char, 20> &Value) {
if (Scalar.size() != 40)
return "Error: Incorrect scalar size for USR.";
Value = StringToSymbol(Scalar);
Value = stringToSymbol(Scalar);
return StringRef();
}

static SymbolID StringToSymbol(llvm::StringRef Value) {
static SymbolID stringToSymbol(llvm::StringRef Value) {
SymbolID USR;
std::string HexString = fromHex(Value);
std::copy(HexString.begin(), HexString.end(), USR.begin());
Expand All @@ -108,32 +108,32 @@ template <> struct ScalarTraits<std::array<unsigned char, 20>> {

// Helper functions to map infos to YAML.

static void TypeInfoMapping(IO &IO, TypeInfo &I) {
static void typeInfoMapping(IO &IO, TypeInfo &I) {
IO.mapOptional("Type", I.Type, Reference());
}

static void FieldTypeInfoMapping(IO &IO, FieldTypeInfo &I) {
TypeInfoMapping(IO, I);
static void fieldTypeInfoMapping(IO &IO, FieldTypeInfo &I) {
typeInfoMapping(IO, I);
IO.mapOptional("Name", I.Name, SmallString<16>());
IO.mapOptional("DefaultValue", I.DefaultValue, SmallString<16>());
}

static void InfoMapping(IO &IO, Info &I) {
static void infoMapping(IO &IO, Info &I) {
IO.mapRequired("USR", I.USR);
IO.mapOptional("Name", I.Name, SmallString<16>());
IO.mapOptional("Path", I.Path, SmallString<128>());
IO.mapOptional("Namespace", I.Namespace, llvm::SmallVector<Reference, 4>());
IO.mapOptional("Description", I.Description);
}

static void SymbolInfoMapping(IO &IO, SymbolInfo &I) {
InfoMapping(IO, I);
static void symbolInfoMapping(IO &IO, SymbolInfo &I) {
infoMapping(IO, I);
IO.mapOptional("DefLocation", I.DefLoc, std::optional<Location>());
IO.mapOptional("Location", I.Loc, llvm::SmallVector<Location, 2>());
}

static void RecordInfoMapping(IO &IO, RecordInfo &I) {
SymbolInfoMapping(IO, I);
static void recordInfoMapping(IO &IO, RecordInfo &I) {
symbolInfoMapping(IO, I);
IO.mapOptional("TagType", I.TagType);
IO.mapOptional("IsTypeDef", I.IsTypeDef, false);
IO.mapOptional("Members", I.Members);
Expand All @@ -148,7 +148,7 @@ static void RecordInfoMapping(IO &IO, RecordInfo &I) {
IO.mapOptional("Template", I.Template);
}

static void CommentInfoMapping(IO &IO, CommentInfo &I) {
static void commentInfoMapping(IO &IO, CommentInfo &I) {
IO.mapOptional("Kind", I.Kind, SmallString<16>());
IO.mapOptional("Text", I.Text, SmallString<64>());
IO.mapOptional("Name", I.Name, SmallString<16>());
Expand Down Expand Up @@ -185,20 +185,20 @@ template <> struct MappingTraits<Reference> {
};

template <> struct MappingTraits<TypeInfo> {
static void mapping(IO &IO, TypeInfo &I) { TypeInfoMapping(IO, I); }
static void mapping(IO &IO, TypeInfo &I) { typeInfoMapping(IO, I); }
};

template <> struct MappingTraits<FieldTypeInfo> {
static void mapping(IO &IO, FieldTypeInfo &I) {
TypeInfoMapping(IO, I);
typeInfoMapping(IO, I);
IO.mapOptional("Name", I.Name, SmallString<16>());
IO.mapOptional("DefaultValue", I.DefaultValue, SmallString<16>());
}
};

template <> struct MappingTraits<MemberTypeInfo> {
static void mapping(IO &IO, MemberTypeInfo &I) {
FieldTypeInfoMapping(IO, I);
fieldTypeInfoMapping(IO, I);
// clang::AccessSpecifier::AS_none is used as the default here because it's
// the AS that shouldn't be part of the output. Even though AS_public is the
// default in the struct, it should be displayed in the YAML output.
Expand All @@ -209,7 +209,7 @@ template <> struct MappingTraits<MemberTypeInfo> {

template <> struct MappingTraits<NamespaceInfo> {
static void mapping(IO &IO, NamespaceInfo &I) {
InfoMapping(IO, I);
infoMapping(IO, I);
IO.mapOptional("ChildNamespaces", I.Children.Namespaces,
std::vector<Reference>());
IO.mapOptional("ChildRecords", I.Children.Records,
Expand All @@ -221,12 +221,12 @@ template <> struct MappingTraits<NamespaceInfo> {
};

template <> struct MappingTraits<RecordInfo> {
static void mapping(IO &IO, RecordInfo &I) { RecordInfoMapping(IO, I); }
static void mapping(IO &IO, RecordInfo &I) { recordInfoMapping(IO, I); }
};

template <> struct MappingTraits<BaseRecordInfo> {
static void mapping(IO &IO, BaseRecordInfo &I) {
RecordInfoMapping(IO, I);
recordInfoMapping(IO, I);
IO.mapOptional("IsVirtual", I.IsVirtual, false);
// clang::AccessSpecifier::AS_none is used as the default here because it's
// the AS that shouldn't be part of the output. Even though AS_public is the
Expand All @@ -246,7 +246,7 @@ template <> struct MappingTraits<EnumValueInfo> {

template <> struct MappingTraits<EnumInfo> {
static void mapping(IO &IO, EnumInfo &I) {
SymbolInfoMapping(IO, I);
symbolInfoMapping(IO, I);
IO.mapOptional("Scoped", I.Scoped, false);
IO.mapOptional("BaseType", I.BaseType);
IO.mapOptional("Members", I.Members);
Expand All @@ -255,15 +255,15 @@ template <> struct MappingTraits<EnumInfo> {

template <> struct MappingTraits<TypedefInfo> {
static void mapping(IO &IO, TypedefInfo &I) {
SymbolInfoMapping(IO, I);
symbolInfoMapping(IO, I);
IO.mapOptional("Underlying", I.Underlying.Type);
IO.mapOptional("IsUsing", I.IsUsing, false);
}
};

template <> struct MappingTraits<FunctionInfo> {
static void mapping(IO &IO, FunctionInfo &I) {
SymbolInfoMapping(IO, I);
symbolInfoMapping(IO, I);
IO.mapOptional("IsMethod", I.IsMethod, false);
IO.mapOptional("Parent", I.Parent, Reference());
IO.mapOptional("Params", I.Params);
Expand Down Expand Up @@ -298,13 +298,13 @@ template <> struct MappingTraits<TemplateInfo> {
};

template <> struct MappingTraits<CommentInfo> {
static void mapping(IO &IO, CommentInfo &I) { CommentInfoMapping(IO, I); }
static void mapping(IO &IO, CommentInfo &I) { commentInfoMapping(IO, I); }
};

template <> struct MappingTraits<std::unique_ptr<CommentInfo>> {
static void mapping(IO &IO, std::unique_ptr<CommentInfo> &I) {
if (I)
CommentInfoMapping(IO, *I);
commentInfoMapping(IO, *I);
}
};

Expand Down
Loading