clang-tools 23.0.0git
YAMLGenerator.cpp
Go to the documentation of this file.
1//===-- YAMLGenerator.cpp - ClangDoc YAML -----------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8// Implementation of the YAML generator, converting decl info into YAML output.
9//===----------------------------------------------------------------------===//
10
11#include "Generators.h"
12#include "Representation.h"
13#include "llvm/ADT/STLExtras.h"
14#include "llvm/Support/YAMLTraits.h"
15#include "llvm/Support/raw_ostream.h"
16#include <optional>
17
18using namespace clang::doc;
19
20// These define YAML traits for decoding the listed values within a vector.
21LLVM_YAML_IS_SEQUENCE_VECTOR(FieldTypeInfo)
22LLVM_YAML_IS_SEQUENCE_VECTOR(MemberTypeInfo)
23LLVM_YAML_IS_SEQUENCE_VECTOR(Reference)
24LLVM_YAML_IS_SEQUENCE_VECTOR(Location)
25LLVM_YAML_IS_SEQUENCE_VECTOR(CommentInfo)
26LLVM_YAML_IS_SEQUENCE_VECTOR(FunctionInfo)
27LLVM_YAML_IS_SEQUENCE_VECTOR(EnumInfo)
28LLVM_YAML_IS_SEQUENCE_VECTOR(EnumValueInfo)
29LLVM_YAML_IS_SEQUENCE_VECTOR(TemplateParamInfo)
30LLVM_YAML_IS_SEQUENCE_VECTOR(TypedefInfo)
31LLVM_YAML_IS_SEQUENCE_VECTOR(BaseRecordInfo)
32
33namespace llvm {
34
35namespace yaml {
36
37// Provide SequenceTraits for ArrayRef<T*> since YAMLTraits only provides it for
38// MutableArrayRef
39template <typename T> struct SequenceTraits<ArrayRef<T *>> {
40 static size_t size(IO &io, ArrayRef<T *> &seq) { return seq.size(); }
41 static T *&element(IO &io, ArrayRef<T *> &seq, size_t index) {
42 // ArrayRef is not mutable, but YAML output only reads the value.
43 return const_cast<T *&>(seq[index]);
44 }
45};
46
47template <typename T> struct SequenceTraits<llvm::simple_ilist<T>> {
48 static size_t size(IO &io, llvm::simple_ilist<T> &seq) { return seq.size(); }
49 static T &element(IO &io, llvm::simple_ilist<T> &seq, size_t index) {
50 return *std::next(seq.begin(), index);
51 }
52};
53
54template <typename T> struct SequenceTraits<clang::doc::DocList<T>> {
55 static size_t size(IO &io, clang::doc::DocList<T> &seq) { return seq.size(); }
56 static T &element(IO &io, clang::doc::DocList<T> &seq, size_t index) {
57 return *(std::next(seq.begin(), index));
58 }
59};
60
61// Map pointers to the value mappings as clang-doc only does output
62// serialization.
63template <typename T> struct PointerMappingTraits {
64 static void mapping(IO &IO, T *&Val) {
65 if (Val)
66 MappingTraits<T>::mapping(IO, *Val);
67 }
68};
69
70template <>
71struct MappingTraits<clang::doc::Reference *>
72 : PointerMappingTraits<clang::doc::Reference> {};
73template <>
74struct MappingTraits<clang::doc::CommentInfo *>
75 : PointerMappingTraits<clang::doc::CommentInfo> {};
76template <>
77struct MappingTraits<clang::doc::FunctionInfo *>
78 : PointerMappingTraits<clang::doc::FunctionInfo> {};
79template <>
80struct MappingTraits<clang::doc::EnumInfo *>
81 : PointerMappingTraits<clang::doc::EnumInfo> {};
82template <>
83struct MappingTraits<clang::doc::TemplateParamInfo *>
84 : PointerMappingTraits<clang::doc::TemplateParamInfo> {};
85
86template <typename T> struct SequenceTraits<ArrayRef<T>> {
87 static size_t size(IO &io, llvm::ArrayRef<T> &seq) { return seq.size(); }
88 static T &element(IO &io, llvm::ArrayRef<T> &seq, size_t index) {
89 return const_cast<T &>(seq[index]);
90 }
91};
92
93// Enumerations to YAML output.
94
95template <> struct ScalarEnumerationTraits<clang::AccessSpecifier> {
96 static void enumeration(IO &IO, clang::AccessSpecifier &Value) {
97 IO.enumCase(Value, "Public", clang::AccessSpecifier::AS_public);
98 IO.enumCase(Value, "Protected", clang::AccessSpecifier::AS_protected);
99 IO.enumCase(Value, "Private", clang::AccessSpecifier::AS_private);
100 IO.enumCase(Value, "None", clang::AccessSpecifier::AS_none);
101 }
102};
103
104template <> struct ScalarEnumerationTraits<clang::TagTypeKind> {
105 static void enumeration(IO &IO, clang::TagTypeKind &Value) {
106 IO.enumCase(Value, "Struct", clang::TagTypeKind::Struct);
107 IO.enumCase(Value, "Interface", clang::TagTypeKind::Interface);
108 IO.enumCase(Value, "Union", clang::TagTypeKind::Union);
109 IO.enumCase(Value, "Class", clang::TagTypeKind::Class);
110 IO.enumCase(Value, "Enum", clang::TagTypeKind::Enum);
111 }
112};
113
114template <> struct ScalarEnumerationTraits<InfoType> {
115 static void enumeration(IO &IO, InfoType &Value) {
116 IO.enumCase(Value, "Namespace", InfoType::IT_namespace);
117 IO.enumCase(Value, "Record", InfoType::IT_record);
118 IO.enumCase(Value, "Function", InfoType::IT_function);
119 IO.enumCase(Value, "Enum", InfoType::IT_enum);
120 IO.enumCase(Value, "Default", InfoType::IT_default);
121 }
122};
123
124template <> struct ScalarEnumerationTraits<clang::doc::CommentKind> {
125 static void enumeration(IO &IO, clang::doc::CommentKind &Value) {
126 IO.enumCase(Value, "FullComment", clang::doc::CommentKind::CK_FullComment);
127 IO.enumCase(Value, "ParagraphComment",
129 IO.enumCase(Value, "TextComment", clang::doc::CommentKind::CK_TextComment);
130 IO.enumCase(Value, "InlineCommandComment",
132 IO.enumCase(Value, "HTMLStartTagComment",
134 IO.enumCase(Value, "HTMLEndTagComment",
136 IO.enumCase(Value, "BlockCommandComment",
138 IO.enumCase(Value, "ParamCommandComment",
140 IO.enumCase(Value, "TParamCommandComment",
142 IO.enumCase(Value, "VerbatimBlockComment",
144 IO.enumCase(Value, "VerbatimBlockLineComment",
146 IO.enumCase(Value, "VerbatimLineComment",
148 IO.enumCase(Value, "Unknown", clang::doc::CommentKind::CK_Unknown);
149 }
150};
151
152// Scalars to YAML output.
153
154template <> struct ScalarTraits<SymbolID> {
155
156 static void output(const SymbolID &S, void *, llvm::raw_ostream &OS) {
157 OS << toHex(toStringRef(S));
158 }
159
160 static StringRef input(StringRef Scalar, void *, SymbolID &Value) {
161 if (Scalar.size() != 40)
162 return "Error: Incorrect scalar size for USR.";
163 Value = stringToSymbol(Scalar);
164 return StringRef();
165 }
166
167 static SymbolID stringToSymbol(llvm::StringRef Value) {
168 SymbolID USR;
169 std::string HexString = fromHex(Value);
170 llvm::copy(HexString, USR.begin());
171 return SymbolID(USR);
172 }
173
174 static QuotingType mustQuote(StringRef) { return QuotingType::Single; }
175};
176
177/// A wrapper for StringRef to force YAML traits to single-quote the string.
179 StringRef Ref;
180 QuotedString() = default;
181 explicit QuotedString(StringRef R) : Ref(R) {}
182 explicit operator StringRef() const { return Ref; }
183 bool operator==(const QuotedString &Other) const { return Ref == Other.Ref; }
184};
185
186template <> struct ScalarTraits<QuotedString> {
187 static void output(const QuotedString &S, void *, llvm::raw_ostream &OS) {
188 OS << S.Ref;
189 }
190 static StringRef input(StringRef Scalar, void *, QuotedString &Value) {
191 Value.Ref = Scalar;
192 return StringRef();
193 }
194 static QuotingType mustQuote(StringRef) { return QuotingType::Single; }
195};
196} // end namespace yaml
197} // end namespace llvm
198
199LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::QuotedString)
200
201namespace llvm {
202namespace yaml {
203
204// Helper functions to map infos to YAML.
205
206static void typeInfoMapping(IO &IO, TypeInfo &I) {
207 IO.mapOptional("Type", I.Type, Reference());
208}
209
210static void fieldTypeInfoMapping(IO &IO, FieldTypeInfo &I) {
211 typeInfoMapping(IO, I);
212
213 QuotedString QName(I.Name);
214 IO.mapOptional("Name", QName, QuotedString(StringRef()));
215 if (!IO.outputting())
216 I.Name = QName.Ref;
217
218 QuotedString QDefault(I.DefaultValue);
219 IO.mapOptional("DefaultValue", QDefault, QuotedString(StringRef()));
220 if (!IO.outputting())
221 I.DefaultValue = QDefault.Ref;
222}
223
224static void infoMapping(IO &IO, Info &I) {
225 IO.mapRequired("USR", I.USR);
226
227 QuotedString QName(I.Name);
228 IO.mapOptional("Name", QName, QuotedString(StringRef()));
229 if (!IO.outputting())
230 I.Name = QName.Ref;
231
232 QuotedString QPath(I.Path);
233 IO.mapOptional("Path", QPath, QuotedString(StringRef()));
234 if (!IO.outputting())
235 I.Path = QPath.Ref;
236
237 IO.mapOptional("Namespace", I.Namespace, llvm::SmallVector<Reference, 4>());
238 IO.mapOptional("Description", I.Description);
239}
240
241static void symbolInfoMapping(IO &IO, SymbolInfo &I) {
242 infoMapping(IO, I);
243 IO.mapOptional("DefLocation", I.DefLoc, std::optional<Location>());
244 IO.mapOptional("Location", I.Loc);
245}
246
247static void recordInfoMapping(IO &IO, RecordInfo &I) {
248 symbolInfoMapping(IO, I);
249 IO.mapOptional("TagType", I.TagType);
250 IO.mapOptional("IsTypeDef", I.IsTypeDef, false);
251 IO.mapOptional("Members", I.Members);
252 IO.mapOptional("Bases", I.Bases);
253 IO.mapOptional("Parents", I.Parents, SmallVector<Reference, 4>());
254 IO.mapOptional("VirtualParents", I.VirtualParents,
255 llvm::SmallVector<Reference, 4>());
256 IO.mapOptional("ChildRecords", I.Children.Records);
257 IO.mapOptional("ChildFunctions", I.Children.Functions);
258 IO.mapOptional("ChildEnums", I.Children.Enums);
259 IO.mapOptional("ChildTypedefs", I.Children.Typedefs);
260 IO.mapOptional("Template", I.Template);
261}
262
263static void commentInfoMapping(IO &IO, CommentInfo &I) {
264 IO.mapOptional("Kind", I.Kind, CommentKind::CK_Unknown);
265
266 QuotedString QText(I.Text);
267 IO.mapOptional("Text", QText, QuotedString(StringRef()));
268 if (!IO.outputting())
269 I.Text = QText.Ref;
270
271 QuotedString QName(I.Name);
272 IO.mapOptional("Name", QName, QuotedString(StringRef()));
273 if (!IO.outputting())
274 I.Name = QName.Ref;
275
276 QuotedString QDirection(I.Direction);
277 IO.mapOptional("Direction", QDirection, QuotedString(StringRef()));
278 if (!IO.outputting())
279 I.Direction = QDirection.Ref;
280
281 QuotedString QParamName(I.ParamName);
282 IO.mapOptional("ParamName", QParamName, QuotedString(StringRef()));
283 if (!IO.outputting())
284 I.ParamName = QParamName.Ref;
285
286 QuotedString QCloseName(I.CloseName);
287 IO.mapOptional("CloseName", QCloseName, QuotedString(StringRef()));
288 if (!IO.outputting())
289 I.CloseName = QCloseName.Ref;
290
291 IO.mapOptional("SelfClosing", I.SelfClosing, false);
292 IO.mapOptional("Explicit", I.Explicit, false);
293
294 std::vector<QuotedString> QArgs;
295 if (IO.outputting()) {
296 for (auto &S : I.Args)
297 QArgs.push_back(QuotedString(S));
298 }
299 IO.mapOptional("Args", QArgs, std::vector<QuotedString>());
300
301 std::vector<QuotedString> QAttrKeys;
302 if (IO.outputting()) {
303 for (auto &S : I.AttrKeys)
304 QAttrKeys.push_back(QuotedString(S));
305 }
306 IO.mapOptional("AttrKeys", QAttrKeys, std::vector<QuotedString>());
307
308 std::vector<QuotedString> QAttrValues;
309 if (IO.outputting()) {
310 for (auto &S : I.AttrValues)
311 QAttrValues.push_back(QuotedString(S));
312 }
313 IO.mapOptional("AttrValues", QAttrValues, std::vector<QuotedString>());
314
315 IO.mapOptional("Children", I.Children);
316}
317
318// Template specialization to YAML traits for Infos.
319
320template <> struct MappingTraits<Location> {
321 static void mapping(IO &IO, Location &Loc) {
322 IO.mapOptional("LineNumber", Loc.StartLineNumber, 0);
323
324 QuotedString QFilename(Loc.Filename);
325 IO.mapOptional("Filename", QFilename, QuotedString(StringRef()));
326 if (!IO.outputting())
327 Loc.Filename = QFilename.Ref;
328 }
329};
330
331template <> struct MappingTraits<Reference> {
332 static void mapping(IO &IO, Reference &Ref) {
333 IO.mapOptional("Type", Ref.RefType, InfoType::IT_default);
334
335 QuotedString QName(Ref.Name);
336 IO.mapOptional("Name", QName, QuotedString(StringRef()));
337 if (!IO.outputting())
338 Ref.Name = QName.Ref;
339
340 QuotedString QQualName(Ref.QualName);
341 IO.mapOptional("QualName", QQualName, QuotedString(StringRef()));
342 if (!IO.outputting())
343 Ref.QualName = QQualName.Ref;
344
345 IO.mapOptional("USR", Ref.USR, SymbolID());
346
347 QuotedString QPath(Ref.Path);
348 IO.mapOptional("Path", QPath, QuotedString(StringRef()));
349 if (!IO.outputting())
350 Ref.Path = QPath.Ref;
351 }
352};
353
354template <> struct MappingTraits<TypeInfo> {
355 static void mapping(IO &IO, TypeInfo &I) { typeInfoMapping(IO, I); }
356};
357
358template <> struct MappingTraits<FieldTypeInfo> {
359 static void mapping(IO &IO, FieldTypeInfo &I) {
360 typeInfoMapping(IO, I);
361
362 QuotedString QName(I.Name);
363 IO.mapOptional("Name", QName, QuotedString(StringRef()));
364 if (!IO.outputting())
365 I.Name = QName.Ref;
366
367 QuotedString QDefault(I.DefaultValue);
368 IO.mapOptional("DefaultValue", QDefault, QuotedString(StringRef()));
369 if (!IO.outputting())
370 I.DefaultValue = QDefault.Ref;
371 }
372};
373
374template <> struct MappingTraits<MemberTypeInfo> {
375 static void mapping(IO &IO, MemberTypeInfo &I) {
377 // clang::AccessSpecifier::AS_none is used as the default here because it's
378 // the AS that shouldn't be part of the output. Even though AS_public is the
379 // default in the struct, it should be displayed in the YAML output.
380 IO.mapOptional("Access", I.Access, clang::AccessSpecifier::AS_none);
381 IO.mapOptional("Description", I.Description);
382 }
383};
384
385template <> struct MappingTraits<NamespaceInfo> {
386 static void mapping(IO &IO, NamespaceInfo &I) {
387 infoMapping(IO, I);
388 std::vector<Reference> TempNamespaces;
389 for (const auto &N : I.Children.Namespaces)
390 TempNamespaces.push_back(N);
391 IO.mapOptional("ChildNamespaces", TempNamespaces, std::vector<Reference>());
392 IO.mapOptional("ChildRecords", I.Children.Records);
393 IO.mapOptional("ChildFunctions", I.Children.Functions);
394 IO.mapOptional("ChildEnums", I.Children.Enums);
395 IO.mapOptional("ChildTypedefs", I.Children.Typedefs);
396 }
397};
398
399template <> struct MappingTraits<RecordInfo> {
400 static void mapping(IO &IO, RecordInfo &I) { recordInfoMapping(IO, I); }
401};
402
403template <> struct MappingTraits<BaseRecordInfo> {
404 static void mapping(IO &IO, BaseRecordInfo &I) {
405 recordInfoMapping(IO, I);
406 IO.mapOptional("IsVirtual", I.IsVirtual, false);
407 // clang::AccessSpecifier::AS_none is used as the default here because it's
408 // the AS that shouldn't be part of the output. Even though AS_public is the
409 // default in the struct, it should be displayed in the YAML output.
410 IO.mapOptional("Access", I.Access, clang::AccessSpecifier::AS_none);
411 IO.mapOptional("IsParent", I.IsParent, false);
412 }
413};
414
415template <> struct MappingTraits<EnumValueInfo> {
416 static void mapping(IO &IO, EnumValueInfo &I) {
417 QuotedString QName(I.Name);
418 IO.mapOptional("Name", QName, QuotedString(StringRef()));
419 if (!IO.outputting())
420 I.Name = QName.Ref;
421
422 QuotedString QValue(I.Value);
423 IO.mapOptional("Value", QValue, QuotedString(StringRef()));
424 if (!IO.outputting())
425 I.Value = QValue.Ref;
426
427 QuotedString QExpr(I.ValueExpr);
428 IO.mapOptional("Expr", QExpr, QuotedString(StringRef()));
429 if (!IO.outputting())
430 I.ValueExpr = QExpr.Ref;
431 }
432};
433
434template <> struct MappingTraits<EnumInfo> {
435 static void mapping(IO &IO, EnumInfo &I) {
436 symbolInfoMapping(IO, I);
437 IO.mapOptional("Scoped", I.Scoped, false);
438 IO.mapOptional("BaseType", I.BaseType);
439 IO.mapOptional("Members", I.Members);
440 }
441};
442
443template <> struct MappingTraits<TypedefInfo> {
444 static void mapping(IO &IO, TypedefInfo &I) {
445 symbolInfoMapping(IO, I);
446 IO.mapOptional("Underlying", I.Underlying.Type);
447 IO.mapOptional("IsUsing", I.IsUsing, false);
448 }
449};
450
451template <> struct MappingTraits<FunctionInfo> {
452 static void mapping(IO &IO, FunctionInfo &I) {
453 symbolInfoMapping(IO, I);
454 IO.mapOptional("IsMethod", I.IsMethod, false);
455 IO.mapOptional("Parent", I.Parent, Reference());
456 IO.mapOptional("Params", I.Params);
457 IO.mapOptional("ReturnType", I.ReturnType);
458 // clang::AccessSpecifier::AS_none is used as the default here because it's
459 // the AS that shouldn't be part of the output. Even though AS_public is the
460 // default in the struct, it should be displayed in the YAML output.
461 IO.mapOptional("Access", I.Access, clang::AccessSpecifier::AS_none);
462 IO.mapOptional("Template", I.Template);
463 }
464};
465
466template <> struct MappingTraits<TemplateParamInfo> {
467 static void mapping(IO &IO, TemplateParamInfo &I) {
468 QuotedString QContents(I.Contents);
469 IO.mapOptional("Contents", QContents, QuotedString(StringRef()));
470 if (!IO.outputting())
471 I.Contents = QContents.Ref;
472 }
473};
474
475template <> struct MappingTraits<TemplateSpecializationInfo> {
476 static void mapping(IO &IO, TemplateSpecializationInfo &I) {
477 IO.mapOptional("SpecializationOf", I.SpecializationOf);
478 IO.mapOptional("Params", I.Params);
479 }
480};
481
482template <> struct MappingTraits<TemplateInfo> {
483 static void mapping(IO &IO, TemplateInfo &I) {
484 IO.mapOptional("Params", I.Params);
485 IO.mapOptional("Specialization", I.Specialization,
486 std::optional<TemplateSpecializationInfo>());
487 }
488};
489
490template <> struct MappingTraits<CommentInfo> {
491 static void mapping(IO &IO, CommentInfo &I) { commentInfoMapping(IO, I); }
492};
493
494} // end namespace yaml
495} // end namespace llvm
496
497namespace clang {
498namespace doc {
499
500/// Generator for YAML documentation.
501class YAMLGenerator : public Generator {
502public:
503 static const char *Format;
504
505 llvm::Error generateDocumentation(StringRef RootDir,
506 llvm::StringMap<doc::Info *> Infos,
507 const ClangDocContext &CDCtx,
508 std::string DirName) override;
509 llvm::Error generateDocForInfo(Info *I, llvm::raw_ostream &OS,
510 const ClangDocContext &CDCtx) override;
511};
512
513const char *YAMLGenerator::Format = "yaml";
514
516 StringRef RootDir, llvm::StringMap<doc::Info *> Infos,
517 const ClangDocContext &CDCtx, std::string DirName) {
518 for (const auto &Group : Infos) {
519 doc::Info *Info = Group.getValue();
520
521 // Output file names according to the USR except the global namesapce.
522 // Anonymous namespaces are taken care of in serialization, so here we can
523 // safely assume an unnamed namespace is the global one.
524 llvm::SmallString<128> Path;
525 llvm::sys::path::native(RootDir, Path);
526 if (Info->IT == InfoType::IT_namespace && Info->Name.empty()) {
527 llvm::sys::path::append(Path, "index.yaml");
528 } else {
529 llvm::sys::path::append(Path, Group.getKey() + ".yaml");
530 }
531
532 std::error_code FileErr;
533 llvm::raw_fd_ostream InfoOS(Path, FileErr, llvm::sys::fs::OF_Text);
534 if (FileErr) {
535 return llvm::createStringError(FileErr, "Error opening file '%s'",
536 Path.c_str());
537 }
538
539 if (llvm::Error Err = generateDocForInfo(Info, InfoOS, CDCtx)) {
540 return Err;
541 }
542 }
543
544 return llvm::Error::success();
545}
546
547llvm::Error YAMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
548 const ClangDocContext &CDCtx) {
549 llvm::yaml::Output InfoYAML(OS);
550 switch (I->IT) {
552 InfoYAML << *cast<NamespaceInfo>(I);
553 break;
555 InfoYAML << *cast<RecordInfo>(I);
556 break;
558 InfoYAML << *cast<EnumInfo>(I);
559 break;
561 InfoYAML << *cast<FunctionInfo>(I);
562 break;
564 InfoYAML << *cast<TypedefInfo>(I);
565 break;
569 break;
571 return llvm::createStringError(llvm::inconvertibleErrorCode(),
572 "unexpected InfoType");
573 }
574 return llvm::Error::success();
575}
576
577static GeneratorRegistry::Add<YAMLGenerator> YAML(YAMLGenerator::Format,
578 "Generator for YAML output.");
579
580// This anchor is used to force the linker to link in the generated object file
581// and thus register the generator.
583
584} // namespace doc
585} // namespace clang
Generator for YAML documentation.
llvm::Error generateDocumentation(StringRef RootDir, llvm::StringMap< doc::Info * > Infos, const ClangDocContext &CDCtx, std::string DirName) override
static const char * Format
llvm::Error generateDocForInfo(Info *I, llvm::raw_ostream &OS, const ClangDocContext &CDCtx) override
llvm::simple_ilist< InfoNode< T > > DocList
static GeneratorRegistry::Add< YAMLGenerator > YAML(YAMLGenerator::Format, "Generator for YAML output.")
volatile int YAMLGeneratorAnchorSource
std::array< uint8_t, 20 > SymbolID
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static void infoMapping(IO &IO, Info &I)
static void commentInfoMapping(IO &IO, CommentInfo &I)
static void fieldTypeInfoMapping(IO &IO, FieldTypeInfo &I)
static void symbolInfoMapping(IO &IO, SymbolInfo &I)
static void typeInfoMapping(IO &IO, TypeInfo &I)
static void recordInfoMapping(IO &IO, RecordInfo &I)
Some operations such as code completion produce a set of candidates.
Definition Generators.h:152
Represents a symbol occurrence in the source file.
Definition Ref.h:88
ArrayRef< StringRef > Args
ArrayRef< CommentInfo > Children
ArrayRef< StringRef > AttrKeys
ArrayRef< StringRef > AttrValues
llvm::ArrayRef< EnumValueInfo > Members
std::optional< TypeInfo > BaseType
llvm::ArrayRef< FieldTypeInfo > Params
std::optional< TemplateInfo > Template
A base struct for Infos.
DocList< CommentInfo > Description
llvm::ArrayRef< Reference > Namespace
DocList< CommentInfo > Description
llvm::ArrayRef< BaseRecordInfo > Bases
llvm::ArrayRef< Reference > VirtualParents
std::optional< TemplateInfo > Template
llvm::ArrayRef< Reference > Parents
llvm::ArrayRef< MemberTypeInfo > Members
DocList< Reference > Records
DocList< EnumInfo > Enums
DocList< FunctionInfo > Functions
DocList< Reference > Namespaces
DocList< TypedefInfo > Typedefs
DocList< Location > Loc
std::optional< Location > DefLoc
llvm::ArrayRef< TemplateParamInfo > Params
std::optional< TemplateSpecializationInfo > Specialization
llvm::ArrayRef< TemplateParamInfo > Params
static void mapping(IO &IO, BaseRecordInfo &I)
static void mapping(IO &IO, CommentInfo &I)
static void mapping(IO &IO, EnumInfo &I)
static void mapping(IO &IO, EnumValueInfo &I)
static void mapping(IO &IO, FieldTypeInfo &I)
static void mapping(IO &IO, FunctionInfo &I)
static void mapping(IO &IO, Location &Loc)
static void mapping(IO &IO, MemberTypeInfo &I)
static void mapping(IO &IO, NamespaceInfo &I)
static void mapping(IO &IO, RecordInfo &I)
static void mapping(IO &IO, Reference &Ref)
static void mapping(IO &IO, TemplateInfo &I)
static void mapping(IO &IO, TemplateParamInfo &I)
static void mapping(IO &IO, TemplateSpecializationInfo &I)
static void mapping(IO &IO, TypeInfo &I)
static void mapping(IO &IO, TypedefInfo &I)
static void mapping(IO &IO, T *&Val)
A wrapper for StringRef to force YAML traits to single-quote the string.
bool operator==(const QuotedString &Other) const
static void enumeration(IO &IO, InfoType &Value)
static void enumeration(IO &IO, clang::AccessSpecifier &Value)
static void enumeration(IO &IO, clang::TagTypeKind &Value)
static void enumeration(IO &IO, clang::doc::CommentKind &Value)
static StringRef input(StringRef Scalar, void *, QuotedString &Value)
static QuotingType mustQuote(StringRef)
static void output(const QuotedString &S, void *, llvm::raw_ostream &OS)
static SymbolID stringToSymbol(llvm::StringRef Value)
static StringRef input(StringRef Scalar, void *, SymbolID &Value)
static void output(const SymbolID &S, void *, llvm::raw_ostream &OS)
static QuotingType mustQuote(StringRef)
static T & element(IO &io, llvm::ArrayRef< T > &seq, size_t index)
static size_t size(IO &io, llvm::ArrayRef< T > &seq)
static size_t size(IO &io, ArrayRef< T * > &seq)
static T *& element(IO &io, ArrayRef< T * > &seq, size_t index)
static T & element(IO &io, clang::doc::DocList< T > &seq, size_t index)
static size_t size(IO &io, clang::doc::DocList< T > &seq)
static T & element(IO &io, llvm::simple_ilist< T > &seq, size_t index)
static size_t size(IO &io, llvm::simple_ilist< T > &seq)