16 using namespace clang;
17 using namespace clang::index;
24 if (SuperD->getName() ==
"XCTestCase")
44 if (D->hasAttr<IBOutletAttr>()) {
46 }
else if (D->hasAttr<IBOutletCollectionAttr>()) {
59 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
60 switch (TD->getTagKind()) {
78 if (!CXXRec->isCLike())
81 if (isa<ClassTemplatePartialSpecializationDecl>(D)) {
84 }
else if (isa<ClassTemplateSpecializationDecl>(D)) {
90 switch (D->getKind()) {
104 if (isa<CXXRecordDecl>(D->getDeclContext())) {
112 CXXRec = dyn_cast<CXXRecordDecl>(D->getDeclContext())) {
113 if (!CXXRec->isCLike())
119 case Decl::ObjCInterface:
120 case Decl::ObjCImplementation: {
125 ClsD = cast<ObjCImplementationDecl>(D)->getClassInterface();
130 case Decl::ObjCProtocol:
134 case Decl::ObjCCategory:
135 case Decl::ObjCCategoryImpl:
139 case Decl::ObjCMethod:
140 if (cast<ObjCMethodDecl>(D)->isInstanceMethod())
147 if (D->hasAttr<IBActionAttr>())
150 case Decl::ObjCProperty:
168 case Decl::CXXConstructor:
172 case Decl::CXXDestructor:
176 case Decl::CXXConversion:
180 case Decl::CXXMethod: {
189 case Decl::ClassTemplate:
194 case Decl::FunctionTemplate:
198 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(
199 cast<FunctionTemplateDecl>(D)->getTemplatedDecl())) {
200 if (isa<CXXConstructorDecl>(MD))
202 else if (isa<CXXDestructorDecl>(MD))
204 else if (isa<CXXConversionDecl>(MD))
214 case Decl::TypeAliasTemplate:
231 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
232 if (FD->getTemplatedKind() ==
247 #define APPLY_FOR_ROLE(Role) \
248 if (Roles & (unsigned)SymbolRole::Role) \
266 #undef APPLY_FOR_ROLE
270 bool VisitedOnce =
false;
277 case SymbolRole::Declaration: OS <<
"Decl";
break;
278 case SymbolRole::Definition: OS <<
"Def";
break;
279 case SymbolRole::Reference: OS <<
"Ref";
break;
280 case SymbolRole::Read: OS <<
"Read";
break;
281 case SymbolRole::Write: OS <<
"Writ";
break;
282 case SymbolRole::Call: OS <<
"Call";
break;
283 case SymbolRole::Dynamic: OS <<
"Dyn";
break;
284 case SymbolRole::AddressOf: OS <<
"Addr";
break;
285 case SymbolRole::Implicit: OS <<
"Impl";
break;
286 case SymbolRole::RelationChildOf: OS <<
"RelChild";
break;
287 case SymbolRole::RelationBaseOf: OS <<
"RelBase";
break;
288 case SymbolRole::RelationOverrideOf: OS <<
"RelOver";
break;
289 case SymbolRole::RelationReceivedBy: OS <<
"RelRec";
break;
290 case SymbolRole::RelationCalledBy: OS <<
"RelCall";
break;
297 if (
auto *ND = dyn_cast<NamedDecl>(D)) {
306 DeclName.
print(OS, Policy);
316 case SymbolKind::Module:
return "module";
317 case SymbolKind::Namespace:
return "namespace";
318 case SymbolKind::NamespaceAlias:
return "namespace-alias";
319 case SymbolKind::Macro:
return "macro";
320 case SymbolKind::Enum:
return "enum";
321 case SymbolKind::Struct:
return "struct";
322 case SymbolKind::Class:
return "class";
323 case SymbolKind::Protocol:
return "protocol";
324 case SymbolKind::Extension:
return "extension";
325 case SymbolKind::Union:
return "union";
327 case SymbolKind::Function:
return "function";
328 case SymbolKind::Variable:
return "variable";
329 case SymbolKind::Field:
return "field";
330 case SymbolKind::EnumConstant:
return "enumerator";
331 case SymbolKind::InstanceMethod:
return "instance-method";
332 case SymbolKind::ClassMethod:
return "class-method";
333 case SymbolKind::StaticMethod:
return "static-method";
334 case SymbolKind::InstanceProperty:
return "instance-property";
335 case SymbolKind::ClassProperty:
return "class-property";
336 case SymbolKind::StaticProperty:
return "static-property";
337 case SymbolKind::Constructor:
return "constructor";
338 case SymbolKind::Destructor:
return "destructor";
339 case SymbolKind::ConversionFunction:
return "coversion-func";
341 llvm_unreachable(
"invalid symbol kind");
350 llvm_unreachable(
"invalid symbol language kind");
355 #define APPLY_FOR_SUBKIND(K) \
356 if (SubKinds & (unsigned)SymbolSubKind::K) \
366 #undef APPLY_FOR_SUBKIND
370 bool VisitedOnce =
false;
377 case SymbolSubKind::Generic: OS <<
"Gen";
break;
378 case SymbolSubKind::TemplatePartialSpecialization: OS <<
"TPS";
break;
379 case SymbolSubKind::TemplateSpecialization: OS <<
"TS";
break;
380 case SymbolSubKind::UnitTest: OS <<
"test";
break;
381 case SymbolSubKind::IBAnnotated: OS <<
"IB";
break;
382 case SymbolSubKind::IBOutletCollection: OS <<
"IBColl";
break;
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
static void checkForIBOutlets(const Decl *D, SymbolSubKindSet &SubKindSet)
StringRef getSymbolLanguageString(SymbolLanguage K)
ObjCInterfaceDecl * getClassInterface()
bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS)
Defines the C++ template declaration subclasses.
The "__interface" keyword.
ObjCMethodDecl - Represents an instance or class method declaration.
Describes how types, statements, expressions, and declarations should be printed. ...
SymbolRole
Set of roles that are attributed to symbol occurrences.
static bool isUnitTestCase(const ObjCInterfaceDecl *D)
void print(raw_ostream &OS, const PrintingPolicy &Policy)
StringRef getSymbolKindString(SymbolKind K)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents an ObjC class declaration.
static bool isUnitTest(const ObjCMethodDecl *D)
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
void printSymbolSubKinds(SymbolSubKindSet SubKinds, raw_ostream &OS)
bool isEmpty() const
Evaluates true when this declaration name is empty.
#define APPLY_FOR_ROLE(Role)
ArrayRef< ParmVarDecl * > parameters() const
#define APPLY_FOR_SUBKIND(K)
TagDecl - Represents the declaration of a struct/union/class/enum.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Represents a static or instance method of a struct/union/class.
QualType getReturnType() const
unsigned TypeAlias
Whether this template specialization type is a substituted type alias.
void applyForEachSymbolRole(SymbolRoleSet Roles, llvm::function_ref< void(SymbolRole)> Fn)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
DeclarationName - The name of a declaration.
unsigned SymbolSubKindSet
Selector getSelector() const
SymbolSubKindSet SubKinds
void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
SymbolInfo getSymbolInfo(const Decl *D)
Represents a C++ struct/union/class.
ObjCInterfaceDecl * getSuperClass() const
void applyForEachSymbolSubKind(SymbolSubKindSet SubKinds, llvm::function_ref< void(SymbolSubKind)> Fn)