clang 20.0.0git
API.h
Go to the documentation of this file.
1//===- ExtractAPI/API.h -----------------------------------------*- 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/// \file
10/// This file defines the APIRecord-based structs and the APISet class.
11///
12/// Clang ExtractAPI is a tool to collect API information from a given set of
13/// header files. The structures in this file describe data representations of
14/// the API information collected for various kinds of symbols.
15///
16//===----------------------------------------------------------------------===//
17
18#ifndef LLVM_CLANG_EXTRACTAPI_API_H
19#define LLVM_CLANG_EXTRACTAPI_API_H
20
22#include "clang/AST/DeclBase.h"
26#include "llvm/ADT/SmallPtrSet.h"
27#include "llvm/Support/Allocator.h"
28#include "llvm/Support/Casting.h"
29#include "llvm/TargetParser/Triple.h"
30#include <cstddef>
31#include <iterator>
32#include <memory>
33#include <optional>
34#include <type_traits>
35
36namespace clang {
37namespace extractapi {
38
39class Template {
40 struct TemplateParameter {
41 // "class", "typename", or concept name
42 std::string Type;
43 std::string Name;
44 unsigned int Index;
45 unsigned int Depth;
46 bool IsParameterPack;
47
48 TemplateParameter(std::string Type, std::string Name, unsigned int Index,
49 unsigned int Depth, bool IsParameterPack)
50 : Type(Type), Name(Name), Index(Index), Depth(Depth),
51 IsParameterPack(IsParameterPack) {}
52 };
53
54 struct TemplateConstraint {
55 // type name of the constraint, if it has one
56 std::string Type;
57 std::string Kind;
58 std::string LHS, RHS;
59 };
62
63public:
64 Template() = default;
65
67 for (auto *const Parameter : *Decl->getTemplateParameters()) {
68 const auto *Param = dyn_cast<TemplateTypeParmDecl>(Parameter);
69 if (!Param) // some params are null
70 continue;
71 std::string Type;
72 if (Param->hasTypeConstraint())
73 Type = Param->getTypeConstraint()->getNamedConcept()->getName().str();
74 else if (Param->wasDeclaredWithTypename())
75 Type = "typename";
76 else
77 Type = "class";
78
79 addTemplateParameter(Type, Param->getName().str(), Param->getIndex(),
80 Param->getDepth(), Param->isParameterPack());
81 }
82 }
83
85 for (auto *const Parameter : *Decl->getTemplateParameters()) {
86 const auto *Param = dyn_cast<TemplateTypeParmDecl>(Parameter);
87 if (!Param) // some params are null
88 continue;
89 std::string Type;
90 if (Param->hasTypeConstraint())
91 Type = Param->getTypeConstraint()->getNamedConcept()->getName().str();
92 else if (Param->wasDeclaredWithTypename())
93 Type = "typename";
94 else
95 Type = "class";
96
97 addTemplateParameter(Type, Param->getName().str(), Param->getIndex(),
98 Param->getDepth(), Param->isParameterPack());
99 }
100 }
101
103 for (auto *const Parameter : *Decl->getTemplateParameters()) {
104 const auto *Param = dyn_cast<TemplateTypeParmDecl>(Parameter);
105 if (!Param) // some params are null
106 continue;
107 std::string Type;
108 if (Param->hasTypeConstraint())
109 Type = Param->getTypeConstraint()->getNamedConcept()->getName().str();
110 else if (Param->wasDeclaredWithTypename())
111 Type = "typename";
112 else
113 Type = "class";
114
115 addTemplateParameter(Type, Param->getName().str(), Param->getIndex(),
116 Param->getDepth(), Param->isParameterPack());
117 }
118 }
119
121 return Parameters;
122 }
123
125 return Constraints;
126 }
127
128 void addTemplateParameter(std::string Type, std::string Name,
129 unsigned int Index, unsigned int Depth,
130 bool IsParameterPack) {
131 Parameters.emplace_back(Type, Name, Index, Depth, IsParameterPack);
132 }
133
134 bool empty() const { return Parameters.empty() && Constraints.empty(); }
135};
136
137/// DocComment is a vector of RawComment::CommentLine.
138///
139/// Each line represents one line of striped documentation comment,
140/// with source range information. This simplifies calculating the source
141/// location of a character in the doc comment for pointing back to the source
142/// file.
143/// e.g.
144/// \code
145/// /// This is a documentation comment
146/// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' First line.
147/// /// with multiple lines.
148/// ^~~~~~~~~~~~~~~~~~~~~~~' Second line.
149/// \endcode
150using DocComment = std::vector<RawComment::CommentLine>;
151
152struct APIRecord;
153
154// This represents a reference to another symbol that might come from external
155/// sources.
157 StringRef Name;
158 StringRef USR;
159
160 /// The source project/module/product of the referred symbol.
161 StringRef Source;
162
163 // A Pointer to the APIRecord for this reference if known
164 const APIRecord *Record = nullptr;
165
166 SymbolReference() = default;
167 SymbolReference(StringRef Name, StringRef USR, StringRef Source = "")
168 : Name(Name), USR(USR), Source(Source) {}
169 SymbolReference(const APIRecord *R);
170
171 /// Determine if this SymbolReference is empty.
172 ///
173 /// \returns true if and only if all \c Name, \c USR, and \c Source is empty.
174 bool empty() const { return Name.empty() && USR.empty() && Source.empty(); }
175};
176
177class RecordContext;
178
179// Concrete classes deriving from APIRecord need to have a construct with first
180// arguments USR, and Name, in that order. This is so that they
181// are compatible with `APISet::createRecord`.
182// When adding a new kind of record don't forget to update APIRecords.inc!
183/// The base representation of an API record. Holds common symbol information.
184struct APIRecord {
185 /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
188 // If adding a record context record kind here make sure to update
189 // RecordContext::classof if needed and add a RECORD_CONTEXT entry to
190 // APIRecords.inc
231 };
232
233 StringRef USR;
234 StringRef Name;
235
237
241
242 /// Documentation comment lines attached to this symbol declaration.
244
245 /// Declaration fragments of this symbol declaration.
247
248 /// SubHeading provides a more detailed representation than the plain
249 /// declaration name.
250 ///
251 /// SubHeading is an array of declaration fragments of tagged declaration
252 /// name, with potentially more tokens (for example the \c +/- symbol for
253 /// Objective-C class/instance methods).
255
256 /// Whether the symbol was defined in a system header.
258
260
262
263private:
264 const RecordKind Kind;
265 friend class RecordContext;
266 // Used to store the next child record in RecordContext. This works because
267 // APIRecords semantically only have one parent.
268 mutable APIRecord *NextInContext = nullptr;
269
270public:
271 APIRecord *getNextInContext() const { return NextInContext; }
272
273 RecordKind getKind() const { return Kind; }
275
278
279 APIRecord() = delete;
280
281 APIRecord(RecordKind Kind, StringRef USR, StringRef Name,
287 : USR(USR), Name(Name), Parent(std::move(Parent)), Location(Location),
292
293 APIRecord(RecordKind Kind, StringRef USR, StringRef Name)
295
296 // Pure virtual destructor to make APIRecord abstract
297 virtual ~APIRecord() = 0;
298 static bool classof(const APIRecord *Record) { return true; }
299 static bool classofKind(RecordKind K) { return true; }
300 static bool classof(const RecordContext *Ctx) { return true; }
301};
302
303/// Base class used for specific record types that have children records this is
304/// analogous to the DeclContext for the AST
306public:
307 static bool classof(const APIRecord *Record) {
308 return classofKind(Record->getKind());
309 }
313 }
314
315 static bool classof(const RecordContext *Context) { return true; }
316
318
319 /// Append \p Other children chain into ours and empty out Other's record
320 /// chain.
322
324
325 APIRecord::RecordKind getKind() const { return Kind; }
326
328 private:
329 APIRecord *Current = nullptr;
330
331 public:
333 using reference = const value_type &;
334 using pointer = const value_type *;
335 using iterator_category = std::forward_iterator_tag;
336 using difference_type = std::ptrdiff_t;
337
338 record_iterator() = default;
339 explicit record_iterator(value_type R) : Current(R) {}
340 reference operator*() const { return Current; }
341 // This doesn't strictly meet the iterator requirements, but it's the
342 // behavior we want here.
343 value_type operator->() const { return Current; }
345 Current = Current->getNextInContext();
346 return *this;
347 }
349 record_iterator tmp(*this);
350 ++(*this);
351 return tmp;
352 }
353
355 return x.Current == y.Current;
356 }
358 return x.Current != y.Current;
359 }
360 };
361
362 using record_range = llvm::iterator_range<record_iterator>;
365 }
368 bool records_empty() const { return First == nullptr; };
369
370private:
372 mutable APIRecord *First = nullptr;
373 mutable APIRecord *Last = nullptr;
374 bool IsWellFormed() const;
375
376protected:
377 friend class APISet;
378 void addToRecordChain(APIRecord *) const;
379};
380
391
392 static bool classof(const APIRecord *Record) {
393 return classofKind(Record->getKind());
394 }
395 static bool classofKind(RecordKind K) { return K == RK_Namespace; }
396};
397
398/// This holds information associated with global functions.
401
412
413 GlobalFunctionRecord(RecordKind Kind, StringRef USR, StringRef Name,
416 const DocComment &Comment,
420 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
424
425 static bool classof(const APIRecord *Record) {
426 return classofKind(Record->getKind());
427 }
428 static bool classofKind(RecordKind K) { return K == RK_GlobalFunction; }
429
430private:
431 virtual void anchor();
432};
433
436
449 Templ(Template) {}
450
451 static bool classof(const APIRecord *Record) {
452 return classofKind(Record->getKind());
453 }
454 static bool classofKind(RecordKind K) {
455 return K == RK_GlobalFunctionTemplate;
456 }
457};
458
461 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
470
471 static bool classof(const APIRecord *Record) {
472 return classofKind(Record->getKind());
473 }
474 static bool classofKind(RecordKind K) {
476 }
477};
478
479/// This holds information associated with global functions.
490
491 GlobalVariableRecord(RecordKind Kind, StringRef USR, StringRef Name,
494 const DocComment &Comment,
497 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
500 RecordContext(Kind) {}
501
502 static bool classof(const APIRecord *Record) {
503 return classofKind(Record->getKind());
504 }
505 static bool classofKind(RecordKind K) {
506 return K == RK_GlobalVariable || K == RK_GlobalVariableTemplate ||
509 }
510
511private:
512 virtual void anchor();
513};
514
517
528 Templ(Template) {}
529
530 static bool classof(const APIRecord *Record) {
531 return classofKind(Record->getKind());
532 }
533 static bool classofKind(RecordKind K) {
534 return K == RK_GlobalVariableTemplate;
535 }
536};
537
540 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
548
549 static bool classof(const APIRecord *Record) {
550 return classofKind(Record->getKind());
551 }
552 static bool classofKind(RecordKind K) {
554 }
555};
556
560
562 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
568 USR, Name, Parent, Loc, std::move(Availability),
571 Templ(Template) {}
572
573 static bool classof(const APIRecord *Record) {
574 return classofKind(Record->getKind());
575 }
576 static bool classofKind(RecordKind K) {
578 }
579};
580
581/// This holds information associated with enum constants.
585 const DocComment &Comment,
589 std::move(Availability), LinkageInfo::none(), Comment,
591
592 static bool classof(const APIRecord *Record) {
593 return classofKind(Record->getKind());
594 }
595 static bool classofKind(RecordKind K) { return K == RK_EnumConstant; }
596
597private:
598 virtual void anchor();
599};
600
602 TagRecord(RecordKind Kind, StringRef USR, StringRef Name,
608 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
611 RecordContext(Kind),
613
614 static bool classof(const APIRecord *Record) {
615 return classofKind(Record->getKind());
616 }
617 static bool classofKind(RecordKind K) {
618 return K == RK_Struct || K == RK_Union || K == RK_Enum;
619 }
620
622
623 virtual ~TagRecord() = 0;
624};
625
626/// This holds information associated with enums.
628 EnumRecord(StringRef USR, StringRef Name, SymbolReference Parent,
637
638 static bool classof(const APIRecord *Record) {
639 return classofKind(Record->getKind());
640 }
641
642 static bool classofKind(RecordKind K) { return K == RK_Enum; }
643
644private:
645 virtual void anchor();
646};
647
648/// This holds information associated with struct or union fields fields.
650 RecordFieldRecord(RecordKind Kind, StringRef USR, StringRef Name,
655 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
658 RecordContext(Kind) {}
659
660 static bool classof(const APIRecord *Record) {
661 return classofKind(Record->getKind());
662 }
663 static bool classofKind(RecordKind K) {
664 return K == RK_StructField || K == RK_UnionField;
665 }
666
667 virtual ~RecordFieldRecord() = 0;
668};
669
670/// This holds information associated with structs and unions.
672 RecordRecord(RecordKind Kind, StringRef USR, StringRef Name,
679 : TagRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
682
683 static bool classof(const APIRecord *Record) {
684 return classofKind(Record->getKind());
685 }
686 static bool classofKind(RecordKind K) {
687 return K == RK_Struct || K == RK_Union;
688 }
689
690 bool isAnonymousWithNoTypedef() { return Name.empty(); }
691
692 virtual ~RecordRecord() = 0;
693};
694
703
704 static bool classof(const APIRecord *Record) {
705 return classofKind(Record->getKind());
706 }
707 static bool classofKind(RecordKind K) { return K == RK_StructField; }
708
709private:
710 virtual void anchor();
711};
712
722
723 static bool classof(const APIRecord *Record) {
724 return classofKind(Record->getKind());
725 }
726 static bool classofKind(RecordKind K) { return K == RK_Struct; }
727
728private:
729 virtual void anchor();
730};
731
740
741 static bool classof(const APIRecord *Record) {
742 return classofKind(Record->getKind());
743 }
744 static bool classofKind(RecordKind K) { return K == RK_UnionField; }
745
746private:
747 virtual void anchor();
748};
749
759
760 static bool classof(const APIRecord *Record) {
761 return classofKind(Record->getKind());
762 }
763 static bool classofKind(RecordKind K) { return K == RK_Union; }
764
765private:
766 virtual void anchor();
767};
768
779
780 CXXFieldRecord(RecordKind Kind, StringRef USR, StringRef Name,
786 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
789 RecordContext(Kind) {}
790
791 static bool classof(const APIRecord *Record) {
792 return classofKind(Record->getKind());
793 }
794 static bool classofKind(RecordKind K) {
795 return K == RK_CXXField || K == RK_CXXFieldTemplate || K == RK_StaticField;
796 }
797
798private:
799 virtual void anchor();
800};
801
804
807 const DocComment &Comment,
814 Templ(Template) {}
815
816 static bool classof(const APIRecord *Record) {
817 return classofKind(Record->getKind());
818 }
819 static bool classofKind(RecordKind K) { return K == RK_CXXFieldTemplate; }
820};
821
824
825 CXXMethodRecord() = delete;
826
827 CXXMethodRecord(RecordKind Kind, StringRef USR, StringRef Name,
833 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
837
838 virtual ~CXXMethodRecord() = 0;
839};
840
844 const DocComment &Comment,
853 static bool classof(const APIRecord *Record) {
854 return classofKind(Record->getKind());
855 }
856 static bool classofKind(RecordKind K) { return K == RK_CXXConstructorMethod; }
857
858private:
859 virtual void anchor();
860};
861
865 const DocComment &Comment,
874 static bool classof(const APIRecord *Record) {
875 return classofKind(Record->getKind());
876 }
877 static bool classofKind(RecordKind K) { return K == RK_CXXDestructorMethod; }
878
879private:
880 virtual void anchor();
881};
882
886 const DocComment &Comment,
895 static bool classof(const APIRecord *Record) {
896 return classofKind(Record->getKind());
897 }
898 static bool classofKind(RecordKind K) { return K == RK_CXXStaticMethod; }
899
900private:
901 virtual void anchor();
902};
903
907 const DocComment &Comment,
916
917 static bool classof(const APIRecord *Record) {
918 return classofKind(Record->getKind());
919 }
920 static bool classofKind(RecordKind K) { return K == RK_CXXInstanceMethod; }
921
922private:
923 virtual void anchor();
924};
925
928
931 const DocComment &Comment,
940 Templ(Template) {}
941
942 static bool classof(const APIRecord *Record) {
943 return classofKind(Record->getKind());
944 }
945 static bool classofKind(RecordKind K) { return K == RK_CXXMethodTemplate; }
946};
947
950 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
959
960 static bool classof(const APIRecord *Record) {
961 return classofKind(Record->getKind());
962 }
963 static bool classofKind(RecordKind K) {
965 }
966};
967
968/// This holds information associated with Objective-C properties.
970 /// The attributes associated with an Objective-C property.
971 enum AttributeKind : unsigned {
974 Dynamic = 1 << 2,
975 };
976
978 StringRef GetterName;
979 StringRef SetterName;
981
982 ObjCPropertyRecord(RecordKind Kind, StringRef USR, StringRef Name,
987 StringRef GetterName, StringRef SetterName,
989 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
994
995 bool isReadOnly() const { return Attributes & ReadOnly; }
996 bool isDynamic() const { return Attributes & Dynamic; }
997
998 virtual ~ObjCPropertyRecord() = 0;
999};
1000
1003 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
1006 AttributeKind Attributes, StringRef GetterName, StringRef SetterName,
1007 bool IsOptional, bool IsFromSystemHeader)
1012
1013 static bool classof(const APIRecord *Record) {
1014 return classofKind(Record->getKind());
1015 }
1016 static bool classofKind(RecordKind K) { return K == RK_ObjCInstanceProperty; }
1017
1018private:
1019 virtual void anchor();
1020};
1021
1025 const DocComment &Comment,
1029 StringRef SetterName, bool IsOptional,
1030 bool IsFromSystemHeader)
1035
1036 static bool classof(const APIRecord *Record) {
1037 return classofKind(Record->getKind());
1038 }
1039 static bool classofKind(RecordKind K) { return K == RK_ObjCClassProperty; }
1040
1041private:
1042 virtual void anchor();
1043};
1044
1045/// This holds information associated with Objective-C instance variables.
1050 const DocComment &Comment,
1053 bool IsFromSystemHeader)
1057
1058 static bool classof(const APIRecord *Record) {
1059 return classofKind(Record->getKind());
1060 }
1061 static bool classofKind(RecordKind K) { return K == RK_ObjCIvar; }
1062
1063private:
1064 virtual void anchor();
1065};
1066
1067/// This holds information associated with Objective-C methods.
1070
1072
1073 ObjCMethodRecord(RecordKind Kind, StringRef USR, StringRef Name,
1078 bool IsFromSystemHeader)
1079 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
1083
1084 virtual ~ObjCMethodRecord() = 0;
1085};
1086
1088 ObjCInstanceMethodRecord(StringRef USR, StringRef Name,
1091 const DocComment &Comment,
1098 static bool classof(const APIRecord *Record) {
1099 return classofKind(Record->getKind());
1100 }
1101 static bool classofKind(RecordKind K) { return K == RK_ObjCInstanceMethod; }
1102
1103private:
1104 virtual void anchor();
1105};
1106
1110 const DocComment &Comment,
1117
1118 static bool classof(const APIRecord *Record) {
1119 return classofKind(Record->getKind());
1120 }
1121 static bool classofKind(RecordKind K) { return K == RK_ObjCClassMethod; }
1122
1123private:
1124 virtual void anchor();
1125};
1126
1133 bool IsFromSystemHeader)
1137
1138 static bool classof(const APIRecord *Record) {
1139 return classofKind(Record->getKind());
1140 }
1141 static bool classofKind(RecordKind K) { return K == RK_StaticField; }
1142};
1143
1144/// The base representation of an Objective-C container record. Holds common
1145/// information associated with Objective-C containers.
1148
1150
1151 ObjCContainerRecord(RecordKind Kind, StringRef USR, StringRef Name,
1154 const DocComment &Comment,
1157 : APIRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
1160 RecordContext(Kind) {}
1161
1162 virtual ~ObjCContainerRecord() = 0;
1163};
1164
1167
1173 bool IsEmbeddedInVarDeclarator = false)
1174 : RecordRecord(Kind, USR, Name, Parent, Loc, std::move(Availability),
1177
1178 static bool classof(const APIRecord *Record) {
1179 return classofKind(Record->getKind());
1180 }
1181 static bool classofKind(RecordKind K) {
1182 return K == RK_CXXClass || K == RK_ClassTemplate ||
1185 }
1186
1187private:
1188 virtual void anchor();
1189};
1190
1193
1196 const DocComment &Comment,
1202 std::move(Access), IsFromSystemHeader),
1203 Templ(Template) {}
1204
1205 static bool classof(const APIRecord *Record) {
1206 return classofKind(Record->getKind());
1207 }
1208 static bool classofKind(RecordKind K) { return K == RK_ClassTemplate; }
1209};
1210
1213 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
1220
1221 static bool classof(const APIRecord *Record) {
1222 return classofKind(Record->getKind());
1223 }
1224 static bool classofKind(RecordKind K) {
1226 }
1227};
1228
1232 StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
1240 Templ(Template) {}
1241
1242 static bool classof(const APIRecord *Record) {
1243 return classofKind(Record->getKind());
1244 }
1245 static bool classofKind(RecordKind K) {
1247 }
1248};
1249
1252
1257 bool IsFromSystemHeader)
1261 Templ(Template) {}
1262
1263 static bool classof(const APIRecord *Record) {
1264 return classofKind(Record->getKind());
1265 }
1266 static bool classofKind(RecordKind K) { return K == RK_Concept; }
1267};
1268
1269/// This holds information associated with Objective-C categories.
1272
1275 const DocComment &Comment,
1278 bool IsFromSystemHeader)
1280 std::move(Availability), LinkageInfo::none(),
1284
1285 static bool classof(const APIRecord *Record) {
1286 return classofKind(Record->getKind());
1287 }
1288 static bool classofKind(RecordKind K) { return K == RK_ObjCCategory; }
1289
1290 bool isExtendingExternalModule() const { return !Interface.Source.empty(); }
1291
1292 std::optional<StringRef> getExtendedExternalModule() const {
1294 return {};
1295 return Interface.Source;
1296 }
1297
1298private:
1299 virtual void anchor();
1300};
1301
1302/// This holds information associated with Objective-C interfaces/classes.
1305
1316
1317 static bool classof(const APIRecord *Record) {
1318 return classofKind(Record->getKind());
1319 }
1320 static bool classofKind(RecordKind K) { return K == RK_ObjCInterface; }
1321
1322private:
1323 virtual void anchor();
1324};
1325
1326/// This holds information associated with Objective-C protocols.
1330 const DocComment &Comment,
1334 std::move(Availability), LinkageInfo::none(),
1337
1338 static bool classof(const APIRecord *Record) {
1339 return classofKind(Record->getKind());
1340 }
1341 static bool classofKind(RecordKind K) { return K == RK_ObjCProtocol; }
1342
1343private:
1344 virtual void anchor();
1345};
1346
1347/// This holds information associated with macro definitions.
1352 bool IsFromSystemHeader)
1356
1357 static bool classof(const APIRecord *Record) {
1358 return classofKind(Record->getKind());
1359 }
1360 static bool classofKind(RecordKind K) { return K == RK_MacroDefinition; }
1361
1362private:
1363 virtual void anchor();
1364};
1365
1366/// This holds information associated with typedefs.
1367///
1368/// Note: Typedefs for anonymous enums and structs typically don't get emitted
1369/// by the serializers but still get a TypedefRecord. Instead we use the
1370/// typedef name as a name for the underlying anonymous struct or enum.
1373
1378 bool IsFromSystemHeader)
1383
1384 static bool classof(const APIRecord *Record) {
1385 return classofKind(Record->getKind());
1386 }
1387 static bool classofKind(RecordKind K) { return K == RK_Typedef; }
1388
1389private:
1390 virtual void anchor();
1391};
1392
1393/// APISet holds the set of API records collected from given inputs.
1394class APISet {
1395public:
1396 /// Get the target triple for the ExtractAPI invocation.
1397 const llvm::Triple &getTarget() const { return Target; }
1398
1399 /// Get the language used by the APIs.
1400 Language getLanguage() const { return Lang; }
1401
1402 /// Finds the APIRecord for a given USR.
1403 ///
1404 /// \returns a pointer to the APIRecord associated with that USR or nullptr.
1405 APIRecord *findRecordForUSR(StringRef USR) const;
1406
1407 /// Copy \p String into the Allocator in this APISet.
1408 ///
1409 /// \returns a StringRef of the copied string in APISet::Allocator.
1410 StringRef copyString(StringRef String);
1411
1412 SymbolReference createSymbolReference(StringRef Name, StringRef USR,
1413 StringRef Source = "");
1414
1415 /// Create a subclass of \p APIRecord and store it in the APISet.
1416 ///
1417 /// \returns A pointer to the created record or the already existing record
1418 /// matching this USR.
1419 template <typename RecordTy, typename... CtorArgsContTy>
1420 typename std::enable_if_t<std::is_base_of_v<APIRecord, RecordTy>, RecordTy> *
1421 createRecord(StringRef USR, StringRef Name, CtorArgsContTy &&...CtorArgs);
1422
1423 auto getTopLevelRecords() const {
1424 return llvm::iterator_range<decltype(TopLevelRecords)::iterator>(
1425 TopLevelRecords);
1426 }
1427
1428 void removeRecord(StringRef USR);
1429
1431
1432 APISet(const llvm::Triple &Target, Language Lang,
1433 const std::string &ProductName)
1434 : Target(Target), Lang(Lang), ProductName(ProductName) {}
1435
1436 // Prevent moves and copies
1437 APISet(const APISet &Other) = delete;
1438 APISet &operator=(const APISet &Other) = delete;
1439 APISet(APISet &&Other) = delete;
1441
1442private:
1443 /// BumpPtrAllocator that serves as the memory arena for the allocated objects
1444 llvm::BumpPtrAllocator Allocator;
1445
1446 const llvm::Triple Target;
1447 const Language Lang;
1448
1449 struct APIRecordDeleter {
1450 void operator()(APIRecord *Record) { Record->~APIRecord(); }
1451 };
1452
1453 // Ensure that the destructor of each record is called when the LookupTable is
1454 // destroyed without calling delete operator as the memory for the record
1455 // lives in the BumpPtrAllocator.
1456 using APIRecordStoredPtr = std::unique_ptr<APIRecord, APIRecordDeleter>;
1457 llvm::DenseMap<StringRef, APIRecordStoredPtr> USRBasedLookupTable;
1459
1460public:
1461 const std::string ProductName;
1462};
1463
1464template <typename RecordTy, typename... CtorArgsContTy>
1465typename std::enable_if_t<std::is_base_of_v<APIRecord, RecordTy>, RecordTy> *
1466APISet::createRecord(StringRef USR, StringRef Name,
1467 CtorArgsContTy &&...CtorArgs) {
1468 // Ensure USR refers to a String stored in the allocator.
1469 auto USRString = copyString(USR);
1470 auto Result = USRBasedLookupTable.insert({USRString, nullptr});
1471 RecordTy *Record;
1472
1473 // Create the record if it does not already exist
1474 if (Result.second) {
1475 Record = new (Allocator) RecordTy(
1476 USRString, copyString(Name), std::forward<CtorArgsContTy>(CtorArgs)...);
1477 // Store the record in the record lookup map
1478 Result.first->second = APIRecordStoredPtr(Record);
1479
1480 if (auto *ParentContext =
1481 dyn_cast_if_present<RecordContext>(Record->Parent.Record))
1482 ParentContext->addToRecordChain(Record);
1483 else
1484 TopLevelRecords.insert(Record);
1485 } else {
1486 Record = dyn_cast<RecordTy>(Result.first->second.get());
1487 }
1488
1489 return Record;
1490}
1491
1492// Helper type for implementing casting to RecordContext pointers.
1493// Selected when FromTy not a known subclass of RecordContext.
1494template <typename FromTy,
1495 bool IsKnownSubType = std::is_base_of_v<RecordContext, FromTy>>
1497 static_assert(std::is_base_of_v<APIRecord, FromTy>,
1498 "Can only cast APIRecord and derived classes to RecordContext");
1499
1500 static bool isPossible(FromTy *From) { return RecordContext::classof(From); }
1501
1502 static RecordContext *doCast(FromTy *From) {
1503 return APIRecord::castToRecordContext(From);
1504 }
1505};
1506
1507// Selected when FromTy is a known subclass of RecordContext.
1508template <typename FromTy> struct ToRecordContextCastInfoWrapper<FromTy, true> {
1509 static_assert(std::is_base_of_v<APIRecord, FromTy>,
1510 "Can only cast APIRecord and derived classes to RecordContext");
1511 static bool isPossible(const FromTy *From) { return true; }
1512 static RecordContext *doCast(FromTy *From) {
1513 return static_cast<RecordContext *>(From);
1514 }
1515};
1516
1517// Helper type for implementing casting to RecordContext pointers.
1518// Selected when ToTy isn't a known subclass of RecordContext
1519template <typename ToTy,
1520 bool IsKnownSubType = std::is_base_of_v<RecordContext, ToTy>>
1522 static_assert(
1523 std::is_base_of_v<APIRecord, ToTy>,
1524 "Can only class RecordContext to APIRecord and derived classes");
1525
1526 static bool isPossible(RecordContext *Ctx) {
1527 return ToTy::classofKind(Ctx->getKind());
1528 }
1529
1530 static ToTy *doCast(RecordContext *Ctx) {
1532 }
1533};
1534
1535// Selected when ToTy is a known subclass of RecordContext.
1536template <typename ToTy> struct FromRecordContextCastInfoWrapper<ToTy, true> {
1537 static_assert(
1538 std::is_base_of_v<APIRecord, ToTy>,
1539 "Can only class RecordContext to APIRecord and derived classes");
1540 static bool isPossible(RecordContext *Ctx) {
1541 return ToTy::classof(Ctx->getKind());
1542 }
1544 return static_cast<ToTy *>(Ctx);
1545 }
1546};
1547
1548} // namespace extractapi
1549} // namespace clang
1550
1551// Implement APIRecord (and derived classes) to and from RecordContext
1552// conversions
1553namespace llvm {
1554
1555template <typename FromTy>
1556struct CastInfo<::clang::extractapi::RecordContext, FromTy *>
1557 : public NullableValueCastFailed<::clang::extractapi::RecordContext *>,
1559 ::clang::extractapi::RecordContext *, FromTy *,
1560 CastInfo<::clang::extractapi::RecordContext, FromTy *>> {
1561 static inline bool isPossible(FromTy *From) {
1562 return ::clang::extractapi::ToRecordContextCastInfoWrapper<
1563 FromTy>::isPossible(From);
1564 }
1565
1566 static inline ::clang::extractapi::RecordContext *doCast(FromTy *From) {
1567 return ::clang::extractapi::ToRecordContextCastInfoWrapper<FromTy>::doCast(
1568 From);
1569 }
1570};
1571
1572template <typename FromTy>
1573struct CastInfo<::clang::extractapi::RecordContext, const FromTy *>
1575 ::clang::extractapi::RecordContext, const FromTy *,
1576 CastInfo<::clang::extractapi::RecordContext, FromTy *>> {};
1577
1578template <typename ToTy>
1579struct CastInfo<ToTy, ::clang::extractapi::RecordContext *>
1580 : public NullableValueCastFailed<ToTy *>,
1582 ToTy *, ::clang::extractapi::RecordContext *,
1583 CastInfo<ToTy, ::clang::extractapi::RecordContext *>> {
1585 return ::clang::extractapi::FromRecordContextCastInfoWrapper<
1586 ToTy>::isPossible(Ctx);
1587 }
1588
1589 static inline ToTy *doCast(::clang::extractapi::RecordContext *Ctx) {
1590 return ::clang::extractapi::FromRecordContextCastInfoWrapper<ToTy>::doCast(
1591 Ctx);
1592 }
1593};
1594
1595template <typename ToTy>
1596struct CastInfo<ToTy, const ::clang::extractapi::RecordContext *>
1598 ToTy, const ::clang::extractapi::RecordContext *,
1599 CastInfo<ToTy, ::clang::extractapi::RecordContext *>> {};
1600
1601} // namespace llvm
1602
1603#endif // LLVM_CLANG_EXTRACTAPI_API_H
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
This file defines the Declaration Fragments related classes.
llvm::MachO::Target Target
Definition: MachO.h:51
llvm::MachO::Record Record
Definition: MachO.h:31
SourceLocation Loc
Definition: SemaObjC.cpp:759
Defines the clang::SourceLocation class and associated facilities.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
Represents an unpacked "presumed" location which can be presented to the user.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:394
The base class of the type hierarchy.
Definition: Type.h:1829
APISet holds the set of API records collected from given inputs.
Definition: API.h:1394
std::enable_if_t< std::is_base_of_v< APIRecord, RecordTy >, RecordTy > * createRecord(StringRef USR, StringRef Name, CtorArgsContTy &&...CtorArgs)
Create a subclass of APIRecord and store it in the APISet.
Definition: API.h:1466
APISet & operator=(const APISet &Other)=delete
SymbolReference createSymbolReference(StringRef Name, StringRef USR, StringRef Source="")
Definition: API.cpp:134
Language getLanguage() const
Get the language used by the APIs.
Definition: API.h:1400
const std::string ProductName
Definition: API.h:1461
APISet(const APISet &Other)=delete
StringRef copyString(StringRef String)
Copy String into the Allocator in this APISet.
Definition: API.cpp:121
APISet(APISet &&Other)=delete
const llvm::Triple & getTarget() const
Get the target triple for the ExtractAPI invocation.
Definition: API.h:1397
APISet & operator=(APISet &&Other)=delete
auto getTopLevelRecords() const
Definition: API.h:1423
void removeRecord(StringRef USR)
Definition: API.cpp:139
APIRecord * findRecordForUSR(StringRef USR) const
Finds the APIRecord for a given USR.
Definition: API.cpp:110
APISet(const llvm::Triple &Target, Language Lang, const std::string &ProductName)
Definition: API.h:1432
DeclarationFragments is a vector of tagged important parts of a symbol's declaration.
Store function signature information with DeclarationFragments of the return type and parameters.
Base class used for specific record types that have children records this is analogous to the DeclCon...
Definition: API.h:305
void removeFromRecordChain(APIRecord *Record)
Definition: API.cpp:94
record_iterator records_begin() const
Definition: API.h:366
bool records_empty() const
Definition: API.h:368
static bool classof(const RecordContext *Context)
Definition: API.h:315
llvm::iterator_range< record_iterator > record_range
Definition: API.h:362
APIRecord::RecordKind getKind() const
Definition: API.h:325
record_range records() const
Definition: API.h:363
void stealRecordChain(RecordContext &Other)
Append Other children chain into ours and empty out Other's record chain.
Definition: API.cpp:59
record_iterator records_end() const
Definition: API.h:367
static bool classofKind(APIRecord::RecordKind K)
Definition: API.h:310
void addToRecordChain(APIRecord *) const
Definition: API.cpp:82
RecordContext(APIRecord::RecordKind Kind)
Definition: API.h:317
static bool classof(const APIRecord *Record)
Definition: API.h:307
void addTemplateParameter(std::string Type, std::string Name, unsigned int Index, unsigned int Depth, bool IsParameterPack)
Definition: API.h:128
Template(const TemplateDecl *Decl)
Definition: API.h:66
Template(const VarTemplatePartialSpecializationDecl *Decl)
Definition: API.h:102
Template(const ClassTemplatePartialSpecializationDecl *Decl)
Definition: API.h:84
const llvm::SmallVector< TemplateParameter > & getParameters() const
Definition: API.h:120
const llvm::SmallVector< TemplateConstraint > & getConstraints() const
Definition: API.h:124
bool empty() const
Definition: API.h:134
std::vector< RawComment::CommentLine > DocComment
DocComment is a vector of RawComment::CommentLine.
Definition: API.h:150
The JSON file list parser is used to communicate input to InstallAPI.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:24
Language
The language for the input, used to select and validate the language standard and possible actions.
Definition: LangStandard.h:23
@ Parameter
The parameter type of a method or function.
@ Result
The result type of a method or function.
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
Definition: DeclTemplate.h:65
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
#define true
Definition: stdbool.h:25
Storage of availability attributes for a declaration.
Definition: Availability.h:64
The base representation of an API record. Holds common symbol information.
Definition: API.h:184
RecordKind getKind() const
Definition: API.h:273
APIRecord(RecordKind Kind, StringRef USR, StringRef Name)
Definition: API.h:293
DocComment Comment
Documentation comment lines attached to this symbol declaration.
Definition: API.h:243
AvailabilityInfo Availability
Definition: API.h:239
DeclarationFragments Declaration
Declaration fragments of this symbol declaration.
Definition: API.h:246
RecordKind getKindForDisplay() const
Definition: API.h:274
RecordKind KindForDisplay
Definition: API.h:261
APIRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Location, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader, AccessControl Access=AccessControl())
Definition: API.h:281
LinkageInfo Linkage
Definition: API.h:240
virtual ~APIRecord()=0
Definition: API.cpp:166
DeclarationFragments SubHeading
SubHeading provides a more detailed representation than the plain declaration name.
Definition: API.h:254
APIRecord * getNextInContext() const
Definition: API.h:271
static APIRecord * castFromRecordContext(const RecordContext *Ctx)
Definition: API.cpp:26
AccessControl Access
Definition: API.h:259
PresumedLoc Location
Definition: API.h:238
static bool classofKind(RecordKind K)
Definition: API.h:299
RecordKind
Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
Definition: API.h:186
@ RK_GlobalFunctionTemplateSpecialization
Definition: API.h:215
@ RK_GlobalVariableTemplatePartialSpecialization
Definition: API.h:211
@ RK_GlobalVariableTemplateSpecialization
Definition: API.h:210
@ RK_ClassTemplatePartialSpecialization
Definition: API.h:202
static RecordContext * castToRecordContext(const APIRecord *Record)
Definition: API.cpp:39
SymbolReference Parent
Definition: API.h:236
static bool classof(const RecordContext *Ctx)
Definition: API.h:300
bool IsFromSystemHeader
Whether the symbol was defined in a system header.
Definition: API.h:257
static bool classof(const APIRecord *Record)
Definition: API.h:298
SmallVector< SymbolReference > Bases
Definition: API.h:1166
static bool classofKind(RecordKind K)
Definition: API.h:1181
static bool classof(const APIRecord *Record)
Definition: API.h:1178
CXXClassRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, RecordKind Kind, AccessControl Access, bool IsFromSystemHeader, bool IsEmbeddedInVarDeclarator=false)
Definition: API.h:1168
CXXConstructorRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:842
static bool classof(const APIRecord *Record)
Definition: API.h:853
static bool classofKind(RecordKind K)
Definition: API.h:856
CXXDestructorRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:863
static bool classofKind(RecordKind K)
Definition: API.h:877
static bool classof(const APIRecord *Record)
Definition: API.h:874
CXXFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:770
static bool classofKind(RecordKind K)
Definition: API.h:794
static bool classof(const APIRecord *Record)
Definition: API.h:791
CXXFieldRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:780
static bool classof(const APIRecord *Record)
Definition: API.h:816
static bool classofKind(RecordKind K)
Definition: API.h:819
CXXFieldTemplateRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AccessControl Access, Template Template, bool IsFromSystemHeader)
Definition: API.h:805
static bool classof(const APIRecord *Record)
Definition: API.h:917
static bool classofKind(RecordKind K)
Definition: API.h:920
CXXInstanceMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:905
CXXMethodRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:827
FunctionSignature Signature
Definition: API.h:823
static bool classofKind(RecordKind K)
Definition: API.h:945
static bool classof(const APIRecord *Record)
Definition: API.h:942
CXXMethodTemplateRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, Template Template, bool IsFromSystemHeader)
Definition: API.h:929
static bool classof(const APIRecord *Record)
Definition: API.h:960
CXXMethodTemplateSpecializationRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:949
static bool classof(const APIRecord *Record)
Definition: API.h:895
CXXStaticMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:884
static bool classofKind(RecordKind K)
Definition: API.h:898
ClassTemplatePartialSpecializationRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, Template Template, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:1231
static bool classof(const APIRecord *Record)
Definition: API.h:1242
static bool classof(const APIRecord *Record)
Definition: API.h:1205
ClassTemplateRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, Template Template, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:1194
static bool classofKind(RecordKind K)
Definition: API.h:1208
ClassTemplateSpecializationRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:1212
static bool classof(const APIRecord *Record)
Definition: API.h:1221
ConceptRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, Template Template, bool IsFromSystemHeader)
Definition: API.h:1253
static bool classof(const APIRecord *Record)
Definition: API.h:1263
static bool classofKind(RecordKind K)
Definition: API.h:1266
This holds information associated with enum constants.
Definition: API.h:582
EnumConstantRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:583
static bool classofKind(RecordKind K)
Definition: API.h:595
static bool classof(const APIRecord *Record)
Definition: API.h:592
This holds information associated with enums.
Definition: API.h:627
static bool classof(const APIRecord *Record)
Definition: API.h:638
EnumRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader, bool IsEmbeddedInVarDeclarator, AccessControl Access=AccessControl())
Definition: API.h:628
static bool classofKind(RecordKind K)
Definition: API.h:642
static RecordContext * doCast(RecordContext *Ctx)
Definition: API.h:1543
static ToTy * doCast(RecordContext *Ctx)
Definition: API.h:1530
static bool isPossible(RecordContext *Ctx)
Definition: API.h:1526
This holds information associated with global functions.
Definition: API.h:399
GlobalFunctionRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Definition: API.h:413
static bool classof(const APIRecord *Record)
Definition: API.h:425
static bool classofKind(RecordKind K)
Definition: API.h:428
GlobalFunctionRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Definition: API.h:402
GlobalFunctionTemplateRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, Template Template, bool IsFromSystemHeader)
Definition: API.h:437
static bool classofKind(RecordKind K)
Definition: API.h:454
static bool classof(const APIRecord *Record)
Definition: API.h:451
static bool classof(const APIRecord *Record)
Definition: API.h:471
GlobalFunctionTemplateSpecializationRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Definition: API.h:460
This holds information associated with global functions.
Definition: API.h:480
static bool classof(const APIRecord *Record)
Definition: API.h:502
GlobalVariableRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:491
static bool classofKind(RecordKind K)
Definition: API.h:505
GlobalVariableRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:481
GlobalVariableTemplatePartialSpecializationRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, class Template Template, bool IsFromSystemHeader)
Definition: API.h:561
static bool classof(const APIRecord *Record)
Definition: API.h:530
static bool classofKind(RecordKind K)
Definition: API.h:533
GlobalVariableTemplateRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, class Template Template, bool IsFromSystemHeader)
Definition: API.h:518
static bool classof(const APIRecord *Record)
Definition: API.h:549
GlobalVariableTemplateSpecializationRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:539
This holds information associated with macro definitions.
Definition: API.h:1348
static bool classof(const APIRecord *Record)
Definition: API.h:1357
MacroDefinitionRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:1349
static bool classofKind(RecordKind K)
Definition: API.h:1360
static bool classof(const APIRecord *Record)
Definition: API.h:392
NamespaceRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:382
static bool classofKind(RecordKind K)
Definition: API.h:395
This holds information associated with Objective-C categories.
Definition: API.h:1270
static bool classofKind(RecordKind K)
Definition: API.h:1288
ObjCCategoryRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference Interface, bool IsFromSystemHeader)
Definition: API.h:1273
std::optional< StringRef > getExtendedExternalModule() const
Definition: API.h:1292
bool isExtendingExternalModule() const
Definition: API.h:1290
static bool classof(const APIRecord *Record)
Definition: API.h:1285
static bool classofKind(RecordKind K)
Definition: API.h:1121
ObjCClassMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Definition: API.h:1108
static bool classof(const APIRecord *Record)
Definition: API.h:1118
static bool classof(const APIRecord *Record)
Definition: API.h:1036
static bool classofKind(RecordKind K)
Definition: API.h:1039
ObjCClassPropertyRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AttributeKind Attributes, StringRef GetterName, StringRef SetterName, bool IsOptional, bool IsFromSystemHeader)
Definition: API.h:1023
The base representation of an Objective-C container record.
Definition: API.h:1146
SmallVector< SymbolReference > Protocols
Definition: API.h:1147
ObjCContainerRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:1151
static bool classofKind(RecordKind K)
Definition: API.h:1101
ObjCInstanceMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Definition: API.h:1088
static bool classof(const APIRecord *Record)
Definition: API.h:1098
static bool classof(const APIRecord *Record)
Definition: API.h:1013
static bool classofKind(RecordKind K)
Definition: API.h:1016
ObjCInstancePropertyRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AttributeKind Attributes, StringRef GetterName, StringRef SetterName, bool IsOptional, bool IsFromSystemHeader)
Definition: API.h:1002
This holds information associated with Objective-C instance variables.
Definition: API.h:1046
static bool classofKind(RecordKind K)
Definition: API.h:1061
ObjCInstanceVariableRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:1047
static bool classof(const APIRecord *Record)
Definition: API.h:1058
This holds information associated with Objective-C interfaces/classes.
Definition: API.h:1303
static bool classof(const APIRecord *Record)
Definition: API.h:1317
static bool classofKind(RecordKind K)
Definition: API.h:1320
ObjCInterfaceRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference SuperClass, bool IsFromSystemHeader)
Definition: API.h:1306
This holds information associated with Objective-C methods.
Definition: API.h:1068
ObjCMethodRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Definition: API.h:1073
FunctionSignature Signature
Definition: API.h:1069
This holds information associated with Objective-C properties.
Definition: API.h:969
AttributeKind
The attributes associated with an Objective-C property.
Definition: API.h:971
ObjCPropertyRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AttributeKind Attributes, StringRef GetterName, StringRef SetterName, bool IsOptional, bool IsFromSystemHeader)
Definition: API.h:982
This holds information associated with Objective-C protocols.
Definition: API.h:1327
static bool classof(const APIRecord *Record)
Definition: API.h:1338
static bool classofKind(RecordKind K)
Definition: API.h:1341
ObjCProtocolRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:1328
std::forward_iterator_tag iterator_category
Definition: API.h:335
friend bool operator==(record_iterator x, record_iterator y)
Definition: API.h:354
friend bool operator!=(record_iterator x, record_iterator y)
Definition: API.h:357
This holds information associated with struct or union fields fields.
Definition: API.h:649
RecordFieldRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:650
static bool classofKind(RecordKind K)
Definition: API.h:663
static bool classof(const APIRecord *Record)
Definition: API.h:660
This holds information associated with structs and unions.
Definition: API.h:671
RecordRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader, bool IsEmbeddedInVarDeclarator, AccessControl Access=AccessControl())
Definition: API.h:672
static bool classof(const APIRecord *Record)
Definition: API.h:683
static bool classofKind(RecordKind K)
Definition: API.h:686
static bool classof(const APIRecord *Record)
Definition: API.h:1138
static bool classofKind(RecordKind K)
Definition: API.h:1141
StaticFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, AccessControl Access, bool IsFromSystemHeader)
Definition: API.h:1128
static bool classof(const APIRecord *Record)
Definition: API.h:704
static bool classofKind(RecordKind K)
Definition: API.h:707
StructFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:696
StructRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader, bool IsEmbeddedInVarDeclarator)
Definition: API.h:714
static bool classof(const APIRecord *Record)
Definition: API.h:723
static bool classofKind(RecordKind K)
Definition: API.h:726
bool empty() const
Determine if this SymbolReference is empty.
Definition: API.h:174
SymbolReference(StringRef Name, StringRef USR, StringRef Source="")
Definition: API.h:167
StringRef Source
The source project/module/product of the referred symbol.
Definition: API.h:161
static bool classof(const APIRecord *Record)
Definition: API.h:614
static bool classofKind(RecordKind K)
Definition: API.h:617
TagRecord(RecordKind Kind, StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader, bool IsEmbeddedInVarDeclarator, AccessControl Access=AccessControl())
Definition: API.h:602
virtual ~TagRecord()=0
Definition: API.cpp:167
static RecordContext * doCast(FromTy *From)
Definition: API.h:1502
static bool isPossible(FromTy *From)
Definition: API.h:1500
This holds information associated with typedefs.
Definition: API.h:1371
static bool classofKind(RecordKind K)
Definition: API.h:1387
SymbolReference UnderlyingType
Definition: API.h:1372
TypedefRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference UnderlyingType, bool IsFromSystemHeader)
Definition: API.h:1374
static bool classof(const APIRecord *Record)
Definition: API.h:1384
static bool classofKind(RecordKind K)
Definition: API.h:744
static bool classof(const APIRecord *Record)
Definition: API.h:741
UnionFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Definition: API.h:733
static bool classof(const APIRecord *Record)
Definition: API.h:760
UnionRecord(StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc, AvailabilityInfo Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader, bool IsEmbeddedInVarDeclarator)
Definition: API.h:751
static bool classofKind(RecordKind K)
Definition: API.h:763
static ToTy * doCast(::clang::extractapi::RecordContext *Ctx)
Definition: API.h:1589
static bool isPossible(::clang::extractapi::RecordContext *Ctx)
Definition: API.h:1584
static inline ::clang::extractapi::RecordContext * doCast(FromTy *From)
Definition: API.h:1566