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// A Context is a reference that holds a relative path from a certain Info's
169// location.
170struct Context : public Reference {
171 Context(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName,
172 StringRef Path, SmallString<16> DocumentationFileName)
174 explicit Context(const Info &I);
175 SmallString<128> RelativePath;
176};
177
178// Holds the children of a record or namespace.
180 // Namespaces and Records are references because they will be properly
181 // documented in their own info, while the entirety of Functions and Enums are
182 // included here because they should not have separate documentation from
183 // their scope.
184 //
185 // Namespaces are not syntactically valid as children of records, but making
186 // this general for all possible container types reduces code complexity.
187 std::vector<Reference> Namespaces;
188 std::vector<Reference> Records;
189 std::vector<FunctionInfo> Functions;
190 std::vector<EnumInfo> Enums;
191 std::vector<TypedefInfo> Typedefs;
192 std::vector<ConceptInfo> Concepts;
193 std::vector<VarInfo> Variables;
194
195 void sort();
196};
197
198// A base struct for TypeInfos
199struct TypeInfo {
200 TypeInfo() = default;
201 TypeInfo(const Reference &R) : Type(R) {}
202
203 // Convenience constructor for when there is no symbol ID or info type
204 // (normally used for built-in types in tests).
205 TypeInfo(StringRef Name, StringRef Path = StringRef())
206 : Type(SymbolID(), Name, InfoType::IT_default, Name, Path) {}
207
208 bool operator==(const TypeInfo &Other) const { return Type == Other.Type; }
209
210 Reference Type; // Referenced type in this info.
211
212 bool IsTemplate = false;
213 bool IsBuiltIn = false;
214};
215
216// Represents one template parameter.
217//
218// This is a very simple serialization of the text of the source code of the
219// template parameter. It is saved in a struct so there is a place to add the
220// name and default values in the future if needed.
222 TemplateParamInfo() = default;
223 explicit TemplateParamInfo(StringRef Contents) : Contents(Contents) {}
224
225 // The literal contents of the code for that specifies this template parameter
226 // for this declaration. Typical values will be "class T" and
227 // "typename T = int".
228 SmallString<16> Contents;
229};
230
232 // Indicates the declaration that this specializes.
234
235 // Template parameters applying to the specialized record/function.
236 std::vector<TemplateParamInfo> Params;
237};
238
240 ConstraintInfo() = default;
241 ConstraintInfo(SymbolID USR, StringRef Name)
242 : ConceptRef(USR, Name, InfoType::IT_concept) {}
244
245 SmallString<16> ConstraintExpr;
246};
247
248// Records the template information for a struct or function that is a template
249// or an explicit template specialization.
251 // May be empty for non-partial specializations.
252 std::vector<TemplateParamInfo> Params;
253
254 // Set when this is a specialization of another record/function.
255 std::optional<TemplateSpecializationInfo> Specialization;
256 std::vector<ConstraintInfo> Constraints;
257};
258
259// Info for field types.
260struct FieldTypeInfo : public TypeInfo {
261 FieldTypeInfo() = default;
262 FieldTypeInfo(const TypeInfo &TI, StringRef Name = StringRef(),
263 StringRef DefaultValue = StringRef())
265
266 bool operator==(const FieldTypeInfo &Other) const {
267 return std::tie(Type, Name, DefaultValue) ==
268 std::tie(Other.Type, Other.Name, Other.DefaultValue);
269 }
270
271 SmallString<16> Name; // Name associated with this info.
272
273 // When used for function parameters, contains the string representing the
274 // expression of the default value, if any.
275 SmallString<16> DefaultValue;
276};
277
278// Info for member types.
280 MemberTypeInfo() = default;
281 MemberTypeInfo(const TypeInfo &TI, StringRef Name, AccessSpecifier Access,
282 bool IsStatic = false)
284
285 bool operator==(const MemberTypeInfo &Other) const {
286 return std::tie(Type, Name, Access, IsStatic, Description) ==
287 std::tie(Other.Type, Other.Name, Other.Access, Other.IsStatic,
288 Other.Description);
289 }
290
291 std::vector<CommentInfo> Description;
292
293 // Access level associated with this info (public, protected, private, none).
294 // AS_public is set as default because the bitcode writer requires the enum
295 // with value 0 to be used as the default.
296 // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
297 AccessSpecifier Access = AccessSpecifier::AS_public;
298 bool IsStatic = false;
299};
300
301struct Location {
306
307 bool operator==(const Location &Other) const {
308 return std::tie(StartLineNumber, EndLineNumber, Filename) ==
309 std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
310 }
311
312 bool operator!=(const Location &Other) const { return !(*this == Other); }
313
314 // This operator is used to sort a vector of Locations.
315 // No specific order (attributes more important than others) is required. Any
316 // sort is enough, the order is only needed to call std::unique after sorting
317 // the vector.
318 bool operator<(const Location &Other) const {
319 return std::tie(StartLineNumber, EndLineNumber, Filename) <
320 std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
321 }
322
323 SmallString<32> Filename;
326 bool IsFileInRootDir = false;
327};
328
329/// A base struct for Infos.
330struct Info {
332 StringRef Name = StringRef(), StringRef Path = StringRef())
333 : Path(Path), Name(Name), USR(USR), IT(IT) {}
334
335 Info(const Info &Other) = delete;
336 Info(Info &&Other) = default;
337 virtual ~Info() = default;
338
339 Info &operator=(Info &&Other) = default;
340
341 void mergeBase(Info &&I);
342 bool mergeable(const Info &Other);
343
344 llvm::SmallString<16> extractName() const;
345
346 /// Returns the file path for this Info relative to CurrentPath.
347 llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
348
349 /// Returns the basename that should be used for this Info.
350 llvm::SmallString<16> getFileBaseName() const;
351
352 // Path of directory where the clang-doc generated file will be saved.
353 llvm::SmallString<128> Path;
354
355 // Unqualified name of the decl.
356 SmallString<16> Name;
357
358 // The name used for the file that this info is documented in.
359 // In the JSON generator, infos are documented in files with mangled names.
360 // Thus, we keep track of the physical filename for linking purposes.
361 SmallString<16> DocumentationFileName;
362
363 // List of parent namespaces for this decl.
364 llvm::SmallVector<Reference, 4> Namespace;
365
366 // Unique identifier for the decl described by this Info.
368
369 // Currently only used for namespaces and records.
371
372 // InfoType of this particular Info.
374
375 // Comment description of this decl.
376 std::vector<CommentInfo> Description;
377
378 SmallVector<Context, 4> Contexts;
379};
380
381inline Context::Context(const Info &I)
382 : Reference(I.USR, I.Name, I.IT, I.Name, I.Path, I.DocumentationFileName) {}
383
384// Info for namespaces.
385struct NamespaceInfo : public Info {
386 NamespaceInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
387 StringRef Path = StringRef());
388
389 void merge(NamespaceInfo &&I);
390
392};
393
394// Info for symbols.
395struct SymbolInfo : public Info {
397 StringRef Name = StringRef(), StringRef Path = StringRef())
398 : Info(IT, USR, Name, Path) {}
399
400 void merge(SymbolInfo &&I);
401
402 bool operator<(const SymbolInfo &Other) const {
403 // Sort by declaration location since we want the doc to be
404 // generated in the order of the source code.
405 // If the declaration location is the same, or not present
406 // we sort by defined location otherwise fallback to the extracted name
407 if (Loc.size() > 0 && Other.Loc.size() > 0 && Loc[0] != Other.Loc[0])
408 return Loc[0] < Other.Loc[0];
409
410 if (DefLoc && Other.DefLoc && *DefLoc != *Other.DefLoc)
411 return *DefLoc < *Other.DefLoc;
412
413 return extractName() < Other.extractName();
414 }
415
416 std::optional<Location> DefLoc; // Location where this decl is defined.
417 llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
418 SmallString<16> MangledName;
419 bool IsStatic = false;
420};
421
426 const StringRef Name = StringRef())
427 : SymbolInfo(IT, USR, Name) {}
428 bool mergeable(const FriendInfo &Other);
429 void merge(FriendInfo &&Other);
430
432 std::optional<TemplateInfo> Template;
433 std::optional<TypeInfo> ReturnType;
434 std::optional<SmallVector<FieldTypeInfo, 4>> Params;
435 bool IsClass = false;
436};
437
446
447// TODO: Expand to allow for documenting templating and default args.
448// Info for functions.
449struct FunctionInfo : public SymbolInfo {
452
453 void merge(FunctionInfo &&I);
454
457 llvm::SmallVector<FieldTypeInfo, 4> Params;
458 SmallString<256> Prototype;
459
460 // When present, this function is a template or specialization.
461 std::optional<TemplateInfo> Template;
462
463 // Access level for this method (public, private, protected, none).
464 // AS_public is set as default because the bitcode writer requires the enum
465 // with value 0 to be used as the default.
466 // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
467 AccessSpecifier Access = AccessSpecifier::AS_public;
468
469 bool IsMethod = false;
470};
471
472// TODO: Expand to allow for documenting templating, inheritance access,
473// friend classes
474// Info for types.
475struct RecordInfo : public SymbolInfo {
476 RecordInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
477 StringRef Path = StringRef());
478
479 void merge(RecordInfo &&I);
480
481 // Type of this record (struct, class, union, interface).
482 TagTypeKind TagType = TagTypeKind::Struct;
483
484 // Indicates if the record was declared using a typedef. Things like anonymous
485 // structs in a typedef:
486 // typedef struct { ... } foo_t;
487 // are converted into records with the typedef as the Name + this flag set.
488 bool IsTypeDef = false;
489
490 // When present, this record is a template or specialization.
491 std::optional<TemplateInfo> Template;
492
493 llvm::SmallVector<MemberTypeInfo, 4>
494 Members; // List of info about record members.
495 llvm::SmallVector<Reference, 4> Parents; // List of base/parent records
496 // (does not include virtual
497 // parents).
498 llvm::SmallVector<Reference, 4>
499 VirtualParents; // List of virtual base/parent records.
500
501 std::vector<BaseRecordInfo>
502 Bases; // List of base/parent records; this includes inherited methods and
503 // attributes
504
505 std::vector<FriendInfo> Friends;
506
508};
509
510// Info for typedef and using statements.
511struct TypedefInfo : public SymbolInfo {
514
515 void merge(TypedefInfo &&I);
516
518
519 // Only type aliases can be templates.
520 std::optional<TemplateInfo> Template;
521
522 // Underlying type declaration
523 SmallString<16> TypeDeclaration;
524
525 // Indicates if this is a new C++ "using"-style typedef:
526 // using MyVector = std::vector<int>
527 // False means it's a C-style typedef:
528 // typedef std::vector<int> MyVector;
529 bool IsUsing = false;
530};
531
532struct BaseRecordInfo : public RecordInfo {
534 BaseRecordInfo(SymbolID USR, StringRef Name, StringRef Path, bool IsVirtual,
535 AccessSpecifier Access, bool IsParent);
536
537 // Access level associated with this inherited info (public, protected,
538 // private).
539 AccessSpecifier Access = AccessSpecifier::AS_public;
540 // Indicates if base corresponds to a virtual inheritance
541 bool IsVirtual = false;
542 bool IsParent = false; // Indicates if this base is a direct parent
543};
544
545// Information for a single possible value of an enumeration.
547 explicit EnumValueInfo(StringRef Name = StringRef(),
548 StringRef Value = StringRef("0"),
549 StringRef ValueExpr = StringRef())
551
552 bool operator==(const EnumValueInfo &Other) const {
553 return std::tie(Name, Value, ValueExpr) ==
554 std::tie(Other.Name, Other.Value, Other.ValueExpr);
555 }
556
557 SmallString<16> Name;
558
559 // The computed value of the enumeration constant. This could be the result of
560 // evaluating the ValueExpr, or it could be automatically generated according
561 // to C rules.
562 SmallString<16> Value;
563
564 // Stores the user-supplied initialization expression for this enumeration
565 // constant. This will be empty for implicit enumeration values.
566 SmallString<16> ValueExpr;
567
568 /// Comment description of this field.
569 std::vector<CommentInfo> Description;
570};
571
572// TODO: Expand to allow for documenting templating.
573// Info for types.
574struct EnumInfo : public SymbolInfo {
577
578 void merge(EnumInfo &&I);
579
580 // Indicates whether this enum is scoped (e.g. enum class).
581 bool Scoped = false;
582
583 // Set to nonempty to the type when this is an explicitly typed enum. For
584 // enum Foo : short { ... };
585 // this will be "short".
586 std::optional<TypeInfo> BaseType;
587
588 llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
589};
590
601
602struct Index : public Reference {
603 Index() = default;
604 Index(StringRef Name) : Reference(SymbolID(), Name) {}
607 Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
608 : Reference(USR, Name, IT, Name, Path) {}
609 // This is used to look for a USR in a vector of Indexes using std::find
610 bool operator==(const SymbolID &Other) const { return USR == Other; }
611 bool operator<(const Index &Other) const;
612
613 std::optional<SmallString<16>> JumpToSection;
614 std::vector<Index> Children;
615
616 void sort();
617};
618
619// TODO: Add functionality to include separate markdown pages.
620
621// A standalone function to call to merge a vector of infos into one.
622// This assumes that all infos in the vector are of the same type, and will fail
623// if they are different.
624llvm::Expected<std::unique_ptr<Info>>
625mergeInfos(std::vector<std::unique_ptr<Info>> &Values);
626
628 ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
629 bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
630 StringRef RepositoryUrl, StringRef RepositoryCodeLinePrefix,
631 StringRef Base, std::vector<std::string> UserStylesheets,
632 clang::DiagnosticsEngine &Diags, bool FTimeTrace = false);
633 tooling::ExecutionContext *ECtx;
634 std::string ProjectName; // Name of project clang-doc is documenting.
635 std::string OutDirectory; // Directory for outputting generated files.
636 std::string SourceRoot; // Directory where processed files are stored. Links
637 // to definition locations will only be generated if
638 // the file is in this dir.
639 // URL of repository that hosts code used for links to definition locations.
640 std::optional<std::string> RepositoryUrl;
641 // Prefix of line code for repository.
642 std::optional<std::string> RepositoryLinePrefix;
643 // Path of CSS stylesheets that will be copied to OutDirectory and used to
644 // style all HTML files.
645 std::vector<std::string> UserStylesheets;
646 // JavaScript files that will be imported in all HTML files.
647 std::vector<std::string> JsScripts;
648 // Base directory for remote repositories.
649 StringRef Base;
650 // Maps mustache template types to specific mustache template files.
651 // Ex. comment-template -> /path/to/comment-template.mustache
652 llvm::StringMap<std::string> MustacheTemplates;
653 // A pointer to a DiagnosticsEngine for error reporting.
654 clang::DiagnosticsEngine &Diags;
656 int Granularity; // Granularity of ftime trace
657 bool PublicOnly; // Indicates if only public declarations are documented.
658 bool FTimeTrace; // Indicates if ftime trace is turned on
659};
660
661} // namespace doc
662} // namespace clang
663
664#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)
Context(SymbolID USR, StringRef Name, InfoType IT, StringRef QualName, StringRef Path, SmallString< 16 > DocumentationFileName)
SmallString< 128 > RelativePath
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)
A base struct for Infos.
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
SmallVector< Context, 4 > Contexts
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)
std::optional< TemplateInfo > Template
TypedefInfo(SymbolID USR=SymbolID())
SmallString< 16 > TypeDeclaration
VarInfo(SymbolID USR)
void merge(VarInfo &&I)