clang-tools 22.0.0git
Representation.h
Go to the documentation of this file.
1///===-- Representation.h - ClangDoc Representation -------------*- 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//
9// This file defines the internal representations of different declaration
10// types for the clang-doc tool.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H
15#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H
16
17#include "clang/AST/Type.h"
18#include "clang/Basic/Specifiers.h"
19#include "clang/Tooling/StandaloneExecution.h"
20#include "llvm/ADT/APSInt.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/StringExtras.h"
23#include <array>
24#include <optional>
25#include <string>
26
27namespace clang {
28namespace doc {
29
30// SHA1'd hash of a USR.
31using SymbolID = std::array<uint8_t, 20>;
32
33constexpr SymbolID GlobalNamespaceID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
34 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
35
36struct BaseRecordInfo;
37struct EnumInfo;
38struct FunctionInfo;
39struct Info;
40struct TypedefInfo;
41struct ConceptInfo;
42struct VarInfo;
43
55
71
72CommentKind stringToCommentKind(llvm::StringRef KindStr);
73llvm::StringRef commentKindToString(CommentKind Kind);
74
75// A representation of a parsed comment.
77 CommentInfo() = default;
78 CommentInfo(CommentInfo &Other) = delete;
79 CommentInfo(CommentInfo &&Other) = default;
80 CommentInfo &operator=(CommentInfo &&Other) = default;
81
82 bool operator==(const CommentInfo &Other) const;
83
84 // This operator is used to sort a vector of CommentInfos.
85 // No specific order (attributes more important than others) is required. Any
86 // sort is enough, the order is only needed to call std::unique after sorting
87 // the vector.
88 bool operator<(const CommentInfo &Other) const;
89
90 CommentKind Kind = CommentKind::
91 CK_Unknown; // Kind of comment (FullComment, ParagraphComment,
92 // TextComment, InlineCommandComment, HTMLStartTagComment,
93 // HTMLEndTagComment, BlockCommandComment,
94 // ParamCommandComment, TParamCommandComment,
95 // VerbatimBlockComment, VerbatimBlockLineComment,
96 // VerbatimLineComment).
97 SmallString<64> Text; // Text of the comment.
98 SmallString<16> Name; // Name of the comment (for Verbatim and HTML).
99 SmallString<8> Direction; // Parameter direction (for (T)ParamCommand).
100 SmallString<16> ParamName; // Parameter name (for (T)ParamCommand).
101 SmallString<16> CloseName; // Closing tag name (for VerbatimBlock).
102 bool SelfClosing = false; // Indicates if tag is self-closing (for HTML).
103 bool Explicit = false; // Indicates if the direction of a param is explicit
104 // (for (T)ParamCommand).
105 llvm::SmallVector<SmallString<16>, 4>
106 AttrKeys; // List of attribute keys (for HTML).
107 llvm::SmallVector<SmallString<16>, 4>
108 AttrValues; // List of attribute values for each key (for HTML).
109 llvm::SmallVector<SmallString<16>, 4>
110 Args; // List of arguments to commands (for InlineCommand).
111 std::vector<std::unique_ptr<CommentInfo>>
112 Children; // List of child comments for this CommentInfo.
113};
114
115struct Reference {
116 // This variant (that takes no qualified name parameter) uses the Name as the
117 // QualName (very useful in unit tests to reduce verbosity). This can't use an
118 // empty string to indicate the default because we need to accept the empty
119 // string as a valid input for the global namespace (it will have
120 // "GlobalNamespace" as the name, but an empty QualName).
121 Reference(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
123 : USR(USR), Name(Name), QualName(Name), RefType(IT) {}
124 Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName,
125 StringRef Path = StringRef())
126 : USR(USR), Name(Name), QualName(QualName), RefType(IT), Path(Path) {}
127 Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName,
128 StringRef Path, SmallString<16> DocumentationFileName)
131
132 bool operator==(const Reference &Other) const {
133 return std::tie(USR, Name, QualName, RefType) ==
134 std::tie(Other.USR, Other.Name, QualName, Other.RefType);
135 }
136
137 bool mergeable(const Reference &Other);
138 void merge(Reference &&I);
139 bool operator<(const Reference &Other) const { return Name < Other.Name; }
140
141 /// Returns the path for this Reference relative to CurrentPath.
142 llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
143
144 /// Returns the basename that should be used for this Reference.
145 llvm::SmallString<16> getFileBaseName() const;
146
147 SymbolID USR = SymbolID(); // Unique identifier for referenced decl
148
149 // Name of type (possibly unresolved). Not including namespaces or template
150 // parameters (so for a std::vector<int> this would be "vector"). See also
151 // QualName.
152 SmallString<16> Name;
153
154 // Full qualified name of this type, including namespaces and template
155 // parameter (for example this could be "std::vector<int>"). Contrast to
156 // Name.
157 SmallString<16> QualName;
158
159 InfoType RefType = InfoType::IT_default; // Indicates the type of this
160 // Reference (namespace, record,
161 // function, enum, default).
162 // Path of directory where the clang-doc generated file will be saved
163 // (possibly unresolved)
164 llvm::SmallString<128> Path;
165 SmallString<16> DocumentationFileName;
166};
167
168// Holds the children of a record or namespace.
170 // Namespaces and Records are references because they will be properly
171 // documented in their own info, while the entirety of Functions and Enums are
172 // included here because they should not have separate documentation from
173 // their scope.
174 //
175 // Namespaces are not syntactically valid as children of records, but making
176 // this general for all possible container types reduces code complexity.
177 std::vector<Reference> Namespaces;
178 std::vector<Reference> Records;
179 std::vector<FunctionInfo> Functions;
180 std::vector<EnumInfo> Enums;
181 std::vector<TypedefInfo> Typedefs;
182 std::vector<ConceptInfo> Concepts;
183 std::vector<VarInfo> Variables;
184
185 void sort();
186};
187
188// A base struct for TypeInfos
189struct TypeInfo {
190 TypeInfo() = default;
191 TypeInfo(const Reference &R) : Type(R) {}
192
193 // Convenience constructor for when there is no symbol ID or info type
194 // (normally used for built-in types in tests).
195 TypeInfo(StringRef Name, StringRef Path = StringRef())
196 : Type(SymbolID(), Name, InfoType::IT_default, Name, Path) {}
197
198 bool operator==(const TypeInfo &Other) const { return Type == Other.Type; }
199
200 Reference Type; // Referenced type in this info.
201
202 bool IsTemplate = false;
203 bool IsBuiltIn = false;
204};
205
206// Represents one template parameter.
207//
208// This is a very simple serialization of the text of the source code of the
209// template parameter. It is saved in a struct so there is a place to add the
210// name and default values in the future if needed.
212 TemplateParamInfo() = default;
213 explicit TemplateParamInfo(StringRef Contents) : Contents(Contents) {}
214
215 // The literal contents of the code for that specifies this template parameter
216 // for this declaration. Typical values will be "class T" and
217 // "typename T = int".
218 SmallString<16> Contents;
219};
220
222 // Indicates the declaration that this specializes.
224
225 // Template parameters applying to the specialized record/function.
226 std::vector<TemplateParamInfo> Params;
227};
228
230 ConstraintInfo() = default;
231 ConstraintInfo(SymbolID USR, StringRef Name)
232 : ConceptRef(USR, Name, InfoType::IT_concept) {}
234
235 SmallString<16> ConstraintExpr;
236};
237
238// Records the template information for a struct or function that is a template
239// or an explicit template specialization.
241 // May be empty for non-partial specializations.
242 std::vector<TemplateParamInfo> Params;
243
244 // Set when this is a specialization of another record/function.
245 std::optional<TemplateSpecializationInfo> Specialization;
246 std::vector<ConstraintInfo> Constraints;
247};
248
249// Info for field types.
250struct FieldTypeInfo : public TypeInfo {
251 FieldTypeInfo() = default;
252 FieldTypeInfo(const TypeInfo &TI, StringRef Name = StringRef(),
253 StringRef DefaultValue = StringRef())
255
256 bool operator==(const FieldTypeInfo &Other) const {
257 return std::tie(Type, Name, DefaultValue) ==
258 std::tie(Other.Type, Other.Name, Other.DefaultValue);
259 }
260
261 SmallString<16> Name; // Name associated with this info.
262
263 // When used for function parameters, contains the string representing the
264 // expression of the default value, if any.
265 SmallString<16> DefaultValue;
266};
267
268// Info for member types.
270 MemberTypeInfo() = default;
271 MemberTypeInfo(const TypeInfo &TI, StringRef Name, AccessSpecifier Access,
272 bool IsStatic = false)
274
275 bool operator==(const MemberTypeInfo &Other) const {
276 return std::tie(Type, Name, Access, IsStatic, Description) ==
277 std::tie(Other.Type, Other.Name, Other.Access, Other.IsStatic,
278 Other.Description);
279 }
280
281 // Access level associated with this info (public, protected, private, none).
282 // AS_public is set as default because the bitcode writer requires the enum
283 // with value 0 to be used as the default.
284 // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
285 AccessSpecifier Access = AccessSpecifier::AS_public;
286
287 std::vector<CommentInfo> Description; // Comment description of this field.
288 bool IsStatic = false;
289};
290
291struct Location {
296
297 bool operator==(const Location &Other) const {
298 return std::tie(StartLineNumber, EndLineNumber, Filename) ==
299 std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
300 }
301
302 bool operator!=(const Location &Other) const { return !(*this == Other); }
303
304 // This operator is used to sort a vector of Locations.
305 // No specific order (attributes more important than others) is required. Any
306 // sort is enough, the order is only needed to call std::unique after sorting
307 // the vector.
308 bool operator<(const Location &Other) const {
309 return std::tie(StartLineNumber, EndLineNumber, Filename) <
310 std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
311 }
312
313 int StartLineNumber = 0; // Line number of this Location.
315 SmallString<32> Filename; // File for this Location.
316 bool IsFileInRootDir = false; // Indicates if file is inside root directory
317};
318
319/// A base struct for Infos.
320struct Info {
322 StringRef Name = StringRef(), StringRef Path = StringRef())
323 : USR(USR), IT(IT), Name(Name), Path(Path) {}
324
325 Info(const Info &Other) = delete;
326 Info(Info &&Other) = default;
327
328 virtual ~Info() = default;
329
330 Info &operator=(Info &&Other) = default;
331
333 SymbolID(); // Unique identifier for the decl described by this Info.
334 InfoType IT = InfoType::IT_default; // InfoType of this particular Info.
335 SmallString<16> Name; // Unqualified name of the decl.
336 llvm::SmallVector<Reference, 4>
337 Namespace; // List of parent namespaces for this decl.
338 std::vector<CommentInfo> Description; // Comment description of this decl.
339 llvm::SmallString<128> Path; // Path of directory where the clang-doc
340 // generated file will be saved
341
342 // The name used for the file that this info is documented in.
343 // In the JSON generator, infos are documented in files with mangled names.
344 // Thus, we keep track of the physical filename for linking purposes.
345 SmallString<16> DocumentationFileName;
346
347 void mergeBase(Info &&I);
348 bool mergeable(const Info &Other);
349
350 llvm::SmallString<16> extractName() const;
351
352 /// Returns the file path for this Info relative to CurrentPath.
353 llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
354
355 /// Returns the basename that should be used for this Info.
356 llvm::SmallString<16> getFileBaseName() const;
357};
358
359// Info for namespaces.
360struct NamespaceInfo : public Info {
361 NamespaceInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
362 StringRef Path = StringRef());
363
364 void merge(NamespaceInfo &&I);
365
367};
368
369// Info for symbols.
370struct SymbolInfo : public Info {
372 StringRef Name = StringRef(), StringRef Path = StringRef())
373 : Info(IT, USR, Name, Path) {}
374
375 void merge(SymbolInfo &&I);
376
377 bool operator<(const SymbolInfo &Other) const {
378 // Sort by declaration location since we want the doc to be
379 // generated in the order of the source code.
380 // If the declaration location is the same, or not present
381 // we sort by defined location otherwise fallback to the extracted name
382 if (Loc.size() > 0 && Other.Loc.size() > 0 && Loc[0] != Other.Loc[0])
383 return Loc[0] < Other.Loc[0];
384
385 if (DefLoc && Other.DefLoc && *DefLoc != *Other.DefLoc)
386 return *DefLoc < *Other.DefLoc;
387
388 return extractName() < Other.extractName();
389 }
390
391 std::optional<Location> DefLoc; // Location where this decl is defined.
392 llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
393 SmallString<16> MangledName;
394 bool IsStatic = false;
395};
396
401 const StringRef Name = StringRef())
402 : SymbolInfo(IT, USR, Name) {}
403 bool mergeable(const FriendInfo &Other);
404 void merge(FriendInfo &&Other);
405
407 std::optional<TemplateInfo> Template;
408 std::optional<TypeInfo> ReturnType;
409 std::optional<SmallVector<FieldTypeInfo, 4>> Params;
410 bool IsClass = false;
411};
412
421
422// TODO: Expand to allow for documenting templating and default args.
423// Info for functions.
424struct FunctionInfo : public SymbolInfo {
427
428 void merge(FunctionInfo &&I);
429
430 bool IsMethod = false; // Indicates whether this function is a class method.
431 Reference Parent; // Reference to the parent class decl for this method.
432 TypeInfo ReturnType; // Info about the return type of this function.
433 llvm::SmallVector<FieldTypeInfo, 4> Params; // List of parameters.
434 // Access level for this method (public, private, protected, none).
435 // AS_public is set as default because the bitcode writer requires the enum
436 // with value 0 to be used as the default.
437 // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
438 AccessSpecifier Access = AccessSpecifier::AS_public;
439
440 // Full qualified name of this function, including namespaces and template
441 // specializations.
442 SmallString<16> FullName;
443
444 // Function Prototype
445 SmallString<256> Prototype;
446
447 // When present, this function is a template or specialization.
448 std::optional<TemplateInfo> Template;
449};
450
451// TODO: Expand to allow for documenting templating, inheritance access,
452// friend classes
453// Info for types.
454struct RecordInfo : public SymbolInfo {
455 RecordInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
456 StringRef Path = StringRef());
457
458 void merge(RecordInfo &&I);
459
460 // Type of this record (struct, class, union, interface).
461 TagTypeKind TagType = TagTypeKind::Struct;
462
463 // Full qualified name of this record, including namespaces and template
464 // specializations.
465 SmallString<16> FullName;
466
467 // When present, this record is a template or specialization.
468 std::optional<TemplateInfo> Template;
469
470 // Indicates if the record was declared using a typedef. Things like anonymous
471 // structs in a typedef:
472 // typedef struct { ... } foo_t;
473 // are converted into records with the typedef as the Name + this flag set.
474 bool IsTypeDef = false;
475
476 llvm::SmallVector<MemberTypeInfo, 4>
477 Members; // List of info about record members.
478 llvm::SmallVector<Reference, 4> Parents; // List of base/parent records
479 // (does not include virtual
480 // parents).
481 llvm::SmallVector<Reference, 4>
482 VirtualParents; // List of virtual base/parent records.
483
484 std::vector<BaseRecordInfo>
485 Bases; // List of base/parent records; this includes inherited methods and
486 // attributes
487
488 std::vector<FriendInfo> Friends;
489
491};
492
493// Info for typedef and using statements.
494struct TypedefInfo : public SymbolInfo {
497
498 void merge(TypedefInfo &&I);
499
501
502 // Underlying type declaration
503 SmallString<16> TypeDeclaration;
504
505 /// Comment description for the typedef.
506 std::vector<CommentInfo> Description;
507
508 // Indicates if this is a new C++ "using"-style typedef:
509 // using MyVector = std::vector<int>
510 // False means it's a C-style typedef:
511 // typedef std::vector<int> MyVector;
512 bool IsUsing = false;
513};
514
515struct BaseRecordInfo : public RecordInfo {
517 BaseRecordInfo(SymbolID USR, StringRef Name, StringRef Path, bool IsVirtual,
518 AccessSpecifier Access, bool IsParent);
519
520 // Indicates if base corresponds to a virtual inheritance
521 bool IsVirtual = false;
522 // Access level associated with this inherited info (public, protected,
523 // private).
524 AccessSpecifier Access = AccessSpecifier::AS_public;
525 bool IsParent = false; // Indicates if this base is a direct parent
526};
527
528// Information for a single possible value of an enumeration.
530 explicit EnumValueInfo(StringRef Name = StringRef(),
531 StringRef Value = StringRef("0"),
532 StringRef ValueExpr = StringRef())
534
535 bool operator==(const EnumValueInfo &Other) const {
536 return std::tie(Name, Value, ValueExpr) ==
537 std::tie(Other.Name, Other.Value, Other.ValueExpr);
538 }
539
540 SmallString<16> Name;
541
542 // The computed value of the enumeration constant. This could be the result of
543 // evaluating the ValueExpr, or it could be automatically generated according
544 // to C rules.
545 SmallString<16> Value;
546
547 // Stores the user-supplied initialization expression for this enumeration
548 // constant. This will be empty for implicit enumeration values.
549 SmallString<16> ValueExpr;
550
551 /// Comment description of this field.
552 std::vector<CommentInfo> Description;
553};
554
555// TODO: Expand to allow for documenting templating.
556// Info for types.
557struct EnumInfo : public SymbolInfo {
560
561 void merge(EnumInfo &&I);
562
563 // Indicates whether this enum is scoped (e.g. enum class).
564 bool Scoped = false;
565
566 // Set to nonempty to the type when this is an explicitly typed enum. For
567 // enum Foo : short { ... };
568 // this will be "short".
569 std::optional<TypeInfo> BaseType;
570
571 llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
572};
573
584
585struct Index : public Reference {
586 Index() = default;
587 Index(StringRef Name) : Reference(SymbolID(), Name) {}
590 Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
591 : Reference(USR, Name, IT, Name, Path) {}
592 // This is used to look for a USR in a vector of Indexes using std::find
593 bool operator==(const SymbolID &Other) const { return USR == Other; }
594 bool operator<(const Index &Other) const;
595
596 std::optional<SmallString<16>> JumpToSection;
597 std::vector<Index> Children;
598
599 void sort();
600};
601
602// TODO: Add functionality to include separate markdown pages.
603
604// A standalone function to call to merge a vector of infos into one.
605// This assumes that all infos in the vector are of the same type, and will fail
606// if they are different.
607llvm::Expected<std::unique_ptr<Info>>
608mergeInfos(std::vector<std::unique_ptr<Info>> &Values);
609
611 ClangDocContext() = default;
612 ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
613 bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
614 StringRef RepositoryUrl, StringRef RepositoryCodeLinePrefix,
615 StringRef Base, std::vector<std::string> UserStylesheets,
616 bool FTimeTrace = false);
617 tooling::ExecutionContext *ECtx;
618 std::string ProjectName; // Name of project clang-doc is documenting.
619 bool PublicOnly; // Indicates if only public declarations are documented.
620 bool FTimeTrace; // Indicates if ftime trace is turned on
621 int Granularity; // Granularity of ftime trace
622 std::string OutDirectory; // Directory for outputting generated files.
623 std::string SourceRoot; // Directory where processed files are stored. Links
624 // to definition locations will only be generated if
625 // the file is in this dir.
626 // URL of repository that hosts code used for links to definition locations.
627 std::optional<std::string> RepositoryUrl;
628 // Prefix of line code for repository.
629 std::optional<std::string> RepositoryLinePrefix;
630 // Path of CSS stylesheets that will be copied to OutDirectory and used to
631 // style all HTML files.
632 std::vector<std::string> UserStylesheets;
633 // JavaScript files that will be imported in all HTML files.
634 std::vector<std::string> JsScripts;
635 // Base directory for remote repositories.
636 StringRef Base;
637 // Maps mustache template types to specific mustache template files.
638 // Ex. comment-template -> /path/to/comment-template.mustache
639 llvm::StringMap<std::string> MustacheTemplates;
641};
642
643} // namespace doc
644} // namespace clang
645
646#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H
static llvm::cl::opt< std::string > RepositoryCodeLinePrefix("repository-line-prefix", llvm::cl::desc("Prefix of line code for repository."), llvm::cl::cat(ClangDocCategory))
llvm::Expected< std::unique_ptr< Info > > mergeInfos(std::vector< std::unique_ptr< Info > > &Values)
CommentKind stringToCommentKind(llvm::StringRef KindStr)
constexpr SymbolID GlobalNamespaceID
std::array< uint8_t, 20 > SymbolID
llvm::StringRef commentKindToString(CommentKind Kind)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::optional< std::string > RepositoryUrl
std::vector< std::string > UserStylesheets
llvm::StringMap< std::string > MustacheTemplates
std::vector< std::string > JsScripts
tooling::ExecutionContext * ECtx
std::optional< std::string > RepositoryLinePrefix
SmallString< 8 > Direction
CommentInfo(CommentInfo &Other)=delete
CommentInfo & operator=(CommentInfo &&Other)=default
std::vector< std::unique_ptr< CommentInfo > > Children
bool operator<(const CommentInfo &Other) const
llvm::SmallVector< SmallString< 16 >, 4 > AttrValues
SmallString< 16 > CloseName
CommentInfo(CommentInfo &&Other)=default
bool operator==(const CommentInfo &Other) const
SmallString< 16 > Name
SmallString< 64 > Text
llvm::SmallVector< SmallString< 16 >, 4 > AttrKeys
llvm::SmallVector< SmallString< 16 >, 4 > Args
SmallString< 16 > ParamName
void merge(ConceptInfo &&I)
SmallString< 16 > ConstraintExpression
SmallString< 16 > ConstraintExpr
ConstraintInfo(SymbolID USR, StringRef Name)
llvm::SmallVector< EnumValueInfo, 4 > Members
void merge(EnumInfo &&I)
std::optional< TypeInfo > BaseType
std::vector< CommentInfo > Description
Comment description of this field.
bool operator==(const EnumValueInfo &Other) const
SmallString< 16 > ValueExpr
EnumValueInfo(StringRef Name=StringRef(), StringRef Value=StringRef("0"), StringRef ValueExpr=StringRef())
FieldTypeInfo(const TypeInfo &TI, StringRef Name=StringRef(), StringRef DefaultValue=StringRef())
bool operator==(const FieldTypeInfo &Other) const
SmallString< 16 > DefaultValue
FriendInfo(const InfoType IT, const SymbolID &USR, const StringRef Name=StringRef())
std::optional< TypeInfo > ReturnType
void merge(FriendInfo &&Other)
std::optional< SmallVector< FieldTypeInfo, 4 > > Params
std::optional< TemplateInfo > Template
bool mergeable(const FriendInfo &Other)
FunctionInfo(SymbolID USR=SymbolID())
SmallString< 16 > FullName
llvm::SmallVector< FieldTypeInfo, 4 > Params
void merge(FunctionInfo &&I)
std::optional< TemplateInfo > Template
SmallString< 256 > Prototype
Index(StringRef Name, StringRef JumpToSection)
std::optional< SmallString< 16 > > JumpToSection
std::vector< Index > Children
bool operator<(const Index &Other) const
bool operator==(const SymbolID &Other) const
Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
Index(StringRef Name)
SmallString< 16 > DocumentationFileName
Info & operator=(Info &&Other)=default
Info(InfoType IT=InfoType::IT_default, SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
bool mergeable(const Info &Other)
SmallString< 16 > Name
llvm::SmallString< 16 > getFileBaseName() const
Returns the basename that should be used for this Info.
std::vector< CommentInfo > Description
llvm::SmallString< 128 > Path
virtual ~Info()=default
void mergeBase(Info &&I)
llvm::SmallString< 16 > extractName() const
llvm::SmallString< 64 > getRelativeFilePath(const StringRef &CurrentPath) const
Returns the file path for this Info relative to CurrentPath.
Info(Info &&Other)=default
Info(const Info &Other)=delete
llvm::SmallVector< Reference, 4 > Namespace
bool operator==(const Location &Other) const
Location(int StartLineNumber=0, int EndLineNumber=0, StringRef Filename=StringRef(), bool IsFileInRootDir=false)
SmallString< 32 > Filename
bool operator<(const Location &Other) const
bool operator!=(const Location &Other) const
MemberTypeInfo(const TypeInfo &TI, StringRef Name, AccessSpecifier Access, bool IsStatic=false)
std::vector< CommentInfo > Description
bool operator==(const MemberTypeInfo &Other) const
NamespaceInfo(SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
void merge(NamespaceInfo &&I)
llvm::SmallVector< MemberTypeInfo, 4 > Members
RecordInfo(SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
std::optional< TemplateInfo > Template
SmallString< 16 > FullName
std::vector< FriendInfo > Friends
llvm::SmallVector< Reference, 4 > VirtualParents
llvm::SmallVector< Reference, 4 > Parents
void merge(RecordInfo &&I)
std::vector< BaseRecordInfo > Bases
Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName, StringRef Path, SmallString< 16 > DocumentationFileName)
void merge(Reference &&I)
Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName, StringRef Path=StringRef())
Reference(SymbolID USR=SymbolID(), StringRef Name=StringRef(), InfoType IT=InfoType::IT_default)
bool mergeable(const Reference &Other)
SmallString< 16 > QualName
llvm::SmallString< 128 > Path
llvm::SmallString< 64 > getRelativeFilePath(const StringRef &CurrentPath) const
Returns the path for this Reference relative to CurrentPath.
llvm::SmallString< 16 > getFileBaseName() const
Returns the basename that should be used for this Reference.
SmallString< 16 > DocumentationFileName
SmallString< 16 > Name
bool operator<(const Reference &Other) const
bool operator==(const Reference &Other) const
std::vector< Reference > Records
std::vector< TypedefInfo > Typedefs
std::vector< FunctionInfo > Functions
std::vector< Reference > Namespaces
std::vector< VarInfo > Variables
std::vector< EnumInfo > Enums
std::vector< ConceptInfo > Concepts
SymbolInfo(InfoType IT, SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
bool operator<(const SymbolInfo &Other) const
llvm::SmallVector< Location, 2 > Loc
std::optional< Location > DefLoc
SmallString< 16 > MangledName
void merge(SymbolInfo &&I)
std::vector< ConstraintInfo > Constraints
std::vector< TemplateParamInfo > Params
std::optional< TemplateSpecializationInfo > Specialization
TemplateParamInfo(StringRef Contents)
std::vector< TemplateParamInfo > Params
TypeInfo(StringRef Name, StringRef Path=StringRef())
TypeInfo(const Reference &R)
bool operator==(const TypeInfo &Other) const
void merge(TypedefInfo &&I)
TypedefInfo(SymbolID USR=SymbolID())
SmallString< 16 > TypeDeclaration
std::vector< CommentInfo > Description
Comment description for the typedef.
VarInfo(SymbolID USR)
void merge(VarInfo &&I)