@@ -50,13 +50,13 @@ namespace extractapi {
5050// / \endcode
5151using DocComment = std::vector<RawComment::CommentLine>;
5252
53- // Classes deriving from APIRecord need to have Name be the first constructor
53+ // Classes deriving from APIRecord need to have USR be the first constructor
5454// argument. This is so that they are compatible with `addTopLevelRecord`
5555// defined in API.cpp
5656// / The base representation of an API record. Holds common symbol information.
5757struct APIRecord {
58- StringRef Name;
5958 StringRef USR;
59+ StringRef Name;
6060 PresumedLoc Location;
6161 AvailabilityInfo Availability;
6262 LinkageInfo Linkage;
@@ -101,11 +101,11 @@ struct APIRecord {
101101
102102 APIRecord () = delete ;
103103
104- APIRecord (RecordKind Kind, StringRef Name , StringRef USR ,
104+ APIRecord (RecordKind Kind, StringRef USR , StringRef Name ,
105105 PresumedLoc Location, const AvailabilityInfo &Availability,
106106 LinkageInfo Linkage, const DocComment &Comment,
107107 DeclarationFragments Declaration, DeclarationFragments SubHeading)
108- : Name(Name ), USR(USR ), Location(Location), Availability(Availability),
108+ : USR(USR ), Name(Name ), Location(Location), Availability(Availability),
109109 Linkage (Linkage), Comment(Comment), Declaration(Declaration),
110110 SubHeading(SubHeading), Kind(Kind) {}
111111
@@ -117,13 +117,13 @@ struct APIRecord {
117117struct GlobalFunctionRecord : APIRecord {
118118 FunctionSignature Signature;
119119
120- GlobalFunctionRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
120+ GlobalFunctionRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
121121 const AvailabilityInfo &Availability,
122122 LinkageInfo Linkage, const DocComment &Comment,
123123 DeclarationFragments Declaration,
124124 DeclarationFragments SubHeading,
125125 FunctionSignature Signature)
126- : APIRecord(RK_GlobalFunction, Name, USR , Loc, Availability, Linkage,
126+ : APIRecord(RK_GlobalFunction, USR, Name , Loc, Availability, Linkage,
127127 Comment, Declaration, SubHeading),
128128 Signature (Signature) {}
129129
@@ -137,12 +137,12 @@ struct GlobalFunctionRecord : APIRecord {
137137
138138// / This holds information associated with global functions.
139139struct GlobalVariableRecord : APIRecord {
140- GlobalVariableRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
140+ GlobalVariableRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
141141 const AvailabilityInfo &Availability,
142142 LinkageInfo Linkage, const DocComment &Comment,
143143 DeclarationFragments Declaration,
144144 DeclarationFragments SubHeading)
145- : APIRecord(RK_GlobalVariable, Name, USR , Loc, Availability, Linkage,
145+ : APIRecord(RK_GlobalVariable, USR, Name , Loc, Availability, Linkage,
146146 Comment, Declaration, SubHeading) {}
147147
148148 static bool classof (const APIRecord *Record) {
@@ -155,12 +155,12 @@ struct GlobalVariableRecord : APIRecord {
155155
156156// / This holds information associated with enum constants.
157157struct EnumConstantRecord : APIRecord {
158- EnumConstantRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
158+ EnumConstantRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
159159 const AvailabilityInfo &Availability,
160160 const DocComment &Comment,
161161 DeclarationFragments Declaration,
162162 DeclarationFragments SubHeading)
163- : APIRecord(RK_EnumConstant, Name, USR , Loc, Availability,
163+ : APIRecord(RK_EnumConstant, USR, Name , Loc, Availability,
164164 LinkageInfo::none (), Comment, Declaration, SubHeading) {}
165165
166166 static bool classof (const APIRecord *Record) {
@@ -175,10 +175,10 @@ struct EnumConstantRecord : APIRecord {
175175struct EnumRecord : APIRecord {
176176 SmallVector<std::unique_ptr<EnumConstantRecord>> Constants;
177177
178- EnumRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
178+ EnumRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
179179 const AvailabilityInfo &Availability, const DocComment &Comment,
180180 DeclarationFragments Declaration, DeclarationFragments SubHeading)
181- : APIRecord(RK_Enum, Name, USR , Loc, Availability, LinkageInfo::none(),
181+ : APIRecord(RK_Enum, USR, Name , Loc, Availability, LinkageInfo::none(),
182182 Comment, Declaration, SubHeading) {}
183183
184184 static bool classof (const APIRecord *Record) {
@@ -191,11 +191,11 @@ struct EnumRecord : APIRecord {
191191
192192// / This holds information associated with struct fields.
193193struct StructFieldRecord : APIRecord {
194- StructFieldRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
194+ StructFieldRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
195195 const AvailabilityInfo &Availability,
196196 const DocComment &Comment, DeclarationFragments Declaration,
197197 DeclarationFragments SubHeading)
198- : APIRecord(RK_StructField, Name, USR , Loc, Availability,
198+ : APIRecord(RK_StructField, USR, Name , Loc, Availability,
199199 LinkageInfo::none (), Comment, Declaration, SubHeading) {}
200200
201201 static bool classof (const APIRecord *Record) {
@@ -210,11 +210,11 @@ struct StructFieldRecord : APIRecord {
210210struct StructRecord : APIRecord {
211211 SmallVector<std::unique_ptr<StructFieldRecord>> Fields;
212212
213- StructRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
213+ StructRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
214214 const AvailabilityInfo &Availability, const DocComment &Comment,
215215 DeclarationFragments Declaration,
216216 DeclarationFragments SubHeading)
217- : APIRecord(RK_Struct, Name, USR , Loc, Availability, LinkageInfo::none(),
217+ : APIRecord(RK_Struct, USR, Name , Loc, Availability, LinkageInfo::none(),
218218 Comment, Declaration, SubHeading) {}
219219
220220 static bool classof (const APIRecord *Record) {
@@ -240,14 +240,14 @@ struct ObjCPropertyRecord : APIRecord {
240240 StringRef SetterName;
241241 bool IsOptional;
242242
243- ObjCPropertyRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
243+ ObjCPropertyRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
244244 const AvailabilityInfo &Availability,
245245 const DocComment &Comment,
246246 DeclarationFragments Declaration,
247247 DeclarationFragments SubHeading, AttributeKind Attributes,
248248 StringRef GetterName, StringRef SetterName,
249249 bool IsOptional)
250- : APIRecord(RK_ObjCProperty, Name, USR , Loc, Availability,
250+ : APIRecord(RK_ObjCProperty, USR, Name , Loc, Availability,
251251 LinkageInfo::none (), Comment, Declaration, SubHeading),
252252 Attributes(Attributes), GetterName(GetterName), SetterName(SetterName),
253253 IsOptional(IsOptional) {}
@@ -269,13 +269,13 @@ struct ObjCInstanceVariableRecord : APIRecord {
269269 using AccessControl = ObjCIvarDecl::AccessControl;
270270 AccessControl Access;
271271
272- ObjCInstanceVariableRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
272+ ObjCInstanceVariableRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
273273 const AvailabilityInfo &Availability,
274274 const DocComment &Comment,
275275 DeclarationFragments Declaration,
276276 DeclarationFragments SubHeading,
277277 AccessControl Access)
278- : APIRecord(RK_ObjCIvar, Name, USR , Loc, Availability,
278+ : APIRecord(RK_ObjCIvar, USR, Name , Loc, Availability,
279279 LinkageInfo::none (), Comment, Declaration, SubHeading),
280280 Access(Access) {}
281281
@@ -292,12 +292,12 @@ struct ObjCMethodRecord : APIRecord {
292292 FunctionSignature Signature;
293293 bool IsInstanceMethod;
294294
295- ObjCMethodRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
295+ ObjCMethodRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
296296 const AvailabilityInfo &Availability,
297297 const DocComment &Comment, DeclarationFragments Declaration,
298298 DeclarationFragments SubHeading, FunctionSignature Signature,
299299 bool IsInstanceMethod)
300- : APIRecord(RK_ObjCMethod, Name, USR , Loc, Availability,
300+ : APIRecord(RK_ObjCMethod, USR, Name , Loc, Availability,
301301 LinkageInfo::none (), Comment, Declaration, SubHeading),
302302 Signature(Signature), IsInstanceMethod(IsInstanceMethod) {}
303303
@@ -340,12 +340,12 @@ struct ObjCContainerRecord : APIRecord {
340340
341341 ObjCContainerRecord () = delete ;
342342
343- ObjCContainerRecord (RecordKind Kind, StringRef Name , StringRef USR ,
343+ ObjCContainerRecord (RecordKind Kind, StringRef USR , StringRef Name ,
344344 PresumedLoc Loc, const AvailabilityInfo &Availability,
345345 LinkageInfo Linkage, const DocComment &Comment,
346346 DeclarationFragments Declaration,
347347 DeclarationFragments SubHeading)
348- : APIRecord(Kind, Name, USR , Loc, Availability, Linkage, Comment,
348+ : APIRecord(Kind, USR, Name , Loc, Availability, Linkage, Comment,
349349 Declaration, SubHeading) {}
350350
351351 virtual ~ObjCContainerRecord () = 0 ;
@@ -355,12 +355,12 @@ struct ObjCContainerRecord : APIRecord {
355355struct ObjCCategoryRecord : ObjCContainerRecord {
356356 SymbolReference Interface;
357357
358- ObjCCategoryRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
358+ ObjCCategoryRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
359359 const AvailabilityInfo &Availability,
360360 const DocComment &Comment,
361361 DeclarationFragments Declaration,
362362 DeclarationFragments SubHeading, SymbolReference Interface)
363- : ObjCContainerRecord(RK_ObjCCategory, Name, USR , Loc, Availability,
363+ : ObjCContainerRecord(RK_ObjCCategory, USR, Name , Loc, Availability,
364364 LinkageInfo::none (), Comment, Declaration,
365365 SubHeading),
366366 Interface(Interface) {}
@@ -379,13 +379,13 @@ struct ObjCInterfaceRecord : ObjCContainerRecord {
379379 // ObjCCategoryRecord%s are stored in and owned by APISet.
380380 SmallVector<ObjCCategoryRecord *> Categories;
381381
382- ObjCInterfaceRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
382+ ObjCInterfaceRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
383383 const AvailabilityInfo &Availability, LinkageInfo Linkage,
384384 const DocComment &Comment,
385385 DeclarationFragments Declaration,
386386 DeclarationFragments SubHeading,
387387 SymbolReference SuperClass)
388- : ObjCContainerRecord(RK_ObjCInterface, Name, USR , Loc, Availability,
388+ : ObjCContainerRecord(RK_ObjCInterface, USR, Name , Loc, Availability,
389389 Linkage, Comment, Declaration, SubHeading),
390390 SuperClass (SuperClass) {}
391391
@@ -399,12 +399,12 @@ struct ObjCInterfaceRecord : ObjCContainerRecord {
399399
400400// / This holds information associated with Objective-C protocols.
401401struct ObjCProtocolRecord : ObjCContainerRecord {
402- ObjCProtocolRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
402+ ObjCProtocolRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
403403 const AvailabilityInfo &Availability,
404404 const DocComment &Comment,
405405 DeclarationFragments Declaration,
406406 DeclarationFragments SubHeading)
407- : ObjCContainerRecord(RK_ObjCProtocol, Name, USR , Loc, Availability,
407+ : ObjCContainerRecord(RK_ObjCProtocol, USR, Name , Loc, Availability,
408408 LinkageInfo::none (), Comment, Declaration,
409409 SubHeading) {}
410410
@@ -418,10 +418,10 @@ struct ObjCProtocolRecord : ObjCContainerRecord {
418418
419419// / This holds information associated with macro definitions.
420420struct MacroDefinitionRecord : APIRecord {
421- MacroDefinitionRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
421+ MacroDefinitionRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
422422 DeclarationFragments Declaration,
423423 DeclarationFragments SubHeading)
424- : APIRecord(RK_MacroDefinition, Name, USR , Loc, AvailabilityInfo(),
424+ : APIRecord(RK_MacroDefinition, USR, Name , Loc, AvailabilityInfo(),
425425 LinkageInfo (), {}, Declaration, SubHeading) {}
426426
427427 static bool classof (const APIRecord *Record) {
@@ -440,11 +440,11 @@ struct MacroDefinitionRecord : APIRecord {
440440struct TypedefRecord : APIRecord {
441441 SymbolReference UnderlyingType;
442442
443- TypedefRecord (StringRef Name , StringRef USR , PresumedLoc Loc,
443+ TypedefRecord (StringRef USR , StringRef Name , PresumedLoc Loc,
444444 const AvailabilityInfo &Availability, const DocComment &Comment,
445445 DeclarationFragments Declaration,
446446 DeclarationFragments SubHeading, SymbolReference UnderlyingType)
447- : APIRecord(RK_Typedef, Name, USR , Loc, Availability, LinkageInfo(),
447+ : APIRecord(RK_Typedef, USR, Name , Loc, Availability, LinkageInfo(),
448448 Comment, Declaration, SubHeading),
449449 UnderlyingType (UnderlyingType) {}
450450
@@ -647,8 +647,7 @@ class APISet {
647647 DeclarationFragments SubHeading,
648648 SymbolReference UnderlyingType);
649649
650- // / A mapping type to store a set of APIRecord%s with the declaration name as
651- // / the key.
650+ // / A mapping type to store a set of APIRecord%s with the USR as the key.
652651 template <typename RecordTy,
653652 typename =
654653 std::enable_if_t <std::is_base_of<APIRecord, RecordTy>::value>>
0 commit comments