32#include "llvm/Support/raw_ostream.h"
35using namespace extractapi;
46template <
class DeclTy>
47bool isInSystemHeader(
const ASTContext &Context,
const DeclTy *D) {
55 if (isa<ParmVarDecl>(
Decl))
75 StringRef Name =
Decl->getName();
98 if (
const auto *Method = dyn_cast<CXXMethodDecl>(
Decl)) {
100 if (Method->getParent()->getDescribedClassTemplate() !=
nullptr)
110 if (isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method))
115 switch (
Decl->getTemplatedKind()) {
121 if (
auto *TemplateInfo =
Decl->getTemplateSpecializationInfo()) {
122 if (!TemplateInfo->isExplicitInstantiationOrSpecialization())
135 StringRef Name =
Decl->getName();
156 isInSystemHeader(Context,
Decl));
161 if (!
Decl->isComplete())
165 if (!
Decl->isThisDeclarationADefinition())
173 StringRef Name =
Decl->getName();
175 Name = getTypedefName(
Decl);
177 llvm::raw_svector_ostream
OS(QualifiedNameBuffer);
178 Decl->printQualifiedName(
OS);
179 Name = QualifiedNameBuffer.str();
207 if (!
Decl->isCompleteDefinition())
212 if (isa<CXXRecordDecl>(
Decl))
219 StringRef Name =
Decl->getName();
221 Name = getTypedefName(
Decl);
241 SubHeading, isInSystemHeader(Context,
Decl));
251 if (!
Decl->isThisDeclarationADefinition())
258 StringRef Name =
Decl->getName();
276 if (
const auto *SuperClassDecl =
Decl->getSuperClass()) {
277 SuperClass.
Name = SuperClassDecl->getObjCRuntimeNameAsString();
283 SubHeading, SuperClass, isInSystemHeader(Context,
Decl));
297 if (!
Decl->isThisDeclarationADefinition())
304 StringRef Name =
Decl->getName();
321 isInSystemHeader(Context,
Decl));
332 if (isa<ObjCTypeParamDecl>(
Decl))
343 StringRef Name =
Decl->getName();
358 isInSystemHeader(Context,
Decl));
365 StringRef Name =
Decl->getName();
385 Interface, isInSystemHeader(Context,
Decl));
397void ExtractAPIVisitor::recordEnumConstants(
399 for (
const auto *Constant : Constants) {
401 StringRef Name = Constant->getName();
418 isInSystemHeader(Context, Constant));
424void ExtractAPIVisitor::recordStructFields(
426 for (
const auto *Field : Fields) {
428 StringRef Name = Field->getName();
445 isInSystemHeader(Context, Field));
451void ExtractAPIVisitor::recordObjCMethods(
454 for (
const auto *Method : Methods) {
456 if (Method->isPropertyAccessor())
459 StringRef Name = API.
copyString(Method->getSelector().getAsString());
478 Method->isInstanceMethod(),
479 isInSystemHeader(Context, Method));
483void ExtractAPIVisitor::recordObjCProperties(
486 for (
const auto *
Property : Properties) {
487 StringRef Name =
Property->getName();
502 StringRef GetterName =
504 StringRef SetterName =
509 if (
Property->getPropertyAttributes() &
518 !(
Property->getPropertyAttributes() &
520 isInSystemHeader(Context,
Property));
524void ExtractAPIVisitor::recordObjCInstanceVariables(
526 const llvm::iterator_range<
529 for (
const auto *Ivar : Ivars) {
530 StringRef Name = Ivar->getName();
546 Ivar->getCanonicalAccessControl();
550 SubHeading, Access, isInSystemHeader(Context, Ivar));
554void ExtractAPIVisitor::recordObjCProtocols(
557 for (
const auto *Protocol : Protocols)
558 Container->Protocols.emplace_back(
Protocol->getName(),
This file defines the APIRecord-based structs and the APISet class.
Defines the clang::ASTContext interface.
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.
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 ...
SourceManager & getSourceManager()
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.
DiagnosticsEngine & getDiagnostics() const
Represents a C++ struct/union/class.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
SourceLocation getLocation() const
bool isDefinedOutsideFunctionOrMethod() const
isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...
DeclContext * getDeclContext()
llvm::iterator_range< specific_decl_iterator< EnumConstantDecl > > enumerator_range
Represents a function declaration or definition.
@ TK_MemberSpecialization
@ TK_DependentNonTemplate
@ TK_FunctionTemplateSpecialization
@ TK_DependentFunctionTemplateSpecialization
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
ObjCCategoryDecl - Represents a category declaration.
llvm::iterator_range< specific_decl_iterator< ObjCMethodDecl > > method_range
llvm::iterator_range< specific_decl_iterator< ObjCPropertyDecl > > prop_range
Represents an ObjC class declaration.
llvm::iterator_range< protocol_iterator > protocol_range
Represents an Objective-C protocol declaration.
Represents an unpacked "presumed" location which can be presented to the user.
A (possibly-)qualified type.
Represents a struct/union/class.
llvm::iterator_range< specific_decl_iterator< FieldDecl > > field_range
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.
The base class of the type hierarchy.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Base class for declarations which introduce a typedef-name.
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ Property
The type of a property.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...