17 using namespace clang;
25 if (SuperD->getName() ==
"XCTestCase")
45 if (D->
hasAttr<IBOutletAttr>()) {
47 }
else if (D->
hasAttr<IBOutletCollectionAttr>()) {
56 if (isa<ParmVarDecl>(D))
59 if (isa<ObjCTypeParamDecl>(D))
62 if (isa<UsingDirectiveDecl>(D))
67 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
68 switch (ND->getFormalLinkage()) {
70 llvm_unreachable(
"Linkage hasn't been computed!");
76 llvm_unreachable(
"Not a sema linkage");
101 if (
auto *VT = dyn_cast<VarTemplateDecl>(D)) {
105 D = VT->getTemplatedDecl();
108 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
109 switch (TD->getTagKind()) {
126 if (
const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D)) {
127 if (!CXXRec->isCLike()) {
129 if (CXXRec->getDescribedClassTemplate()) {
135 if (isa<ClassTemplatePartialSpecializationDecl>(D)) {
139 }
else if (isa<ClassTemplateSpecializationDecl>(D)) {
145 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
147 if (isa<ParmVarDecl>(D)) {
154 if (isa<VarTemplatePartialSpecializationDecl>(D)) {
159 }
else if (isa<VarTemplateSpecializationDecl>(D)) {
164 }
else if (VD->getDescribedVarTemplate()) {
180 case Decl::IndirectField:
184 if (!CXXRec->isCLike())
188 case Decl::EnumConstant:
190 case Decl::ObjCInterface:
191 case Decl::ObjCImplementation: {
196 ClsD = cast<ObjCImplementationDecl>(D)->getClassInterface();
201 case Decl::ObjCProtocol:
205 case Decl::ObjCCategory:
206 case Decl::ObjCCategoryImpl: {
210 if (
auto *CatD = dyn_cast<ObjCCategoryDecl>(D))
211 ClsD = CatD->getClassInterface();
213 ClsD = cast<ObjCCategoryImplDecl>(D)->getClassInterface();
218 case Decl::ObjCMethod: {
230 if (D->
hasAttr<IBActionAttr>())
234 case Decl::ObjCProperty:
238 if (
auto *Annot = D->
getAttr<AnnotateAttr>()) {
239 if (Annot->getAnnotation() ==
"gk_inspectable")
248 case Decl::Namespace:
252 case Decl::NamespaceAlias:
256 case Decl::CXXConstructor: {
259 auto *CD = cast<CXXConstructorDecl>(D);
260 if (CD->isCopyConstructor())
262 else if (CD->isMoveConstructor())
266 case Decl::CXXDestructor:
270 case Decl::CXXConversion:
274 case Decl::CXXMethod: {
283 case Decl::ClassTemplate:
288 case Decl::FunctionTemplate:
292 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(
293 cast<FunctionTemplateDecl>(D)->getTemplatedDecl())) {
294 if (isa<CXXConstructorDecl>(MD))
296 else if (isa<CXXDestructorDecl>(MD))
298 else if (isa<CXXConversionDecl>(MD))
308 case Decl::TypeAliasTemplate:
313 case Decl::TypeAlias:
317 case Decl::UnresolvedUsingTypename:
323 case Decl::UnresolvedUsingValue:
333 case Decl::UsingEnum:
342 case Decl::MSProperty:
346 if (!CXXRec->isCLike())
350 case Decl::ClassTemplatePartialSpecialization:
351 case Decl::ClassTemplateSpecialization:
352 case Decl::CXXRecord:
355 llvm_unreachable(
"records handled before");
357 case Decl::VarTemplateSpecialization:
358 case Decl::VarTemplatePartialSpecialization:
359 case Decl::ImplicitParam:
362 case Decl::VarTemplate:
363 llvm_unreachable(
"variables handled before");
365 case Decl::TemplateTypeParm:
368 case Decl::TemplateTemplateParm:
371 case Decl::NonTypeTemplateParm:
386 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
387 if (FD->getTemplatedKind() ==
398 if (
auto *
attr = D->getExternalSourceSymbolAttr()) {
399 if (
attr->getLanguage() ==
"Swift")
408 Info.
Kind = SymbolKind::Macro;
417 #define APPLY_FOR_ROLE(Role) \
418 if (Roles & (unsigned)SymbolRole::Role) \
419 if (!Fn(SymbolRole::Role)) \
444 #undef APPLY_FOR_ROLE
458 bool VisitedOnce =
false;
465 case SymbolRole::Declaration: OS <<
"Decl";
break;
466 case SymbolRole::Definition: OS <<
"Def";
break;
467 case SymbolRole::Reference: OS <<
"Ref";
break;
468 case SymbolRole::Read: OS <<
"Read";
break;
471 case SymbolRole::Dynamic: OS <<
"Dyn";
break;
472 case SymbolRole::AddressOf: OS <<
"Addr";
break;
473 case SymbolRole::Implicit: OS <<
"Impl";
break;
474 case SymbolRole::Undefinition: OS <<
"Undef";
break;
475 case SymbolRole::RelationChildOf: OS <<
"RelChild";
break;
476 case SymbolRole::RelationBaseOf: OS <<
"RelBase";
break;
477 case SymbolRole::RelationOverrideOf: OS <<
"RelOver";
break;
478 case SymbolRole::RelationReceivedBy: OS <<
"RelRec";
break;
479 case SymbolRole::RelationCalledBy: OS <<
"RelCall";
break;
480 case SymbolRole::RelationExtendedBy: OS <<
"RelExt";
break;
481 case SymbolRole::RelationAccessorOf: OS <<
"RelAcc";
break;
482 case SymbolRole::RelationContainedBy: OS <<
"RelCont";
break;
483 case SymbolRole::RelationIBTypeOf: OS <<
"RelIBType";
break;
484 case SymbolRole::RelationSpecializationOf: OS <<
"RelSpecialization";
break;
485 case SymbolRole::NameReference: OS <<
"NameReference";
break;
492 if (
auto *ND = dyn_cast<NamedDecl>(D)) {
501 DeclName.
print(OS, Policy);
511 case SymbolKind::Module:
return "module";
512 case SymbolKind::Namespace:
return "namespace";
513 case SymbolKind::NamespaceAlias:
return "namespace-alias";
514 case SymbolKind::Macro:
return "macro";
515 case SymbolKind::Enum:
return "enum";
516 case SymbolKind::Struct:
return "struct";
517 case SymbolKind::Class:
return "class";
518 case SymbolKind::Protocol:
return "protocol";
519 case SymbolKind::Extension:
return "extension";
520 case SymbolKind::Union:
return "union";
521 case SymbolKind::TypeAlias:
return "type-alias";
522 case SymbolKind::Function:
return "function";
524 case SymbolKind::Field:
return "field";
525 case SymbolKind::EnumConstant:
return "enumerator";
526 case SymbolKind::InstanceMethod:
return "instance-method";
527 case SymbolKind::ClassMethod:
return "class-method";
528 case SymbolKind::StaticMethod:
return "static-method";
529 case SymbolKind::InstanceProperty:
return "instance-property";
530 case SymbolKind::ClassProperty:
return "class-property";
531 case SymbolKind::StaticProperty:
return "static-property";
532 case SymbolKind::Constructor:
return "constructor";
533 case SymbolKind::Destructor:
return "destructor";
534 case SymbolKind::ConversionFunction:
return "conversion-func";
535 case SymbolKind::Parameter:
return "param";
536 case SymbolKind::Using:
return "using";
537 case SymbolKind::TemplateTypeParm:
return "template-type-param";
538 case SymbolKind::TemplateTemplateParm:
return "template-template-param";
539 case SymbolKind::NonTypeTemplateParm:
return "non-type-template-param";
540 case SymbolKind::Concept:
543 llvm_unreachable(
"invalid symbol kind");
549 case SymbolSubKind::CXXCopyConstructor:
return "cxx-copy-ctor";
550 case SymbolSubKind::CXXMoveConstructor:
return "cxx-move-ctor";
551 case SymbolSubKind::AccessorGetter:
return "acc-get";
552 case SymbolSubKind::AccessorSetter:
return "acc-set";
553 case SymbolSubKind::UsingTypename:
return "using-typename";
554 case SymbolSubKind::UsingValue:
return "using-value";
555 case SymbolSubKind::UsingEnum:
return "using-enum";
557 llvm_unreachable(
"invalid symbol subkind");
564 case SymbolLanguage::CXX:
return "C++";
565 case SymbolLanguage::Swift:
return "Swift";
567 llvm_unreachable(
"invalid symbol language kind");
572 #define APPLY_FOR_PROPERTY(K) \
573 if (Props & (SymbolPropertySet)SymbolProperty::K) \
574 Fn(SymbolProperty::K)
586 #undef APPLY_FOR_PROPERTY
590 bool VisitedOnce =
false;
597 case SymbolProperty::Generic: OS <<
"Gen";
break;
598 case SymbolProperty::TemplatePartialSpecialization: OS <<
"TPS";
break;
599 case SymbolProperty::TemplateSpecialization: OS <<
"TS";
break;
600 case SymbolProperty::UnitTest: OS <<
"test";
break;
601 case SymbolProperty::IBAnnotated: OS <<
"IB";
break;
602 case SymbolProperty::IBOutletCollection: OS <<
"IBColl";
break;
603 case SymbolProperty::GKInspectable: OS <<
"GKI";
break;
604 case SymbolProperty::Local: OS <<
"local";
break;
605 case SymbolProperty::ProtocolInterface: OS <<
"protocol";
break;
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
#define APPLY_FOR_PROPERTY(K)
static bool isUnitTest(const ObjCMethodDecl *D)
#define APPLY_FOR_ROLE(Role)
static void checkForIBOutlets(const Decl *D, SymbolPropertySet &PropSet)
static bool isUnitTestCase(const ObjCInterfaceDecl *D)
llvm::MachO::Record Record
Defines the clang::MacroInfo and clang::MacroDirective classes.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
Decl - This represents one declaration (or definition), e.g.
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
DeclContext * getDeclContext()
The name of a declaration.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
bool isEmpty() const
Evaluates true when this declaration name is empty.
Represents a function declaration or definition.
@ TK_FunctionTemplateSpecialization
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Encapsulates the data about a macro definition (e.g.
This represents a decl that may have a name.
Represents an ObjC class declaration.
ObjCInterfaceDecl * getSuperClass() const
ObjCMethodDecl - Represents an instance or class method declaration.
unsigned param_size() const
bool isPropertyAccessor() const
Selector getSelector() const
bool isInstanceMethod() const
QualType getReturnType() const
ObjCInterfaceDecl * getClassInterface()
ArrayRef< ParmVarDecl * > parameters() const
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Represents the declaration of a struct/union/class/enum.
constexpr XRayInstrMask None
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
void applyForEachSymbolProperty(SymbolPropertySet Props, llvm::function_ref< void(SymbolProperty)> Fn)
SymbolRole
Set of roles that are attributed to symbol occurrences.
@ RelationSpecializationOf
StringRef getSymbolSubKindString(SymbolSubKind K)
void printSymbolProperties(SymbolPropertySet Props, raw_ostream &OS)
SymbolInfo getSymbolInfo(const Decl *D)
StringRef getSymbolKindString(SymbolKind K)
bool isFunctionLocalSymbol(const Decl *D)
void applyForEachSymbolRole(SymbolRoleSet Roles, llvm::function_ref< void(SymbolRole)> Fn)
void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS)
SymbolInfo getSymbolInfoForMacro(const MacroInfo &MI)
bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS)
bool applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles, llvm::function_ref< bool(SymbolRole)> Fn)
SymbolProperty
Set of properties that provide additional info about a symbol.
@ TemplatePartialSpecialization
@ ProtocolInterface
Symbol is part of a protocol interface.
uint16_t SymbolPropertySet
StringRef getSymbolLanguageString(SymbolLanguage K)
SymbolSubKind
Language specific sub-kinds.
bool Call(InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
The JSON file list parser is used to communicate input to InstallAPI.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ VisibleNone
No linkage according to the standard, but is visible from other translation units because of types de...
@ None
No linkage, which means that the entity is unique and can only be referred to from within its scope.
@ UniqueExternal
External linkage within a unique namespace.
@ Internal
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Union
The "union" keyword.
@ Enum
The "enum" keyword.
@ Generic
not a target-specific vector type
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
SymbolPropertySet Properties