clang-tools  16.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/Optional.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringExtras.h"
24 #include <array>
25 #include <string>
26 
27 namespace clang {
28 namespace doc {
29 
30 // SHA1'd hash of a USR.
31 using SymbolID = std::array<uint8_t, 20>;
32 
33 struct BaseRecordInfo;
34 struct EnumInfo;
35 struct FunctionInfo;
36 struct Info;
37 struct TypedefInfo;
38 
39 enum class InfoType {
40  IT_default,
42  IT_record,
44  IT_enum,
46 };
47 
48 // A representation of a parsed comment.
49 struct CommentInfo {
50  CommentInfo() = default;
51  CommentInfo(CommentInfo &Other) = delete;
52  CommentInfo(CommentInfo &&Other) = default;
53  CommentInfo &operator=(CommentInfo &&Other) = default;
54 
55  bool operator==(const CommentInfo &Other) const {
56  auto FirstCI = std::tie(Kind, Text, Name, Direction, ParamName, CloseName,
58  auto SecondCI =
59  std::tie(Other.Kind, Other.Text, Other.Name, Other.Direction,
60  Other.ParamName, Other.CloseName, Other.SelfClosing,
61  Other.Explicit, Other.AttrKeys, Other.AttrValues, Other.Args);
62 
63  if (FirstCI != SecondCI || Children.size() != Other.Children.size())
64  return false;
65 
66  return std::equal(Children.begin(), Children.end(), Other.Children.begin(),
67  llvm::deref<std::equal_to<>>{});
68  }
69 
70  // This operator is used to sort a vector of CommentInfos.
71  // No specific order (attributes more important than others) is required. Any
72  // sort is enough, the order is only needed to call std::unique after sorting
73  // the vector.
74  bool operator<(const CommentInfo &Other) const {
75  auto FirstCI = std::tie(Kind, Text, Name, Direction, ParamName, CloseName,
77  auto SecondCI =
78  std::tie(Other.Kind, Other.Text, Other.Name, Other.Direction,
79  Other.ParamName, Other.CloseName, Other.SelfClosing,
80  Other.Explicit, Other.AttrKeys, Other.AttrValues, Other.Args);
81 
82  if (FirstCI < SecondCI)
83  return true;
84 
85  if (FirstCI == SecondCI) {
86  return std::lexicographical_compare(
87  Children.begin(), Children.end(), Other.Children.begin(),
88  Other.Children.end(), llvm::deref<std::less<>>());
89  }
90 
91  return false;
92  }
93 
94  SmallString<16>
95  Kind; // Kind of comment (FullComment, ParagraphComment, TextComment,
96  // InlineCommandComment, HTMLStartTagComment, HTMLEndTagComment,
97  // BlockCommandComment, ParamCommandComment,
98  // TParamCommandComment, VerbatimBlockComment,
99  // VerbatimBlockLineComment, VerbatimLineComment).
100  SmallString<64> Text; // Text of the comment.
101  SmallString<16> Name; // Name of the comment (for Verbatim and HTML).
102  SmallString<8> Direction; // Parameter direction (for (T)ParamCommand).
103  SmallString<16> ParamName; // Parameter name (for (T)ParamCommand).
104  SmallString<16> CloseName; // Closing tag name (for VerbatimBlock).
105  bool SelfClosing = false; // Indicates if tag is self-closing (for HTML).
106  bool Explicit = false; // Indicates if the direction of a param is explicit
107  // (for (T)ParamCommand).
108  llvm::SmallVector<SmallString<16>, 4>
109  AttrKeys; // List of attribute keys (for HTML).
110  llvm::SmallVector<SmallString<16>, 4>
111  AttrValues; // List of attribute values for each key (for HTML).
112  llvm::SmallVector<SmallString<16>, 4>
113  Args; // List of arguments to commands (for InlineCommand).
114  std::vector<std::unique_ptr<CommentInfo>>
115  Children; // List of child comments for this CommentInfo.
116 };
117 
118 struct Reference {
119  Reference(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
120  InfoType IT = InfoType::IT_default, StringRef Path = StringRef())
121  : USR(USR), Name(Name), RefType(IT), Path(Path) {}
122 
123  bool operator==(const Reference &Other) const {
124  return std::tie(USR, Name, RefType) ==
125  std::tie(Other.USR, Other.Name, Other.RefType);
126  }
127 
128  bool mergeable(const Reference &Other);
129  void merge(Reference &&I);
130 
131  /// Returns the path for this Reference relative to CurrentPath.
132  llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
133 
134  /// Returns the basename that should be used for this Reference.
135  llvm::SmallString<16> getFileBaseName() const;
136 
137  SymbolID USR = SymbolID(); // Unique identifier for referenced decl
138  SmallString<16> Name; // Name of type (possibly unresolved).
139  InfoType RefType = InfoType::IT_default; // Indicates the type of this
140  // Reference (namespace, record,
141  // function, enum, default).
142  // Path of directory where the clang-doc generated file will be saved
143  // (possibly unresolved)
144  llvm::SmallString<128> Path;
145 };
146 
147 // Holds the children of a record or namespace.
149  // Namespaces and Records are references because they will be properly
150  // documented in their own info, while the entirety of Functions and Enums are
151  // included here because they should not have separate documentation from
152  // their scope.
153  //
154  // Namespaces are not syntactically valid as children of records, but making
155  // this general for all possible container types reduces code complexity.
156  std::vector<Reference> Namespaces;
157  std::vector<Reference> Records;
158  std::vector<FunctionInfo> Functions;
159  std::vector<EnumInfo> Enums;
160  std::vector<TypedefInfo> Typedefs;
161 };
162 
163 // A base struct for TypeInfos
164 struct TypeInfo {
165  TypeInfo() = default;
166  TypeInfo(const Reference &R) : Type(R) {}
167 
168  // Convenience constructor for when there is no symbol ID or info type
169  // (normally used for built-in types in tests).
170  TypeInfo(StringRef Name, StringRef Path = StringRef())
172 
173  bool operator==(const TypeInfo &Other) const { return Type == Other.Type; }
174 
175  Reference Type; // Referenced type in this info.
176 };
177 
178 // Info for field types.
179 struct FieldTypeInfo : public TypeInfo {
180  FieldTypeInfo() = default;
181  FieldTypeInfo(const TypeInfo &TI, StringRef Name = StringRef(),
182  StringRef DefaultValue = StringRef())
184 
185  bool operator==(const FieldTypeInfo &Other) const {
186  return std::tie(Type, Name, DefaultValue) ==
187  std::tie(Other.Type, Other.Name, Other.DefaultValue);
188  }
189 
190  SmallString<16> Name; // Name associated with this info.
191 
192  // When used for function parameters, contains the string representing the
193  // expression of the default value, if any.
194  SmallString<16> DefaultValue;
195 };
196 
197 // Info for member types.
198 struct MemberTypeInfo : public FieldTypeInfo {
199  MemberTypeInfo() = default;
200  MemberTypeInfo(const TypeInfo &TI, StringRef Name, AccessSpecifier Access)
201  : FieldTypeInfo(TI, Name), Access(Access) {}
202 
203  bool operator==(const MemberTypeInfo &Other) const {
204  return std::tie(Type, Name, Access, Description) ==
205  std::tie(Other.Type, Other.Name, Other.Access, Other.Description);
206  }
207 
208  // Access level associated with this info (public, protected, private, none).
209  // AS_public is set as default because the bitcode writer requires the enum
210  // with value 0 to be used as the default.
211  // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
212  AccessSpecifier Access = AccessSpecifier::AS_public;
213 
214  std::vector<CommentInfo> Description; // Comment description of this field.
215 };
216 
217 struct Location {
218  Location(int LineNumber = 0, StringRef Filename = StringRef(),
219  bool IsFileInRootDir = false)
222 
223  bool operator==(const Location &Other) const {
224  return std::tie(LineNumber, Filename) ==
225  std::tie(Other.LineNumber, Other.Filename);
226  }
227 
228  // This operator is used to sort a vector of Locations.
229  // No specific order (attributes more important than others) is required. Any
230  // sort is enough, the order is only needed to call std::unique after sorting
231  // the vector.
232  bool operator<(const Location &Other) const {
233  return std::tie(LineNumber, Filename) <
234  std::tie(Other.LineNumber, Other.Filename);
235  }
236 
237  int LineNumber = 0; // Line number of this Location.
238  SmallString<32> Filename; // File for this Location.
239  bool IsFileInRootDir = false; // Indicates if file is inside root directory
240 };
241 
242 /// A base struct for Infos.
243 struct Info {
245  StringRef Name = StringRef(), StringRef Path = StringRef())
246  : USR(USR), IT(IT), Name(Name), Path(Path) {}
247 
248  Info(const Info &Other) = delete;
249  Info(Info &&Other) = default;
250 
251  virtual ~Info() = default;
252 
254  SymbolID(); // Unique identifier for the decl described by this Info.
255  const InfoType IT = InfoType::IT_default; // InfoType of this particular Info.
256  SmallString<16> Name; // Unqualified name of the decl.
257  llvm::SmallVector<Reference, 4>
258  Namespace; // List of parent namespaces for this decl.
259  std::vector<CommentInfo> Description; // Comment description of this decl.
260  llvm::SmallString<128> Path; // Path of directory where the clang-doc
261  // generated file will be saved
262 
263  void mergeBase(Info &&I);
264  bool mergeable(const Info &Other);
265 
266  llvm::SmallString<16> extractName() const;
267 
268  /// Returns the file path for this Info relative to CurrentPath.
269  llvm::SmallString<64> getRelativeFilePath(const StringRef &CurrentPath) const;
270 
271  /// Returns the basename that should be used for this Info.
272  llvm::SmallString<16> getFileBaseName() const;
273 
274  // Returns a reference to the parent scope (that is, the immediate parent
275  // namespace or class in which this decl resides).
276  llvm::Expected<Reference> getEnclosingScope();
277 };
278 
279 // Info for namespaces.
280 struct NamespaceInfo : public Info {
281  NamespaceInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
282  StringRef Path = StringRef())
284 
285  void merge(NamespaceInfo &&I);
286 
288 };
289 
290 // Info for symbols.
291 struct SymbolInfo : public Info {
293  StringRef Name = StringRef(), StringRef Path = StringRef())
294  : Info(IT, USR, Name, Path) {}
295 
296  void merge(SymbolInfo &&I);
297 
298  llvm::Optional<Location> DefLoc; // Location where this decl is defined.
299  llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
300 };
301 
302 // TODO: Expand to allow for documenting templating and default args.
303 // Info for functions.
304 struct FunctionInfo : public SymbolInfo {
307 
308  void merge(FunctionInfo &&I);
309 
310  bool IsMethod = false; // Indicates whether this function is a class method.
311  Reference Parent; // Reference to the parent class decl for this method.
312  TypeInfo ReturnType; // Info about the return type of this function.
313  llvm::SmallVector<FieldTypeInfo, 4> Params; // List of parameters.
314  // Access level for this method (public, private, protected, none).
315  // AS_public is set as default because the bitcode writer requires the enum
316  // with value 0 to be used as the default.
317  // (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
318  AccessSpecifier Access = AccessSpecifier::AS_public;
319 };
320 
321 // TODO: Expand to allow for documenting templating, inheritance access,
322 // friend classes
323 // Info for types.
324 struct RecordInfo : public SymbolInfo {
325  RecordInfo(SymbolID USR = SymbolID(), StringRef Name = StringRef(),
326  StringRef Path = StringRef())
328 
329  void merge(RecordInfo &&I);
330 
331  // Type of this record (struct, class, union, interface).
332  TagTypeKind TagType = TagTypeKind::TTK_Struct;
333 
334  // Indicates if the record was declared using a typedef. Things like anonymous
335  // structs in a typedef:
336  // typedef struct { ... } foo_t;
337  // are converted into records with the typedef as the Name + this flag set.
338  bool IsTypeDef = false;
339 
340  llvm::SmallVector<MemberTypeInfo, 4>
341  Members; // List of info about record members.
342  llvm::SmallVector<Reference, 4> Parents; // List of base/parent records
343  // (does not include virtual
344  // parents).
345  llvm::SmallVector<Reference, 4>
346  VirtualParents; // List of virtual base/parent records.
347 
348  std::vector<BaseRecordInfo>
349  Bases; // List of base/parent records; this includes inherited methods and
350  // attributes
351 
353 };
354 
355 // Info for typedef and using statements.
356 struct TypedefInfo : public SymbolInfo {
359 
360  void merge(TypedefInfo &&I);
361 
363 
364  // Inidicates if this is a new C++ "using"-style typedef:
365  // using MyVector = std::vector<int>
366  // False means it's a C-style typedef:
367  // typedef std::vector<int> MyVector;
368  bool IsUsing = false;
369 };
370 
371 struct BaseRecordInfo : public RecordInfo {
373  BaseRecordInfo(SymbolID USR, StringRef Name, StringRef Path, bool IsVirtual,
374  AccessSpecifier Access, bool IsParent)
376  IsParent(IsParent) {}
377 
378  // Indicates if base corresponds to a virtual inheritance
379  bool IsVirtual = false;
380  // Access level associated with this inherited info (public, protected,
381  // private).
382  AccessSpecifier Access = AccessSpecifier::AS_public;
383  bool IsParent = false; // Indicates if this base is a direct parent
384 };
385 
386 // Information for a single possible value of an enumeration.
388  explicit EnumValueInfo(StringRef Name = StringRef(),
389  StringRef Value = StringRef("0"),
390  StringRef ValueExpr = StringRef())
392 
393  bool operator==(const EnumValueInfo &Other) const {
394  return std::tie(Name, Value, ValueExpr) ==
395  std::tie(Other.Name, Other.Value, Other.ValueExpr);
396  }
397 
398  SmallString<16> Name;
399 
400  // The computed value of the enumeration constant. This could be the result of
401  // evaluating the ValueExpr, or it could be automatically generated according
402  // to C rules.
403  SmallString<16> Value;
404 
405  // Stores the user-supplied initialization expression for this enumeration
406  // constant. This will be empty for implicit enumeration values.
407  SmallString<16> ValueExpr;
408 };
409 
410 // TODO: Expand to allow for documenting templating.
411 // Info for types.
412 struct EnumInfo : public SymbolInfo {
415 
416  void merge(EnumInfo &&I);
417 
418  // Indicates whether this enum is scoped (e.g. enum class).
419  bool Scoped = false;
420 
421  // Set to nonempty to the type when this is an explicitly typed enum. For
422  // enum Foo : short { ... };
423  // this will be "short".
424  llvm::Optional<TypeInfo> BaseType;
425 
426  llvm::SmallVector<EnumValueInfo, 4> Members; // List of enum members.
427 };
428 
429 struct Index : public Reference {
430  Index() = default;
431  Index(StringRef Name) : Reference(SymbolID(), Name) {}
432  Index(StringRef Name, StringRef JumpToSection)
434  Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
435  : Reference(USR, Name, IT, Path) {}
436  // This is used to look for a USR in a vector of Indexes using std::find
437  bool operator==(const SymbolID &Other) const { return USR == Other; }
438  bool operator<(const Index &Other) const;
439 
440  llvm::Optional<SmallString<16>> JumpToSection;
441  std::vector<Index> Children;
442 
443  void sort();
444 };
445 
446 // TODO: Add functionality to include separate markdown pages.
447 
448 // A standalone function to call to merge a vector of infos into one.
449 // This assumes that all infos in the vector are of the same type, and will fail
450 // if they are different.
451 llvm::Expected<std::unique_ptr<Info>>
452 mergeInfos(std::vector<std::unique_ptr<Info>> &Values);
453 
455  ClangDocContext() = default;
456  ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
457  bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
458  StringRef RepositoryUrl,
459  std::vector<std::string> UserStylesheets,
460  std::vector<std::string> JsScripts);
461  tooling::ExecutionContext *ECtx;
462  std::string ProjectName; // Name of project clang-doc is documenting.
463  bool PublicOnly; // Indicates if only public declarations are documented.
464  std::string OutDirectory; // Directory for outputting generated files.
465  std::string SourceRoot; // Directory where processed files are stored. Links
466  // to definition locations will only be generated if
467  // the file is in this dir.
468  // URL of repository that hosts code used for links to definition locations.
469  llvm::Optional<std::string> RepositoryUrl;
470  // Path of CSS stylesheets that will be copied to OutDirectory and used to
471  // style all HTML files.
472  std::vector<std::string> UserStylesheets;
473  // JavaScript files that will be imported in allHTML file.
474  std::vector<std::string> JsScripts;
475  // Other files that should be copied to OutDirectory, besides UserStylesheets.
476  std::vector<std::string> FilesToCopy;
478 };
479 
480 } // namespace doc
481 } // namespace clang
482 
483 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H
clang::doc::EnumValueInfo
Definition: Representation.h:387
clang::doc::BaseRecordInfo::Access
AccessSpecifier Access
Definition: Representation.h:382
clang::doc::MemberTypeInfo::Description
std::vector< CommentInfo > Description
Definition: Representation.h:214
clang::doc::Index::Index
Index(StringRef Name, StringRef JumpToSection)
Definition: Representation.h:432
clang::doc::Reference::operator==
bool operator==(const Reference &Other) const
Definition: Representation.h:123
clang::doc::TypedefInfo
Definition: Representation.h:356
clang::doc::EnumInfo::Members
llvm::SmallVector< EnumValueInfo, 4 > Members
Definition: Representation.h:426
clang::doc::RecordInfo::IsTypeDef
bool IsTypeDef
Definition: Representation.h:338
clang::doc::Info::Description
std::vector< CommentInfo > Description
Definition: Representation.h:259
clang::doc::Reference::merge
void merge(Reference &&I)
Definition: Representation.cpp:181
clang::doc::Reference::getFileBaseName
llvm::SmallString< 16 > getFileBaseName() const
Returns the basename that should be used for this Reference.
Definition: Representation.cpp:158
clang::doc::InfoType::IT_enum
@ IT_enum
clang::doc::Info::mergeBase
void mergeBase(Info &&I)
Definition: Representation.cpp:189
clang::doc::CommentInfo::operator<
bool operator<(const CommentInfo &Other) const
Definition: Representation.h:74
clang::doc::Info::Name
SmallString< 16 > Name
Definition: Representation.h:256
clang::doc::Index
Definition: Representation.h:429
clang::doc::InfoType::IT_namespace
@ IT_namespace
clang::doc::ClangDocContext::Idx
Index Idx
Definition: Representation.h:477
clang::doc::FunctionInfo
Definition: Representation.h:304
clang::doc::TypedefInfo::merge
void merge(TypedefInfo &&I)
Definition: Representation.cpp:279
clang::doc::FieldTypeInfo::Name
SmallString< 16 > Name
Definition: Representation.h:190
clang::doc::Reference::Path
llvm::SmallString< 128 > Path
Definition: Representation.h:144
clang::doc::InfoType
InfoType
Definition: Representation.h:39
clang::doc::TypedefInfo::IsUsing
bool IsUsing
Definition: Representation.h:368
clang::doc::CommentInfo
Definition: Representation.h:49
clang::doc::Reference::Name
SmallString< 16 > Name
Definition: Representation.h:138
clang::doc::RecordInfo::RecordInfo
RecordInfo(SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
Definition: Representation.h:325
clang::doc::InfoType::IT_function
@ IT_function
clang::doc::ClangDocContext::RepositoryUrl
llvm::Optional< std::string > RepositoryUrl
Definition: Representation.h:469
clang::doc::InfoType::IT_typedef
@ IT_typedef
clang::doc::EnumInfo
Definition: Representation.h:412
clang::doc::CommentInfo::CloseName
SmallString< 16 > CloseName
Definition: Representation.h:104
clang::doc::EnumValueInfo::EnumValueInfo
EnumValueInfo(StringRef Name=StringRef(), StringRef Value=StringRef("0"), StringRef ValueExpr=StringRef())
Definition: Representation.h:388
clang::doc::ScopeChildren::Typedefs
std::vector< TypedefInfo > Typedefs
Definition: Representation.h:160
clang::doc::CommentInfo::Kind
SmallString< 16 > Kind
Definition: Representation.h:95
clang::doc::ScopeChildren::Functions
std::vector< FunctionInfo > Functions
Definition: Representation.h:158
clang::doc::CommentInfo::Direction
SmallString< 8 > Direction
Definition: Representation.h:102
clang::doc::CommentInfo::Explicit
bool Explicit
Definition: Representation.h:106
clang::doc::FieldTypeInfo::operator==
bool operator==(const FieldTypeInfo &Other) const
Definition: Representation.h:185
clang::doc::RecordInfo::VirtualParents
llvm::SmallVector< Reference, 4 > VirtualParents
Definition: Representation.h:346
clang::doc::CommentInfo::Name
SmallString< 16 > Name
Definition: Representation.h:101
clang::doc::ClangDocContext::SourceRoot
std::string SourceRoot
Definition: Representation.h:465
clang::doc::ScopeChildren
Definition: Representation.h:148
clang::doc::Info::getEnclosingScope
llvm::Expected< Reference > getEnclosingScope()
clang::doc::BaseRecordInfo
Definition: Representation.h:371
clang::doc::RecordInfo::Members
llvm::SmallVector< MemberTypeInfo, 4 > Members
Definition: Representation.h:341
clang::doc::ClangDocContext::ProjectName
std::string ProjectName
Definition: Representation.h:462
clang::doc::Location
Definition: Representation.h:217
clang::doc::CommentInfo::operator==
bool operator==(const CommentInfo &Other) const
Definition: Representation.h:55
clang::doc::RecordInfo::Bases
std::vector< BaseRecordInfo > Bases
Definition: Representation.h:349
clang::doc::CommentInfo::ParamName
SmallString< 16 > ParamName
Definition: Representation.h:103
clang::doc::NamespaceInfo::NamespaceInfo
NamespaceInfo(SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
Definition: Representation.h:281
clang::doc::Reference::mergeable
bool mergeable(const Reference &Other)
Definition: Representation.cpp:177
clang::doc::Info::Path
llvm::SmallString< 128 > Path
Definition: Representation.h:260
clang::doc::ClangDocContext::UserStylesheets
std::vector< std::string > UserStylesheets
Definition: Representation.h:472
clang::doc::CommentInfo::Children
std::vector< std::unique_ptr< CommentInfo > > Children
Definition: Representation.h:115
clang::doc::Info::extractName
llvm::SmallString< 16 > extractName() const
Definition: Representation.cpp:288
clang::doc::Location::operator<
bool operator<(const Location &Other) const
Definition: Representation.h:232
clang::doc::ScopeChildren::Namespaces
std::vector< Reference > Namespaces
Definition: Representation.h:156
clang::doc::InfoType::IT_record
@ IT_record
clang::doc::CommentInfo::AttrKeys
llvm::SmallVector< SmallString< 16 >, 4 > AttrKeys
Definition: Representation.h:109
clang::doc::Location::operator==
bool operator==(const Location &Other) const
Definition: Representation.h:223
clang::doc::FunctionInfo::Parent
Reference Parent
Definition: Representation.h:311
clang::doc::EnumValueInfo::ValueExpr
SmallString< 16 > ValueExpr
Definition: Representation.h:407
clang::doc::Index::Index
Index()=default
clang::doc::EnumValueInfo::Value
SmallString< 16 > Value
Definition: Representation.h:403
clang::doc::ClangDocContext::JsScripts
std::vector< std::string > JsScripts
Definition: Representation.h:474
clang::doc::TypedefInfo::TypedefInfo
TypedefInfo(SymbolID USR=SymbolID())
Definition: Representation.h:357
clang::doc::EnumInfo::merge
void merge(EnumInfo &&I)
Definition: Representation.cpp:255
clang::doc::CommentInfo::Text
SmallString< 64 > Text
Definition: Representation.h:100
clang::doc::RecordInfo::Children
ScopeChildren Children
Definition: Representation.h:352
clang::doc::ClangDocContext::OutDirectory
std::string OutDirectory
Definition: Representation.h:464
clang::doc::ClangDocContext::ClangDocContext
ClangDocContext()=default
clang::doc::ClangDocContext
Definition: Representation.h:454
clang::doc::SymbolInfo::Loc
llvm::SmallVector< Location, 2 > Loc
Definition: Representation.h:299
clang::doc::SymbolInfo::merge
void merge(SymbolInfo &&I)
Definition: Representation.cpp:211
clang::doc::Index::JumpToSection
llvm::Optional< SmallString< 16 > > JumpToSection
Definition: Representation.h:440
clang::doc::EnumValueInfo::operator==
bool operator==(const EnumValueInfo &Other) const
Definition: Representation.h:393
clang::doc::RecordInfo::Parents
llvm::SmallVector< Reference, 4 > Parents
Definition: Representation.h:342
clang::doc::Reference::getRelativeFilePath
llvm::SmallString< 64 > getRelativeFilePath(const StringRef &CurrentPath) const
Returns the path for this Reference relative to CurrentPath.
Definition: Representation.cpp:154
clang::doc::MemberTypeInfo::Access
AccessSpecifier Access
Definition: Representation.h:212
clang::doc::BaseRecordInfo::IsVirtual
bool IsVirtual
Definition: Representation.h:379
clang::doc::MemberTypeInfo::MemberTypeInfo
MemberTypeInfo(const TypeInfo &TI, StringRef Name, AccessSpecifier Access)
Definition: Representation.h:200
clang::doc::SymbolInfo
Definition: Representation.h:291
clang::doc::CommentInfo::CommentInfo
CommentInfo()=default
clang::doc::TypedefInfo::Underlying
TypeInfo Underlying
Definition: Representation.h:362
clang::doc::CommentInfo::operator=
CommentInfo & operator=(CommentInfo &&Other)=default
clang::doc::Info::USR
SymbolID USR
Definition: Representation.h:253
clang::doc::FunctionInfo::Access
AccessSpecifier Access
Definition: Representation.h:318
clang::doc::FunctionInfo::Params
llvm::SmallVector< FieldTypeInfo, 4 > Params
Definition: Representation.h:313
clang::doc::Index::Index
Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
Definition: Representation.h:434
clang::doc::InfoType::IT_default
@ IT_default
clang::doc::SymbolID
std::array< uint8_t, 20 > SymbolID
Definition: Representation.h:31
clang::doc::Location::Location
Location(int LineNumber=0, StringRef Filename=StringRef(), bool IsFileInRootDir=false)
Definition: Representation.h:218
Name
Token Name
Definition: MacroToEnumCheck.cpp:89
clang::doc::ScopeChildren::Enums
std::vector< EnumInfo > Enums
Definition: Representation.h:159
clang::doc::Location::LineNumber
int LineNumber
Definition: Representation.h:237
clang::doc::RecordInfo
Definition: Representation.h:324
clang::doc::Info::Info
Info(InfoType IT=InfoType::IT_default, SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
Definition: Representation.h:244
clang::doc::TypeInfo::TypeInfo
TypeInfo(StringRef Name, StringRef Path=StringRef())
Definition: Representation.h:170
clang::doc::Location::IsFileInRootDir
bool IsFileInRootDir
Definition: Representation.h:239
clang::doc::BaseRecordInfo::IsParent
bool IsParent
Definition: Representation.h:383
clang::doc::TypeInfo::Type
Reference Type
Definition: Representation.h:175
clang::doc::BaseRecordInfo::BaseRecordInfo
BaseRecordInfo()
Definition: Representation.h:372
clang::doc::Info
A base struct for Infos.
Definition: Representation.h:243
clang::doc::Reference::USR
SymbolID USR
Definition: Representation.h:137
clang::doc::Reference
Definition: Representation.h:118
clang::doc::FieldTypeInfo::DefaultValue
SmallString< 16 > DefaultValue
Definition: Representation.h:194
clang::doc::Info::IT
const InfoType IT
Definition: Representation.h:255
clang::doc::ScopeChildren::Records
std::vector< Reference > Records
Definition: Representation.h:157
clang::doc::Index::operator<
bool operator<(const Index &Other) const
Definition: Representation.cpp:324
clang::doc::NamespaceInfo::Children
ScopeChildren Children
Definition: Representation.h:287
clang::doc::Reference::RefType
InfoType RefType
Definition: Representation.h:139
clang::doc::NamespaceInfo::merge
void merge(NamespaceInfo &&I)
Definition: Representation.cpp:223
clang::doc::SymbolInfo::SymbolInfo
SymbolInfo(InfoType IT, SymbolID USR=SymbolID(), StringRef Name=StringRef(), StringRef Path=StringRef())
Definition: Representation.h:292
clang::doc::CommentInfo::SelfClosing
bool SelfClosing
Definition: Representation.h:105
clang::doc::FunctionInfo::ReturnType
TypeInfo ReturnType
Definition: Representation.h:312
clang::doc::ClangDocContext::PublicOnly
bool PublicOnly
Definition: Representation.h:463
clang::doc::TypeInfo::TypeInfo
TypeInfo(const Reference &R)
Definition: Representation.h:166
clang::doc::TypeInfo::TypeInfo
TypeInfo()=default
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::doc::NamespaceInfo
Definition: Representation.h:280
clang::doc::Reference::Reference
Reference(SymbolID USR=SymbolID(), StringRef Name=StringRef(), InfoType IT=InfoType::IT_default, StringRef Path=StringRef())
Definition: Representation.h:119
clang::doc::FunctionInfo::FunctionInfo
FunctionInfo(SymbolID USR=SymbolID())
Definition: Representation.h:305
clang::doc::FunctionInfo::merge
void merge(FunctionInfo &&I)
Definition: Representation.cpp:264
clang::doc::EnumValueInfo::Name
SmallString< 16 > Name
Definition: Representation.h:398
clang::doc::RecordInfo::merge
void merge(RecordInfo &&I)
Definition: Representation.cpp:234
clang::doc::RecordInfo::TagType
TagTypeKind TagType
Definition: Representation.h:332
clang::doc::TypeInfo
Definition: Representation.h:164
clang::doc::Location::Filename
SmallString< 32 > Filename
Definition: Representation.h:238
clang::doc::CommentInfo::AttrValues
llvm::SmallVector< SmallString< 16 >, 4 > AttrValues
Definition: Representation.h:111
clang::doc::EnumInfo::BaseType
llvm::Optional< TypeInfo > BaseType
Definition: Representation.h:424
clang::doc::FieldTypeInfo::FieldTypeInfo
FieldTypeInfo(const TypeInfo &TI, StringRef Name=StringRef(), StringRef DefaultValue=StringRef())
Definition: Representation.h:181
clang::doc::ClangDocContext::ECtx
tooling::ExecutionContext * ECtx
Definition: Representation.h:461
clang::doc::ClangDocContext::FilesToCopy
std::vector< std::string > FilesToCopy
Definition: Representation.h:476
clang::doc::CommentInfo::Args
llvm::SmallVector< SmallString< 16 >, 4 > Args
Definition: Representation.h:113
clang::doc::EnumInfo::EnumInfo
EnumInfo()
Definition: Representation.h:413
clang::doc::Info::~Info
virtual ~Info()=default
clang::doc::Info::mergeable
bool mergeable(const Info &Other)
Definition: Representation.cpp:207
clang::doc::MemberTypeInfo::MemberTypeInfo
MemberTypeInfo()=default
clang::doc::FieldTypeInfo::FieldTypeInfo
FieldTypeInfo()=default
clang::doc::MemberTypeInfo::operator==
bool operator==(const MemberTypeInfo &Other) const
Definition: Representation.h:203
clang::doc::mergeInfos
llvm::Expected< std::unique_ptr< Info > > mergeInfos(std::vector< std::unique_ptr< Info >> &Values)
Definition: Representation.cpp:109
clang::doc::Index::sort
void sort()
Definition: Representation.cpp:343
clang::doc::SymbolInfo::DefLoc
llvm::Optional< Location > DefLoc
Definition: Representation.h:298
clang::doc::FieldTypeInfo
Definition: Representation.h:179
clang::doc::TypeInfo::operator==
bool operator==(const TypeInfo &Other) const
Definition: Representation.h:173
clang::doc::EnumInfo::EnumInfo
EnumInfo(SymbolID USR)
Definition: Representation.h:414
clang::doc::MemberTypeInfo
Definition: Representation.h:198
clang::doc::Info::Namespace
llvm::SmallVector< Reference, 4 > Namespace
Definition: Representation.h:258
clang::doc::Info::getRelativeFilePath
llvm::SmallString< 64 > getRelativeFilePath(const StringRef &CurrentPath) const
Returns the file path for this Info relative to CurrentPath.
Definition: Representation.cpp:166
clang::doc::Index::operator==
bool operator==(const SymbolID &Other) const
Definition: Representation.h:437
clang::doc::Index::Index
Index(StringRef Name)
Definition: Representation.h:431
clang::doc::EnumInfo::Scoped
bool Scoped
Definition: Representation.h:419
Path
std::vector< HeaderHandle > Path
Definition: PreprocessorTracker.cpp:525
clang::doc::FunctionInfo::IsMethod
bool IsMethod
Definition: Representation.h:310
clang::doc::Info::getFileBaseName
llvm::SmallString< 16 > getFileBaseName() const
Returns the basename that should be used for this Info.
Definition: Representation.cpp:170
clang::doc::BaseRecordInfo::BaseRecordInfo
BaseRecordInfo(SymbolID USR, StringRef Name, StringRef Path, bool IsVirtual, AccessSpecifier Access, bool IsParent)
Definition: Representation.h:373
clang::doc::Index::Children
std::vector< Index > Children
Definition: Representation.h:441