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()) {
75 llvm_unreachable(
"Not a sema linkage");
100 if (
auto *VT = dyn_cast<VarTemplateDecl>(D)) {
104 D = VT->getTemplatedDecl();
107 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
108 switch (TD->getTagKind()) {
125 if (
const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D)) {
126 if (!CXXRec->isCLike()) {
128 if (CXXRec->getDescribedClassTemplate()) {
134 if (isa<ClassTemplatePartialSpecializationDecl>(D)) {
138 }
else if (isa<ClassTemplateSpecializationDecl>(D)) {
144 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
146 if (isa<ParmVarDecl>(D)) {
153 if (isa<VarTemplatePartialSpecializationDecl>(D)) {
158 }
else if (isa<VarTemplateSpecializationDecl>(D)) {
163 }
else if (VD->getDescribedVarTemplate()) {
179 case Decl::IndirectField:
183 if (!CXXRec->isCLike())
189 case Decl::ObjCInterface:
190 case Decl::ObjCImplementation: {
195 ClsD = cast<ObjCImplementationDecl>(D)->getClassInterface();
200 case Decl::ObjCProtocol:
204 case Decl::ObjCCategory:
205 case Decl::ObjCCategoryImpl: {
209 if (
auto *CatD = dyn_cast<ObjCCategoryDecl>(D))
210 ClsD = CatD->getClassInterface();
212 ClsD = cast<ObjCCategoryImplDecl>(D)->getClassInterface();
217 case Decl::ObjCMethod: {
229 if (D->
hasAttr<IBActionAttr>())
233 case Decl::ObjCProperty:
237 if (
auto *Annot = D->
getAttr<AnnotateAttr>()) {
238 if (Annot->getAnnotation() ==
"gk_inspectable")
255 case Decl::CXXConstructor: {
258 auto *CD = cast<CXXConstructorDecl>(D);
259 if (CD->isCopyConstructor())
261 else if (CD->isMoveConstructor())
265 case Decl::CXXDestructor:
269 case Decl::CXXConversion:
273 case Decl::CXXMethod: {
282 case Decl::ClassTemplate:
287 case Decl::FunctionTemplate:
291 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(
292 cast<FunctionTemplateDecl>(D)->getTemplatedDecl())) {
293 if (isa<CXXConstructorDecl>(MD))
295 else if (isa<CXXDestructorDecl>(MD))
297 else if (isa<CXXConversionDecl>(MD))
307 case Decl::TypeAliasTemplate:
316 case Decl::UnresolvedUsingTypename:
322 case Decl::UnresolvedUsingValue:
336 case Decl::MSProperty:
340 if (!CXXRec->isCLike())
344 case Decl::ClassTemplatePartialSpecialization:
345 case Decl::ClassScopeFunctionSpecialization:
346 case Decl::ClassTemplateSpecialization:
347 case Decl::CXXRecord:
350 llvm_unreachable(
"records handled before");
352 case Decl::VarTemplateSpecialization:
353 case Decl::VarTemplatePartialSpecialization:
354 case Decl::ImplicitParam:
357 case Decl::VarTemplate:
358 llvm_unreachable(
"variables handled before");
369 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
370 if (FD->getTemplatedKind() ==
381 if (
auto *attr = D->getExternalSourceSymbolAttr()) {
382 if (attr->getLanguage() ==
"Swift")
400 #define APPLY_FOR_ROLE(Role) \ 401 if (Roles & (unsigned)SymbolRole::Role) \ 402 if (!Fn(SymbolRole::Role)) \ 427 #undef APPLY_FOR_ROLE 441 bool VisitedOnce =
false;
475 if (
auto *ND = dyn_cast<NamedDecl>(D)) {
484 DeclName.
print(OS, Policy);
521 llvm_unreachable(
"invalid symbol kind");
534 llvm_unreachable(
"invalid symbol subkind");
544 llvm_unreachable(
"invalid symbol language kind");
549 #define APPLY_FOR_PROPERTY(K) \ 550 if (Props & (SymbolPropertySet)SymbolProperty::K) \ 551 Fn(SymbolProperty::K) 563 #undef APPLY_FOR_PROPERTY 567 bool VisitedOnce =
false;
Represents a function declaration or definition.
External linkage, which indicates that the entity can be referred to from other translation units...
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
StringRef getSymbolLanguageString(SymbolLanguage K)
unsigned param_size() const
ObjCInterfaceDecl * getClassInterface()
Internal linkage according to the Modules TS, but can be referred to from other translation units ind...
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS)
No linkage, which means that the entity is unique and can only be referred to from within its scope...
Decl - This represents one declaration (or definition), e.g.
Defines the C++ template declaration subclasses.
uint16_t SymbolPropertySet
Defines the clang::MacroInfo and clang::MacroDirective classes.
Symbol is part of a protocol interface.
bool isEmpty() const
Evaluates true when this declaration name is empty.
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
The "__interface" keyword.
ObjCMethodDecl - Represents an instance or class method declaration.
Describes how types, statements, expressions, and declarations should be printed. ...
static bool isUnitTestCase(const ObjCInterfaceDecl *D)
bool applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles, llvm::function_ref< bool(SymbolRole)> Fn)
SymbolSubKind
Language specific sub-kinds.
#define APPLY_FOR_PROPERTY(K)
void applyForEachSymbolProperty(SymbolPropertySet Props, llvm::function_ref< void(SymbolProperty)> Fn)
SymbolRole
Set of roles that are attributed to symbol occurrences.
bool isFunctionLocalSymbol(const Decl *D)
StringRef getSymbolKindString(SymbolKind K)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
StringRef getSymbolSubKindString(SymbolSubKind K)
Represents an ObjC class declaration.
static bool isUnitTest(const ObjCMethodDecl *D)
QualType getReturnType() const
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
Module linkage, which indicates that the entity can be referred to from other translation units withi...
void printSymbolProperties(SymbolPropertySet Props, raw_ostream &OS)
#define APPLY_FOR_ROLE(Role)
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
DeclContext * getDeclContext()
ObjCInterfaceDecl * getSuperClass() const
bool isInstanceMethod() const
Selector getSelector() const
static void checkForIBOutlets(const Decl *D, SymbolPropertySet &PropSet)
Represents the declaration of a struct/union/class/enum.
Represents a static or instance method of a struct/union/class.
void applyForEachSymbolRole(SymbolRoleSet Roles, llvm::function_ref< void(SymbolRole)> Fn)
Dataflow Directional Tag Classes.
External linkage within a unique namespace.
The name of a declaration.
Encapsulates the data about a macro definition (e.g.
SymbolProperty
Set of properties that provide additional info about a symbol.
void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS)
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
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.
No linkage according to the standard, but is visible from other translation units because of types de...
SymbolInfo getSymbolInfoForMacro(const MacroInfo &MI)
This represents a decl that may have a name.
bool isPropertyAccessor() const
SymbolPropertySet Properties
ArrayRef< ParmVarDecl * > parameters() const