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<TemplateTemplateParmDecl>(D))
62 if (isa<ObjCTypeParamDecl>(D))
65 if (isa<UsingDirectiveDecl>(D))
70 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
71 switch (ND->getFormalLinkage()) {
78 llvm_unreachable(
"Not a sema linkage");
103 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
104 switch (TD->getTagKind()) {
121 if (
const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D)) {
122 if (!CXXRec->isCLike()) {
124 if (CXXRec->getDescribedClassTemplate()) {
130 if (isa<ClassTemplatePartialSpecializationDecl>(D)) {
134 }
else if (isa<ClassTemplateSpecializationDecl>(D)) {
140 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
142 if (isa<ParmVarDecl>(D)) {
149 if (isa<VarTemplatePartialSpecializationDecl>(D)) {
154 }
else if (isa<VarTemplateSpecializationDecl>(D)) {
159 }
else if (VD->getDescribedVarTemplate()) {
178 if (!CXXRec->isCLike())
184 case Decl::ObjCInterface:
185 case Decl::ObjCImplementation: {
190 ClsD = cast<ObjCImplementationDecl>(D)->getClassInterface();
195 case Decl::ObjCProtocol:
199 case Decl::ObjCCategory:
200 case Decl::ObjCCategoryImpl: {
204 if (
auto *CatD = dyn_cast<ObjCCategoryDecl>(D))
205 ClsD = CatD->getClassInterface();
207 ClsD = cast<ObjCCategoryImplDecl>(D)->getClassInterface();
212 case Decl::ObjCMethod: {
224 if (D->
hasAttr<IBActionAttr>())
228 case Decl::ObjCProperty:
232 if (
auto *Annot = D->
getAttr<AnnotateAttr>()) {
233 if (Annot->getAnnotation() ==
"gk_inspectable")
250 case Decl::CXXConstructor: {
253 auto *CD = cast<CXXConstructorDecl>(D);
254 if (CD->isCopyConstructor())
256 else if (CD->isMoveConstructor())
260 case Decl::CXXDestructor:
264 case Decl::CXXConversion:
268 case Decl::CXXMethod: {
277 case Decl::ClassTemplate:
282 case Decl::FunctionTemplate:
286 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(
287 cast<FunctionTemplateDecl>(D)->getTemplatedDecl())) {
288 if (isa<CXXConstructorDecl>(MD))
290 else if (isa<CXXDestructorDecl>(MD))
292 else if (isa<CXXConversionDecl>(MD))
302 case Decl::TypeAliasTemplate:
311 case Decl::UnresolvedUsingTypename:
317 case Decl::UnresolvedUsingValue:
335 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
336 if (FD->getTemplatedKind() ==
347 if (
auto *attr = D->getExternalSourceSymbolAttr()) {
348 if (attr->getLanguage() ==
"Swift")
366 #define APPLY_FOR_ROLE(Role) \ 367 if (Roles & (unsigned)SymbolRole::Role) \ 368 if (!Fn(SymbolRole::Role)) \ 392 #undef APPLY_FOR_ROLE 406 bool VisitedOnce =
false;
439 if (
auto *ND = dyn_cast<NamedDecl>(D)) {
448 DeclName.
print(OS, Policy);
485 llvm_unreachable(
"invalid symbol kind");
498 llvm_unreachable(
"invalid symbol subkind");
508 llvm_unreachable(
"invalid symbol language kind");
513 #define APPLY_FOR_PROPERTY(K) \ 514 if (Props & (SymbolPropertySet)SymbolProperty::K) \ 515 Fn(SymbolProperty::K) 527 #undef APPLY_FOR_PROPERTY 531 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...
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...
void print(raw_ostream &OS, const PrintingPolicy &Policy)
SymbolInfo getSymbolInfoForMacro(const MacroInfo &MI)
This represents a decl that may have a name.
bool isPropertyAccessor() const
SymbolPropertySet Properties
ArrayRef< ParmVarDecl * > parameters() const