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/Diagnostic.h"
19#include "clang/Basic/Specifiers.h"
20#include "clang/Tooling/Execution.h"
21#include "llvm/ADT/SmallVector.h"
22#include <array>
23#include <optional>
24#include <string>
25
26namespace clang {
27namespace doc {
28
29// SHA1'd hash of a USR.
30using SymbolID = std::array<uint8_t, 20>;
31
32constexpr SymbolID GlobalNamespaceID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
33 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
34
35struct BaseRecordInfo;
36struct EnumInfo;
37struct FunctionInfo;
38struct Info;
39struct TypedefInfo;
40struct ConceptInfo;
41struct VarInfo;
42
54
70
71CommentKind stringToCommentKind(llvm::StringRef KindStr);
72llvm::StringRef commentKindToString(CommentKind Kind);
73
74// A representation of a parsed comment.
76 CommentInfo() = default;
77 CommentInfo(CommentInfo &Other) = delete;
78 CommentInfo(CommentInfo &&Other) = default;
79 CommentInfo &operator=(CommentInfo &&Other) = default;
80
81 bool operator==(const CommentInfo &Other) const;
82
83 // This operator is used to sort a vector of CommentInfos.
84 // No specific order (attributes more important than others) is required. Any
85 // sort is enough, the order is only needed to call std::unique after sorting
86 // the vector.
87 bool operator<(const CommentInfo &Other) const;
88
89 std::vector<std::unique_ptr<CommentInfo>>
90 Children; // List of child comments for this CommentInfo.
91 SmallString<8> Direction; // Parameter direction (for (T)ParamCommand).
92 SmallString<16> Name; // Name of the comment (for Verbatim and HTML).
93 SmallString<16> ParamName; // Parameter name (for (T)ParamCommand).
94 SmallString<16> CloseName; // Closing tag name (for VerbatimBlock).
95 SmallString<64> Text; // Text of the comment.
96 llvm::SmallVector<SmallString<16>, 4>
97 AttrKeys; // List of attribute keys (for HTML).
98 llvm::SmallVector<SmallString<16>, 4>
99 AttrValues; // List of attribute values for each key (for HTML).
100 llvm::SmallVector<SmallString<16>, 4>
101 Args; // List of arguments to commands (for InlineCommand).
102 CommentKind Kind = CommentKind::
103 CK_Unknown; // Kind of comment (FullComment, ParagraphComment,
104 // TextComment, InlineCommandComment, HTMLStartTagComment,
105 // HTMLEndTagComment, BlockCommandComment,
106 // ParamCommandComment, TParamCommandComment,
107 // VerbatimBlockComment, VerbatimBlockLineComment,
108 // VerbatimLineComment).
109 bool SelfClosing = false; // Indicates if tag is self-closing (for HTML).
110 bool Explicit = false; // Indicates if the direction of a param is explicit
111 // (for (T)ParamCommand).
112};
113
114struct Reference {
115 // This variant (that takes no qualified name parameter) uses the Name as the
116 // QualName (very useful in unit tests to reduce verbosity). This can't use an
117 // empty string to indicate the default because we need to accept the empty
118 // string as a valid input for the global namespace (it will have
119 // "GlobalNamespace" as the name, but an empty QualName).
120 Reference(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
122 : USR(USR), RefType(IT), Name(Name), QualName(Name) {}
123 Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName,
124 StringRef Path = StringRef())
125 : USR(USR), RefType(IT), Name(Name), QualName(QualName), Path(Path) {}
126 Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName,
127 StringRef Path, SmallString<16> DocumentationFileName)
130
131 bool operator==(const Reference &Other) const {
132 return std::tie(USR, Name, QualName, RefType) ==
133 std::tie(Other.USR, Other.Name, QualName, Other.RefType);
134 }
135
136 bool mergeable(const Reference &Other);
137 void merge(Reference &&I);
138 bool operator<(const Reference &Other) const { return Name < Other.Name; }
139
140 /// Returns the path for this Reference relative to CurrentPath.
141 llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
142
143 /// Returns the basename that should be used for this Reference.
144 llvm::SmallString<16> getFileBaseName() const;
145
146 SymbolID USR = SymbolID(); // Unique identifier for referenced decl
147
148 InfoType RefType = InfoType::IT_default; // Indicates the type of this
149 // Reference (namespace, record,
150 // function, enum, default).
151
152 // Name of type (possibly unresolved). Not including namespaces or template
153 // parameters (so for a std::vector<int> this would be "vector"). See also
154 // QualName.
155 SmallString<16> Name;
156
157 // Full qualified name of this type, including namespaces and template
158 // parameter (for example this could be "std::vector<int>"). Contrast to
159 // Name.
160 SmallString<16> QualName;
161
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 std::vector<CommentInfo> Description;
282
283 // Access level associated with this info (public, protected, private, none).
284 // AS_public is set as default because the bitcode writer requires the enum
285 // with value 0 to be used as the default.
286 // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
287 AccessSpecifier Access = AccessSpecifier::AS_public;
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 SmallString<32> Filename;
316 bool IsFileInRootDir = false;
317};
318
319/// A base struct for Infos.
320struct Info {
322 StringRef Name = StringRef(), StringRef Path = StringRef())
323 : Path(Path), Name(Name), USR(USR), IT(IT) {}
324
325 Info(const Info &Other) = delete;
326 Info(Info &&Other) = default;
327 virtual ~Info() = default;
328
329 Info &operator=(Info &&Other) = default;
330
331 void mergeBase(Info &&I);
332 bool mergeable(const Info &Other);
333
334 llvm::SmallString<16> extractName() const;
335
336 /// Returns the file path for this Info relative to CurrentPath.
337 llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
338
339 /// Returns the basename that should be used for this Info.
340 llvm::SmallString<16> getFileBaseName() const;
341
342 // Path of directory where the clang-doc generated file will be saved.
343 llvm::SmallString<128> Path;
344
345 // Unqualified name of the decl.
346 SmallString<16> Name;
347
348 // The name used for the file that this info is documented in.
349 // In the JSON generator, infos are documented in files with mangled names.
350 // Thus, we keep track of the physical filename for linking purposes.
351 SmallString<16> DocumentationFileName;
352
353 // List of parent namespaces for this decl.
354 llvm::SmallVector<Reference, 4> Namespace;
355
356 // Unique identifier for the decl described by this Info.
358
359 // InfoType of this particular Info.
361
362 // Comment description of this decl.
363 std::vector<CommentInfo> Description;
364};
365
366// Info for namespaces.
367struct NamespaceInfo : public Info {
368 NamespaceInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
369 StringRef Path = StringRef());
370
371 void merge(NamespaceInfo &&I);
372
374};
375
376// Info for symbols.
377struct SymbolInfo : public Info {
379 StringRef Name = StringRef(), StringRef Path = StringRef())
380 : Info(IT, USR, Name, Path) {}
381
382 void merge(SymbolInfo &&I);
383
384 bool operator<(const SymbolInfo &Other) const {
385 // Sort by declaration location since we want the doc to be
386 // generated in the order of the source code.
387 // If the declaration location is the same, or not present
388 // we sort by defined location otherwise fallback to the extracted name
389 if (Loc.size() > 0 && Other.Loc.size() > 0 && Loc[0] != Other.Loc[0])
390 return Loc[0] < Other.Loc[0];
391
392 if (DefLoc && Other.DefLoc && *DefLoc != *Other.DefLoc)
393 return *DefLoc < *Other.DefLoc;
394
395 return extractName() < Other.extractName();
396 }
397
398 std::optional<Location> DefLoc; // Location where this decl is defined.
399 llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
400 SmallString<16> MangledName;
401 bool IsStatic = false;
402};
403
408 const StringRef Name = StringRef())
409 : SymbolInfo(IT, USR, Name) {}
410 bool mergeable(const FriendInfo &Other);
411 void merge(FriendInfo &&Other);
412
414 std::optional<TemplateInfo> Template;
415 std::optional<TypeInfo> ReturnType;
416 std::optional<SmallVector<FieldTypeInfo, 4>> Params;
417 bool IsClass = false;
418};
419
428
429// TODO: Expand to allow for documenting templating and default args.
430// Info for functions.
431struct FunctionInfo : public SymbolInfo {
434
435 void merge(FunctionInfo &&I);
436
439 llvm::SmallVector<FieldTypeInfo, 4> Params;
440 SmallString<256> Prototype;
441
442 // When present, this function is a template or specialization.
443 std::optional<TemplateInfo> Template;
444
445 // Access level for this method (public, private, protected, none).
446 // AS_public is set as default because the bitcode writer requires the enum
447 // with value 0 to be used as the default.
448 // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
449 AccessSpecifier Access = AccessSpecifier::AS_public;
450
451 bool IsMethod = false;
452};
453
454// TODO: Expand to allow for documenting templating, inheritance access,
455// friend classes
456// Info for types.
457struct RecordInfo : public SymbolInfo {
458 RecordInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
459 StringRef Path = StringRef());
460
461 void merge(RecordInfo &&I);
462
463 // Type of this record (struct, class, union, interface).
464 TagTypeKind TagType = TagTypeKind::Struct;
465
466 // Indicates if the record was declared using a typedef. Things like anonymous
467 // structs in a typedef:
468 // typedef struct { ... } foo_t;
469 // are converted into records with the typedef as the Name + this flag set.
470 bool IsTypeDef = false;
471
472 // When present, this record is a template or specialization.
473 std::optional<TemplateInfo> Template;
474
475 llvm::SmallVector<MemberTypeInfo, 4>
476 Members; // List of info about record members.
477 llvm::SmallVector<Reference, 4> Parents; // List of base/parent records
478 // (does not include virtual
479 // parents).
480 llvm::SmallVector<Reference, 4>
481 VirtualParents; // List of virtual base/parent records.
482
483 std::vector<BaseRecordInfo>
484 Bases; // List of base/parent records; this includes inherited methods and
485 // attributes
486
487 std::vector<FriendInfo> Friends;
488
490};
491
492// Info for typedef and using statements.
493struct TypedefInfo : public SymbolInfo {
496
497 void merge(TypedefInfo &&I);
498
500
501 // Underlying type declaration
502 SmallString<16> TypeDeclaration;
503
504 /// Comment description for the typedef.
505 std::vector<CommentInfo> Description;
506
507 // Indicates if this is a new C++ "using"-style typedef:
508 // using MyVector = std::vector<int>
509 // False means it's a C-style typedef:
510 // typedef std::vector<int> MyVector;
511 bool IsUsing = false;
512};
513
514struct BaseRecordInfo : public RecordInfo {
516 BaseRecordInfo(SymbolID USR, StringRef Name, StringRef Path, bool IsVirtual,
517 AccessSpecifier Access, bool IsParent);
518
519 // Access level associated with this inherited info (public, protected,
520 // private).
521 AccessSpecifier Access = AccessSpecifier::AS_public;
522 // Indicates if base corresponds to a virtual inheritance
523 bool IsVirtual = false;
524 bool IsParent = false; // Indicates if this base is a direct parent
525};
526
527// Information for a single possible value of an enumeration.
529 explicit EnumValueInfo(StringRef Name = StringRef(),
530 StringRef Value = StringRef("0"),
531 StringRef ValueExpr = StringRef())
533
534 bool operator==(const EnumValueInfo &Other) const {
535 return std::tie(Name, Value, ValueExpr) ==
536 std::tie(Other.Name, Other.Value, Other.ValueExpr);
537 }
538
539 SmallString<16> Name;
540
541 // The computed value of the enumeration constant. This could be the result of
542 // evaluating the ValueExpr, or it could be automatically generated according
543 // to C rules.
544 SmallString<16> Value;
545
546 // Stores the user-supplied initialization expression for this enumeration
547 // constant. This will be empty for implicit enumeration values.
548 SmallString<16> ValueExpr;
549
550 /// Comment description of this field.
551 std::vector<CommentInfo> Description;
552};
553
554// TODO: Expand to allow for documenting templating.
555// Info for types.
556struct EnumInfo : public SymbolInfo {
559
560 void merge(EnumInfo &&I);
561
562 // Indicates whether this enum is scoped (e.g. enum class).
563 bool Scoped = false;
564
565 // Set to nonempty to the type when this is an explicitly typed enum. For
566 // enum Foo : short { ... };
567 // this will be "short".
568 std::optional<TypeInfo> BaseType;
569
570 llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
571};
572
583
584struct Index : public Reference {
585 Index() = default;
586 Index(StringRef Name) : Reference(SymbolID(), Name) {}
589 Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
590 : Reference(USR, Name, IT, Name, Path) {}
591 // This is used to look for a USR in a vector of Indexes using std::find
592 bool operator==(const SymbolID &Other) const { return USR == Other; }
593 bool operator<(const Index &Other) const;
594
595 std::optional<SmallString<16>> JumpToSection;
596 std::vector<Index> Children;
597
598 void sort();
599};
600
601// TODO: Add functionality to include separate markdown pages.
602
603// A standalone function to call to merge a vector of infos into one.
604// This assumes that all infos in the vector are of the same type, and will fail
605// if they are different.
606llvm::Expected<std::unique_ptr<Info>>
607mergeInfos(std::vector<std::unique_ptr<Info>> &Values);
608
610 ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
611 bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
612 StringRef RepositoryUrl, StringRef RepositoryCodeLinePrefix,
613 StringRef Base, std::vector<std::string> UserStylesheets,
614 clang::DiagnosticsEngine &Diags, bool FTimeTrace = false);
615 tooling::ExecutionContext *ECtx;
616 std::string ProjectName; // Name of project clang-doc is documenting.
617 std::string OutDirectory; // Directory for outputting generated files.
618 std::string SourceRoot; // Directory where processed files are stored. Links
619 // to definition locations will only be generated if
620 // the file is in this dir.
621 // URL of repository that hosts code used for links to definition locations.
622 std::optional<std::string> RepositoryUrl;
623 // Prefix of line code for repository.
624 std::optional<std::string> RepositoryLinePrefix;
625 // Path of CSS stylesheets that will be copied to OutDirectory and used to
626 // style all HTML files.
627 std::vector<std::string> UserStylesheets;
628 // JavaScript files that will be imported in all HTML files.
629 std::vector<std::string> JsScripts;
630 // Base directory for remote repositories.
631 StringRef Base;
632 // Maps mustache template types to specific mustache template files.
633 // Ex. comment-template -> /path/to/comment-template.mustache
634 llvm::StringMap<std::string> MustacheTemplates;
635 // A pointer to a DiagnosticsEngine for error reporting.
636 clang::DiagnosticsEngine &Diags;
638 int Granularity; // Granularity of ftime trace
639 bool PublicOnly; // Indicates if only public declarations are documented.
640 bool FTimeTrace; // Indicates if ftime trace is turned on
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
ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName, bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot, StringRef RepositoryUrl, StringRef RepositoryCodeLinePrefix, StringRef Base, std::vector< std::string > UserStylesheets, clang::DiagnosticsEngine &Diags, bool FTimeTrace=false)
std::vector< std::string > UserStylesheets
llvm::StringMap< std::string > MustacheTemplates
std::vector< std::string > JsScripts
tooling::ExecutionContext * ECtx
clang::DiagnosticsEngine & Diags
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())
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
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)