clang 17.0.0git
ExtractAPIVisitor.cpp
Go to the documentation of this file.
1//===- ExtractAPI/ExtractAPIVisitor.cpp -------------------------*- 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 implements the ExtractAPIVisitor an ASTVisitor to collect API
11/// information.
12///
13//===----------------------------------------------------------------------===//
14
16
20#include "clang/AST/Decl.h"
21#include "clang/AST/DeclCXX.h"
32#include "llvm/Support/raw_ostream.h"
33
34using namespace clang;
35using namespace extractapi;
36
37namespace {
38
39StringRef getTypedefName(const TagDecl *Decl) {
40 if (const auto *TypedefDecl = Decl->getTypedefNameForAnonDecl())
41 return TypedefDecl->getName();
42
43 return {};
44}
45
46template <class DeclTy>
47bool isInSystemHeader(const ASTContext &Context, const DeclTy *D) {
48 return Context.getSourceManager().isInSystemHeader(D->getLocation());
49}
50
51} // namespace
52
54 // skip function parameters.
55 if (isa<ParmVarDecl>(Decl))
56 return true;
57
58 // Skip non-global variables in records (struct/union/class).
60 return true;
61
62 // Skip local variables inside function or method.
64 return true;
65
66 // If this is a template but not specialization or instantiation, skip.
68 Decl->getTemplateSpecializationKind() == TSK_Undeclared)
69 return true;
70
71 if (!LocationChecker(Decl->getLocation()))
72 return true;
73
74 // Collect symbol information.
75 StringRef Name = Decl->getName();
76 StringRef USR = API.recordUSR(Decl);
77 PresumedLoc Loc =
79 LinkageInfo Linkage = Decl->getLinkageAndVisibility();
80 DocComment Comment;
81 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
83 Context.getDiagnostics());
84
85 // Build declaration fragments and sub-heading for the variable.
88 DeclarationFragments SubHeading =
90
91 // Add the global variable record to the API set.
92 API.addGlobalVar(Name, USR, Loc, AvailabilitySet(Decl), Linkage, Comment,
93 Declaration, SubHeading, isInSystemHeader(Context, Decl));
94 return true;
95}
96
98 if (const auto *Method = dyn_cast<CXXMethodDecl>(Decl)) {
99 // Skip member function in class templates.
100 if (Method->getParent()->getDescribedClassTemplate() != nullptr)
101 return true;
102
103 // Skip methods in records.
104 for (auto P : Context.getParents(*Method)) {
105 if (P.get<CXXRecordDecl>())
106 return true;
107 }
108
109 // Skip ConstructorDecl and DestructorDecl.
110 if (isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method))
111 return true;
112 }
113
114 // Skip templated functions.
115 switch (Decl->getTemplatedKind()) {
118 break;
121 if (auto *TemplateInfo = Decl->getTemplateSpecializationInfo()) {
122 if (!TemplateInfo->isExplicitInstantiationOrSpecialization())
123 return true;
124 }
125 break;
128 return true;
129 }
130
131 if (!LocationChecker(Decl->getLocation()))
132 return true;
133
134 // Collect symbol information.
135 StringRef Name = Decl->getName();
136 StringRef USR = API.recordUSR(Decl);
137 PresumedLoc Loc =
139 LinkageInfo Linkage = Decl->getLinkageAndVisibility();
140 DocComment Comment;
141 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
142 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
143 Context.getDiagnostics());
144
145 // Build declaration fragments, sub-heading, and signature of the function.
148 DeclarationFragments SubHeading =
150 FunctionSignature Signature =
152
153 // Add the function record to the API set.
154 API.addGlobalFunction(Name, USR, Loc, AvailabilitySet(Decl), Linkage, Comment,
155 Declaration, SubHeading, Signature,
156 isInSystemHeader(Context, Decl));
157 return true;
158}
159
161 if (!Decl->isComplete())
162 return true;
163
164 // Skip forward declaration.
165 if (!Decl->isThisDeclarationADefinition())
166 return true;
167
168 if (!LocationChecker(Decl->getLocation()))
169 return true;
170
171 SmallString<128> QualifiedNameBuffer;
172 // Collect symbol information.
173 StringRef Name = Decl->getName();
174 if (Name.empty())
175 Name = getTypedefName(Decl);
176 if (Name.empty()) {
177 llvm::raw_svector_ostream OS(QualifiedNameBuffer);
178 Decl->printQualifiedName(OS);
179 Name = QualifiedNameBuffer.str();
180 }
181
182 StringRef USR = API.recordUSR(Decl);
183 PresumedLoc Loc =
185 DocComment Comment;
186 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
187 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
188 Context.getDiagnostics());
189
190 // Build declaration fragments and sub-heading for the enum.
193 DeclarationFragments SubHeading =
195
197 API.copyString(Name), USR, Loc, AvailabilitySet(Decl), Comment,
198 Declaration, SubHeading, isInSystemHeader(Context, Decl));
199
200 // Now collect information about the enumerators in this enum.
201 recordEnumConstants(EnumRecord, Decl->enumerators());
202
203 return true;
204}
205
207 if (!Decl->isCompleteDefinition())
208 return true;
209
210 // Skip C++ structs/classes/unions
211 // TODO: support C++ records
212 if (isa<CXXRecordDecl>(Decl))
213 return true;
214
215 if (!LocationChecker(Decl->getLocation()))
216 return true;
217
218 // Collect symbol information.
219 StringRef Name = Decl->getName();
220 if (Name.empty())
221 Name = getTypedefName(Decl);
222 if (Name.empty())
223 return true;
224
225 StringRef USR = API.recordUSR(Decl);
226 PresumedLoc Loc =
228 DocComment Comment;
229 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
230 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
231 Context.getDiagnostics());
232
233 // Build declaration fragments and sub-heading for the struct.
236 DeclarationFragments SubHeading =
238
240 API.addStruct(Name, USR, Loc, AvailabilitySet(Decl), Comment, Declaration,
241 SubHeading, isInSystemHeader(Context, Decl));
242
243 // Now collect information about the fields in this struct.
244 recordStructFields(StructRecord, Decl->fields());
245
246 return true;
247}
248
250 // Skip forward declaration for classes (@class)
251 if (!Decl->isThisDeclarationADefinition())
252 return true;
253
254 if (!LocationChecker(Decl->getLocation()))
255 return true;
256
257 // Collect symbol information.
258 StringRef Name = Decl->getName();
259 StringRef USR = API.recordUSR(Decl);
260 PresumedLoc Loc =
262 LinkageInfo Linkage = Decl->getLinkageAndVisibility();
263 DocComment Comment;
264 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
265 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
266 Context.getDiagnostics());
267
268 // Build declaration fragments and sub-heading for the interface.
271 DeclarationFragments SubHeading =
273
274 // Collect super class information.
275 SymbolReference SuperClass;
276 if (const auto *SuperClassDecl = Decl->getSuperClass()) {
277 SuperClass.Name = SuperClassDecl->getObjCRuntimeNameAsString();
278 SuperClass.USR = API.recordUSR(SuperClassDecl);
279 }
280
282 Name, USR, Loc, AvailabilitySet(Decl), Linkage, Comment, Declaration,
283 SubHeading, SuperClass, isInSystemHeader(Context, Decl));
284
285 // Record all methods (selectors). This doesn't include automatically
286 // synthesized property methods.
287 recordObjCMethods(ObjCInterfaceRecord, Decl->methods());
288 recordObjCProperties(ObjCInterfaceRecord, Decl->properties());
289 recordObjCInstanceVariables(ObjCInterfaceRecord, Decl->ivars());
290 recordObjCProtocols(ObjCInterfaceRecord, Decl->protocols());
291
292 return true;
293}
294
296 // Skip forward declaration for protocols (@protocol).
297 if (!Decl->isThisDeclarationADefinition())
298 return true;
299
300 if (!LocationChecker(Decl->getLocation()))
301 return true;
302
303 // Collect symbol information.
304 StringRef Name = Decl->getName();
305 StringRef USR = API.recordUSR(Decl);
306 PresumedLoc Loc =
308 DocComment Comment;
309 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
310 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
311 Context.getDiagnostics());
312
313 // Build declaration fragments and sub-heading for the protocol.
316 DeclarationFragments SubHeading =
318
320 Name, USR, Loc, AvailabilitySet(Decl), Comment, Declaration, SubHeading,
321 isInSystemHeader(Context, Decl));
322
323 recordObjCMethods(ObjCProtocolRecord, Decl->methods());
324 recordObjCProperties(ObjCProtocolRecord, Decl->properties());
325 recordObjCProtocols(ObjCProtocolRecord, Decl->protocols());
326
327 return true;
328}
329
331 // Skip ObjC Type Parameter for now.
332 if (isa<ObjCTypeParamDecl>(Decl))
333 return true;
334
336 return true;
337
338 if (!LocationChecker(Decl->getLocation()))
339 return true;
340
341 PresumedLoc Loc =
343 StringRef Name = Decl->getName();
344 StringRef USR = API.recordUSR(Decl);
345 DocComment Comment;
346 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
347 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
348 Context.getDiagnostics());
349
350 QualType Type = Decl->getUnderlyingType();
351 SymbolReference SymRef =
353 API);
354
355 API.addTypedef(Name, USR, Loc, AvailabilitySet(Decl), Comment,
358 isInSystemHeader(Context, Decl));
359
360 return true;
361}
362
364 // Collect symbol information.
365 StringRef Name = Decl->getName();
366 StringRef USR = API.recordUSR(Decl);
367 PresumedLoc Loc =
369 DocComment Comment;
370 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Decl))
371 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
372 Context.getDiagnostics());
373 // Build declaration fragments and sub-heading for the category.
376 DeclarationFragments SubHeading =
378
379 const ObjCInterfaceDecl *InterfaceDecl = Decl->getClassInterface();
380 SymbolReference Interface(InterfaceDecl->getName(),
381 API.recordUSR(InterfaceDecl));
382
384 Name, USR, Loc, AvailabilitySet(Decl), Comment, Declaration, SubHeading,
385 Interface, isInSystemHeader(Context, Decl));
386
387 recordObjCMethods(ObjCCategoryRecord, Decl->methods());
388 recordObjCProperties(ObjCCategoryRecord, Decl->properties());
389 recordObjCInstanceVariables(ObjCCategoryRecord, Decl->ivars());
390 recordObjCProtocols(ObjCCategoryRecord, Decl->protocols());
391
392 return true;
393}
394
395/// Collect API information for the enum constants and associate with the
396/// parent enum.
397void ExtractAPIVisitor::recordEnumConstants(
399 for (const auto *Constant : Constants) {
400 // Collect symbol information.
401 StringRef Name = Constant->getName();
402 StringRef USR = API.recordUSR(Constant);
403 PresumedLoc Loc =
404 Context.getSourceManager().getPresumedLoc(Constant->getLocation());
405 DocComment Comment;
406 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Constant))
407 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
408 Context.getDiagnostics());
409
410 // Build declaration fragments and sub-heading for the enum constant.
413 DeclarationFragments SubHeading =
415
416 API.addEnumConstant(EnumRecord, Name, USR, Loc, AvailabilitySet(Constant),
417 Comment, Declaration, SubHeading,
418 isInSystemHeader(Context, Constant));
419 }
420}
421
422/// Collect API information for the struct fields and associate with the
423/// parent struct.
424void ExtractAPIVisitor::recordStructFields(
426 for (const auto *Field : Fields) {
427 // Collect symbol information.
428 StringRef Name = Field->getName();
429 StringRef USR = API.recordUSR(Field);
430 PresumedLoc Loc =
431 Context.getSourceManager().getPresumedLoc(Field->getLocation());
432 DocComment Comment;
433 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Field))
434 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
435 Context.getDiagnostics());
436
437 // Build declaration fragments and sub-heading for the struct field.
440 DeclarationFragments SubHeading =
442
443 API.addStructField(StructRecord, Name, USR, Loc, AvailabilitySet(Field),
444 Comment, Declaration, SubHeading,
445 isInSystemHeader(Context, Field));
446 }
447}
448
449/// Collect API information for the Objective-C methods and associate with the
450/// parent container.
451void ExtractAPIVisitor::recordObjCMethods(
452 ObjCContainerRecord *Container,
453 const ObjCContainerDecl::method_range Methods) {
454 for (const auto *Method : Methods) {
455 // Don't record selectors for properties.
456 if (Method->isPropertyAccessor())
457 continue;
458
459 StringRef Name = API.copyString(Method->getSelector().getAsString());
460 StringRef USR = API.recordUSR(Method);
461 PresumedLoc Loc =
462 Context.getSourceManager().getPresumedLoc(Method->getLocation());
463 DocComment Comment;
464 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Method))
465 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
466 Context.getDiagnostics());
467
468 // Build declaration fragments, sub-heading, and signature for the method.
471 DeclarationFragments SubHeading =
473 FunctionSignature Signature =
475
476 API.addObjCMethod(Container, Name, USR, Loc, AvailabilitySet(Method),
477 Comment, Declaration, SubHeading, Signature,
478 Method->isInstanceMethod(),
479 isInSystemHeader(Context, Method));
480 }
481}
482
483void ExtractAPIVisitor::recordObjCProperties(
484 ObjCContainerRecord *Container,
485 const ObjCContainerDecl::prop_range Properties) {
486 for (const auto *Property : Properties) {
487 StringRef Name = Property->getName();
488 StringRef USR = API.recordUSR(Property);
489 PresumedLoc Loc =
490 Context.getSourceManager().getPresumedLoc(Property->getLocation());
491 DocComment Comment;
493 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
494 Context.getDiagnostics());
495
496 // Build declaration fragments and sub-heading for the property.
499 DeclarationFragments SubHeading =
501
502 StringRef GetterName =
503 API.copyString(Property->getGetterName().getAsString());
504 StringRef SetterName =
505 API.copyString(Property->getSetterName().getAsString());
506
507 // Get the attributes for property.
508 unsigned Attributes = ObjCPropertyRecord::NoAttr;
509 if (Property->getPropertyAttributes() &
511 Attributes |= ObjCPropertyRecord::ReadOnly;
512
513 API.addObjCProperty(
514 Container, Name, USR, Loc, AvailabilitySet(Property), Comment,
515 Declaration, SubHeading,
516 static_cast<ObjCPropertyRecord::AttributeKind>(Attributes), GetterName,
517 SetterName, Property->isOptional(),
518 !(Property->getPropertyAttributes() &
520 isInSystemHeader(Context, Property));
521 }
522}
523
524void ExtractAPIVisitor::recordObjCInstanceVariables(
525 ObjCContainerRecord *Container,
526 const llvm::iterator_range<
528 Ivars) {
529 for (const auto *Ivar : Ivars) {
530 StringRef Name = Ivar->getName();
531 StringRef USR = API.recordUSR(Ivar);
532 PresumedLoc Loc =
533 Context.getSourceManager().getPresumedLoc(Ivar->getLocation());
534 DocComment Comment;
535 if (auto *RawComment = Context.getRawCommentForDeclNoCache(Ivar))
536 Comment = RawComment->getFormattedLines(Context.getSourceManager(),
537 Context.getDiagnostics());
538
539 // Build declaration fragments and sub-heading for the instance variable.
542 DeclarationFragments SubHeading =
544
546 Ivar->getCanonicalAccessControl();
547
549 Container, Name, USR, Loc, AvailabilitySet(Ivar), Comment, Declaration,
550 SubHeading, Access, isInSystemHeader(Context, Ivar));
551 }
552}
553
554void ExtractAPIVisitor::recordObjCProtocols(
555 ObjCContainerRecord *Container,
557 for (const auto *Protocol : Protocols)
558 Container->Protocols.emplace_back(Protocol->getName(),
559 API.recordUSR(Protocol));
560}
This file defines the APIRecord-based structs and the APISet class.
Defines the clang::ASTContext interface.
StringRef P
This file defines the AvailabilityInfo struct that collects availability attributes of a symbol.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines the Declaration Fragments related classes.
This file defines the ExtractAPVisitor AST visitation interface.
llvm::raw_ostream & OS
Definition: Logger.cpp:24
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
This file defines the UnderlyingTypeResolver which is a helper type for resolving the undelrying type...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
SourceManager & getSourceManager()
Definition: ASTContext.h:692
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
DynTypedNodeList getParents(const NodeT &Node)
Forwards to get node parents from the ParentMapContext.
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
Definition: ASTContext.cpp:358
DiagnosticsEngine & getDiagnostics() const
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
Definition: DeclBase.h:2208
bool isRecord() const
Definition: DeclBase.h:2012
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:428
SourceLocation getLocation() const
Definition: DeclBase.h:432
bool isDefinedOutsideFunctionOrMethod() const
isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...
Definition: DeclBase.h:914
DeclContext * getDeclContext()
Definition: DeclBase.h:441
Represents an enum.
Definition: Decl.h:3720
llvm::iterator_range< specific_decl_iterator< EnumConstantDecl > > enumerator_range
Definition: Decl.h:3851
Represents a function declaration or definition.
Definition: Decl.h:1917
@ TK_MemberSpecialization
Definition: Decl.h:1929
@ TK_DependentNonTemplate
Definition: Decl.h:1938
@ TK_FunctionTemplateSpecialization
Definition: Decl.h:1933
@ TK_DependentFunctionTemplateSpecialization
Definition: Decl.h:1936
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:274
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2312
llvm::iterator_range< specific_decl_iterator< ObjCMethodDecl > > method_range
Definition: DeclObjC.h:1007
llvm::iterator_range< specific_decl_iterator< ObjCPropertyDecl > > prop_range
Definition: DeclObjC.h:958
Represents an ObjC class declaration.
Definition: DeclObjC.h:1147
llvm::iterator_range< protocol_iterator > protocol_range
Definition: DeclObjC.h:1345
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2069
Represents an unpacked "presumed" location which can be presented to the user.
A (possibly-)qualified type.
Definition: Type.h:736
std::vector< CommentLine > getFormattedLines(const SourceManager &SourceMgr, DiagnosticsEngine &Diags) const
Returns sanitized comment text as separated lines with locations in source, suitable for further proc...
Represents a struct/union/class.
Definition: Decl.h:3998
llvm::iterator_range< specific_decl_iterator< FieldDecl > > field_range
Definition: Decl.h:4223
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3440
The base class of the type hierarchy.
Definition: Type.h:1566
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3392
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3290
Represents a variable declaration or definition.
Definition: Decl.h:913
ObjCMethodRecord * addObjCMethod(ObjCContainerRecord *Container, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsInstanceMethod, bool IsFromSystemHeader)
Create and add an Objective-C method record into the API set.
Definition: API.cpp:156
ObjCPropertyRecord * addObjCProperty(ObjCContainerRecord *Container, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, ObjCPropertyRecord::AttributeKind Attributes, StringRef GetterName, StringRef SetterName, bool IsOptional, bool IsInstanceProperty, bool IsFromSystemHeader)
Create and add an Objective-C property record into the API set.
Definition: API.cpp:178
StringRef copyString(StringRef String)
Copy String into the Allocator in this APISet.
Definition: API.cpp:271
TypedefRecord * addTypedef(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference UnderlyingType, bool IsFromSystemHeader)
Create a typedef record into the API set.
Definition: API.cpp:238
GlobalVariableRecord * addGlobalVar(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeadin, bool IsFromSystemHeaderg)
Create and add a global variable record into the API set.
Definition: API.cpp:48
StructFieldRecord * addStructField(StructRecord *Struct, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Create and add a struct field record into the API set.
Definition: API.cpp:96
ObjCProtocolRecord * addObjCProtocol(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Create and add an Objective-C protocol record into the API set.
Definition: API.cpp:216
ObjCInstanceVariableRecord * addObjCInstanceVariable(ObjCContainerRecord *Container, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, ObjCInstanceVariableRecord::AccessControl Access, bool IsFromSystemHeader)
Create and add an Objective-C instance variable record into the API set.
Definition: API.cpp:202
ObjCCategoryRecord * addObjCCategory(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference Interface, bool IsFromSystemHeader)
Create and add an Objective-C category record into the API set.
Definition: API.cpp:123
ObjCInterfaceRecord * addObjCInterface(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, SymbolReference SuperClass, bool IsFromSystemHeader)
Create and add an Objective-C interface record into the API set.
Definition: API.cpp:144
GlobalFunctionRecord * addGlobalFunction(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, LinkageInfo Linkage, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, FunctionSignature Signature, bool IsFromSystemHeader)
Create and add a function record into the API set.
Definition: API.cpp:57
EnumConstantRecord * addEnumConstant(EnumRecord *Enum, StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Create and add an enum constant record into the API set.
Definition: API.cpp:69
StringRef recordUSR(const Decl *D)
Generate and store the USR of declaration D.
Definition: API.cpp:258
StructRecord * addStruct(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Create and add a struct record into the API set.
Definition: API.cpp:112
EnumRecord * addEnum(StringRef Name, StringRef USR, PresumedLoc Loc, AvailabilitySet Availability, const DocComment &Comment, DeclarationFragments Declaration, DeclarationFragments SubHeading, bool IsFromSystemHeader)
Create and add an enum record into the API set.
Definition: API.cpp:85
static DeclarationFragments getFragmentsForEnumConstant(const EnumConstantDecl *)
Build DeclarationFragments for an enum constant declaration EnumConstantDecl.
static DeclarationFragments getFragmentsForObjCCategory(const ObjCCategoryDecl *)
Build DeclarationFragments for an Objective-C category declaration ObjCCategoryDecl.
static DeclarationFragments getFragmentsForTypedef(const TypedefNameDecl *Decl)
Build DeclarationFragments for a typedef TypedefNameDecl.
static DeclarationFragments getFragmentsForEnum(const EnumDecl *)
Build DeclarationFragments for an enum declaration EnumDecl.
static DeclarationFragments getFragmentsForObjCProtocol(const ObjCProtocolDecl *)
Build DeclarationFragments for an Objective-C protocol declaration ObjCProtocolDecl.
static DeclarationFragments getFragmentsForField(const FieldDecl *)
Build DeclarationFragments for a field declaration FieldDecl.
static DeclarationFragments getFragmentsForVar(const VarDecl *)
Build DeclarationFragments for a variable declaration VarDecl.
static DeclarationFragments getFragmentsForObjCMethod(const ObjCMethodDecl *)
Build DeclarationFragments for an Objective-C method declaration ObjCMethodDecl.
static DeclarationFragments getFragmentsForFunction(const FunctionDecl *)
Build DeclarationFragments for a function declaration FunctionDecl.
static DeclarationFragments getFragmentsForObjCProperty(const ObjCPropertyDecl *)
Build DeclarationFragments for an Objective-C property declaration ObjCPropertyDecl.
static DeclarationFragments getFragmentsForStruct(const RecordDecl *)
Build DeclarationFragments for a struct record declaration RecordDecl.
static DeclarationFragments getSubHeading(const NamedDecl *)
Build sub-heading fragments for a NamedDecl.
static FunctionSignature getFunctionSignature(const FunctionT *)
Build FunctionSignature for a function-like declaration FunctionT like FunctionDecl or ObjCMethodDecl...
static DeclarationFragments getFragmentsForObjCInterface(const ObjCInterfaceDecl *)
Build DeclarationFragments for an Objective-C interface declaration ObjCInterfaceDecl.
DeclarationFragments is a vector of tagged important parts of a symbol's declaration.
bool VisitFunctionDecl(const FunctionDecl *Decl)
bool VisitObjCCategoryDecl(const ObjCCategoryDecl *Decl)
bool VisitEnumDecl(const EnumDecl *Decl)
bool VisitObjCProtocolDecl(const ObjCProtocolDecl *Decl)
bool VisitVarDecl(const VarDecl *Decl)
bool VisitRecordDecl(const RecordDecl *Decl)
bool VisitTypedefNameDecl(const TypedefNameDecl *Decl)
bool VisitObjCInterfaceDecl(const ObjCInterfaceDecl *Decl)
Store function signature information with DeclarationFragments of the return type and parameters.
Defines the clang::TargetInfo interface.
std::vector< RawComment::CommentLine > DocComment
DocComment is a vector of RawComment::CommentLine.
Definition: API.h:51
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:23
@ Property
The type of a property.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
Definition: Specifiers.h:179
This holds information associated with enums.
Definition: API.h:212
This holds information associated with Objective-C categories.
Definition: API.h:469
The base representation of an Objective-C container record.
Definition: API.h:449
This holds information associated with Objective-C interfaces/classes.
Definition: API.h:492
AttributeKind
The attributes associated with an Objective-C property.
Definition: API.h:272
This holds information associated with Objective-C protocols.
Definition: API.h:517
This holds information associated with structs.
Definition: API.h:250
This represents a reference to another symbol that might come from external sources.
Definition: API.h:428
SymbolReference getSymbolReferenceForType(QualType Type, APISet &API) const
Get a SymbolReference for the given type.