13 #ifndef LLVM_CLANG_AST_DECLOBJC_H 14 #define LLVM_CLANG_AST_DECLOBJC_H 26 #include "llvm/ADT/ArrayRef.h" 27 #include "llvm/ADT/DenseMap.h" 28 #include "llvm/ADT/DenseSet.h" 29 #include "llvm/ADT/None.h" 30 #include "llvm/ADT/PointerIntPair.h" 31 #include "llvm/ADT/STLExtras.h" 32 #include "llvm/ADT/StringRef.h" 33 #include "llvm/ADT/iterator_range.h" 34 #include "llvm/Support/Compiler.h" 35 #include "llvm/Support/TrailingObjects.h" 47 class CXXCtorInitializer;
49 class ObjCCategoryDecl;
50 class ObjCCategoryImplDecl;
51 class ObjCImplementationDecl;
52 class ObjCInterfaceDecl;
54 class ObjCPropertyDecl;
55 class ObjCPropertyImplDecl;
56 class ObjCProtocolDecl;
71 bool empty()
const {
return NumElts == 0; }
74 void set(
void *
const* InList,
unsigned Elts,
ASTContext &Ctx);
84 void set(T*
const* InList,
unsigned Elts,
ASTContext &Ctx) {
94 assert(Idx <
NumElts &&
"Invalid access");
154 void *ParamsAndSelLocs =
nullptr;
155 unsigned NumParams = 0;
174 bool isVariadic =
false,
bool isPropertyAccessor =
false,
175 bool isImplicitlyDeclared =
false,
bool isDefined =
false,
177 bool HasRelatedResultType =
false);
184 ObjCMethodDeclBits.SelLocsKind =
Kind;
187 bool hasStandardSelLocs()
const {
194 return reinterpret_cast<SourceLocation *
>(getParams() + NumParams);
197 return reinterpret_cast<const SourceLocation *
>(getParams() + NumParams);
203 return reinterpret_cast<ParmVarDecl **
>(ParamsAndSelLocs);
206 return reinterpret_cast<const ParmVarDecl *
const *
>(ParamsAndSelLocs);
211 unsigned getNumStoredSelLocs()
const {
212 if (hasStandardSelLocs())
214 return getNumSelectorLocs();
234 bool isVariadic =
false,
bool isPropertyAccessor =
false,
235 bool isImplicitlyDeclared =
false,
bool isDefined =
false,
237 bool HasRelatedResultType =
false);
251 ObjCMethodDeclBits.objcDeclQualifier = QV;
257 return ObjCMethodDeclBits.RelatedResultType;
262 ObjCMethodDeclBits.RelatedResultType = RRT;
273 ObjCMethodDeclBits.HasRedeclaration = HRD;
290 return getBeginLoc();
291 return getSelectorLoc(0);
295 assert(Index < getNumSelectorLocs() &&
"Index out of range!");
296 if (hasStandardSelLocs())
301 return getStoredSelLocs()[Index];
361 return param_begin() + getSelector().getNumArgs();
367 return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
372 assert(Idx < NumParams &&
"Index out of bounds!");
373 return getParams()[Idx];
392 llvm::mapped_iterator<param_const_iterator, GetTypeFn>;
395 return llvm::map_iterator(param_begin(),
GetTypeFn());
399 return llvm::map_iterator(param_end(),
GetTypeFn());
411 bool &selfIsPseudoStrong,
bool &selfIsConsumed);
423 ObjCMethodDeclBits.IsInstance = isInst;
426 bool isVariadic()
const {
return ObjCMethodDeclBits.IsVariadic; }
427 void setVariadic(
bool isVar) { ObjCMethodDeclBits.IsVariadic = isVar; }
432 return ObjCMethodDeclBits.IsPropertyAccessor;
436 ObjCMethodDeclBits.IsPropertyAccessor = isAccessor;
439 bool isDefined()
const {
return ObjCMethodDeclBits.IsDefined; }
440 void setDefined(
bool isDefined) { ObjCMethodDeclBits.IsDefined = isDefined; }
450 void setOverriding(
bool IsOver) { ObjCMethodDeclBits.IsOverriding = IsOver; }
460 void getOverriddenMethods(
466 ObjCMethodDeclBits.HasSkippedBody = Skipped;
478 ObjCMethodDeclBits.DeclImplementation = ic;
486 return getImplementationControl() == Optional;
491 bool isThisDeclarationADesignatedInitializer()
const;
499 bool isDesignatedInitializerForTheInterface(
506 Stmt *getBody()
const override;
517 bool definedInNSObject(
const ASTContext &)
const;
563 unsigned Variance : 2;
579 Index(index), Variance(static_cast<unsigned>(variance)),
580 VarianceLoc(varianceLoc),
ColonLoc(colonLoc) {}
582 void anchor()
override;
607 Variance =
static_cast<unsigned>(variance);
639 struct PODSourceRange {
676 unsigned size()
const {
return NumParams; }
682 return getTrailingObjects<ObjCTypeParamDecl *>();
686 return begin() +
size();
690 assert(
size() > 0 &&
"empty Objective-C type parameter list");
695 assert(
size() > 0 &&
"empty Objective-C type parameter list");
708 return SourceRange(getLAngleLoc(), getRAngleLoc());
729 void anchor()
override;
733 OBJC_PR_noattr = 0x00,
734 OBJC_PR_readonly = 0x01,
735 OBJC_PR_getter = 0x02,
736 OBJC_PR_assign = 0x04,
737 OBJC_PR_readwrite = 0x08,
738 OBJC_PR_retain = 0x10,
740 OBJC_PR_nonatomic = 0x40,
741 OBJC_PR_setter = 0x80,
742 OBJC_PR_atomic = 0x100,
743 OBJC_PR_weak = 0x200,
744 OBJC_PR_strong = 0x400,
745 OBJC_PR_unsafe_unretained = 0x800,
748 OBJC_PR_nullability = 0x1000,
749 OBJC_PR_null_resettable = 0x2000,
750 OBJC_PR_class = 0x4000
756 NumPropertyAttrsBits = 15
771 unsigned PropertyAttributes : NumPropertyAttrsBits;
772 unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
775 unsigned PropertyImplementation : 2;
802 :
NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation),
803 LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI),
804 PropertyAttributes(OBJC_PR_noattr),
805 PropertyAttributesAsWritten(OBJC_PR_noattr),
806 PropertyImplementation(propControl), GetterName(
Selector()),
832 DeclTypeSourceInfo = TSI;
844 PropertyAttributes |= PRVal;
848 PropertyAttributes = PRVal;
856 PropertyAttributesAsWritten = PRVal;
863 return (PropertyAttributes & OBJC_PR_readonly);
868 return (PropertyAttributes & OBJC_PR_atomic);
873 return (PropertyAttributes &
874 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
894 if (PropertyAttributes & OBJC_PR_strong)
895 return getType()->isBlockPointerType() ? Copy : Retain;
896 if (PropertyAttributes & OBJC_PR_retain)
898 if (PropertyAttributes & OBJC_PR_copy)
900 if (PropertyAttributes & OBJC_PR_weak)
929 PropertyImplementation = pc;
937 return getPropertyImplementation() == PropertyControl::Optional;
941 PropertyIvarDecl = Ivar;
945 return PropertyIvarDecl;
976 void anchor()
override;
985 llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>;
1034 llvm::iterator_range<specific_decl_iterator<ObjCMethodDecl>>;
1083 ObjCMethodDecl *getMethod(
Selector Sel,
bool isInstance,
1084 bool AllowHidden =
false)
const;
1087 bool AllowHidden =
false)
const {
1088 return getMethod(Sel,
true, AllowHidden);
1092 return getMethod(Sel,
false, AllowHidden);
1095 bool HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *
P)
const;
1104 ObjCPropertyDecl *>;
1117 ObjCContainerDeclBits.AtStart = Loc;
1126 return SourceRange(getAtStartLoc(), getAtEndRange().getEnd());
1133 return K >= firstObjCContainer &&
1134 K <= lastObjCContainer;
1177 mutable const Type *TypeForDecl =
nullptr;
1179 struct DefinitionData {
1206 mutable unsigned ExternallyCompleted : 1;
1210 mutable unsigned IvarListMissingImplementation : 1;
1214 unsigned HasDesignatedInitializers : 1;
1216 enum InheritedDesignatedInitializersState {
1225 IDI_NotInherited = 2
1229 mutable unsigned InheritedDesignatedInitializers : 2;
1237 : ExternallyCompleted(
false), IvarListMissingImplementation(
true),
1238 HasDesignatedInitializers(
false),
1239 InheritedDesignatedInitializers(IDI_Unknown) {}
1250 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
1257 void anchor()
override;
1259 void LoadExternalDefinition()
const;
1261 DefinitionData &data()
const {
1262 assert(Data.getPointer() &&
"Declaration has no definition!");
1263 return *Data.getPointer();
1267 void allocateDefinitionData();
1272 return getNextRedeclaration();
1276 return getPreviousDecl();
1280 return getMostRecentDecl();
1290 bool isInternal =
false);
1311 return TypeParamList;
1315 if (isThisDeclarationADefinition())
1318 return SourceRange(getAtStartLoc(), getLocation());
1324 void setExternallyCompleted();
1328 void setHasDesignatedInitializers();
1332 bool hasDesignatedInitializers()
const;
1337 return hasDesignatedInitializers() || inheritsDesignatedInitializers();
1341 assert(
hasDefinition() &&
"Caller did not check for forward reference!");
1342 if (data().ExternallyCompleted)
1343 LoadExternalDefinition();
1345 return data().ReferencedProtocols;
1358 return isInstance ? getCategoryInstanceMethod(Sel)
1359 : getCategoryClassMethod(Sel);
1374 if (data().ExternallyCompleted)
1375 LoadExternalDefinition();
1377 return data().ReferencedProtocols.begin();
1385 if (data().ExternallyCompleted)
1386 LoadExternalDefinition();
1388 return data().ReferencedProtocols.end();
1403 if (data().ExternallyCompleted)
1404 LoadExternalDefinition();
1406 return data().ReferencedProtocols.loc_begin();
1414 if (data().ExternallyCompleted)
1415 LoadExternalDefinition();
1417 return data().ReferencedProtocols.loc_end();
1425 all_referenced_protocol_end());
1433 if (data().ExternallyCompleted)
1434 LoadExternalDefinition();
1436 return data().AllReferencedProtocols.empty()
1438 : data().AllReferencedProtocols.begin();
1446 if (data().ExternallyCompleted)
1447 LoadExternalDefinition();
1449 return data().AllReferencedProtocols.empty()
1451 : data().AllReferencedProtocols.end();
1455 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
1493 data().ReferencedProtocols.set(List, Num, Locs, C);
1504 StringRef getObjCRuntimeNameAsString()
const;
1511 void getDesignatedInitializers(
1524 isDesignatedInitializer(
Selector Sel,
1539 if (!Data.getOpaqueValue())
1540 getMostRecentDecl();
1542 return Data.getPointer();
1549 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1556 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1561 void startDefinition();
1577 if (data().ExternallyCompleted)
1578 LoadExternalDefinition();
1580 return data().SuperClassTInfo;
1588 data().SuperClassTInfo = superClass;
1596 template<
bool (*Filter)(ObjCCategoryDecl *)>
1600 void findAcceptableCategory();
1611 : Current(Current) {
1612 findAcceptableCategory();
1628 return X.Current == Y.Current;
1633 return X.Current != Y.Current;
1650 llvm::iterator_range<visible_categories_iterator>;
1654 visible_categories_end());
1670 return visible_categories_begin() == visible_categories_end();
1684 llvm::iterator_range<known_categories_iterator>;
1688 known_categories_end());
1704 return known_categories_begin() == known_categories_end();
1720 llvm::iterator_range<visible_extensions_iterator>;
1724 visible_extensions_end());
1740 return visible_extensions_begin() == visible_extensions_end();
1758 llvm::iterator_range<known_extensions_iterator>;
1762 known_extensions_end());
1778 return known_extensions_begin() == known_extensions_end();
1788 if (data().ExternallyCompleted)
1789 LoadExternalDefinition();
1791 return data().CategoryList;
1797 data().CategoryList = category;
1804 void collectPropertiesToImplement(
PropertyMap &PM,
1811 while (I !=
nullptr) {
1822 bool isArcWeakrefUnavailable()
const;
1833 return lookupInstanceVariable(IVarName, ClassDeclared);
1841 bool shallowCategoryLookup =
false,
1842 bool followSuper =
true,
1847 return lookupMethod(Sel,
true);
1852 return lookupMethod(Sel,
false);
1859 bool Instance=
true)
const;
1862 return lookupPrivateMethod(Sel,
false);
1870 bool IsClassProperty)
const {
1871 return lookupMethod(Sel, !IsClassProperty,
1879 return getLocation();
1881 return data().EndLoc;
1893 return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
1900 bool lookupCategory,
1901 bool RHSIsQualifiedID =
false);
1906 using redeclarable_base::redecls_begin;
1907 using redeclarable_base::redecls_end;
1908 using redeclarable_base::redecls;
1909 using redeclarable_base::getPreviousDecl;
1910 using redeclarable_base::getMostRecentDecl;
1911 using redeclarable_base::isFirstDecl;
1926 bool inheritsDesignatedInitializers()
const;
1945 void anchor()
override;
1957 :
FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
1959 DeclAccess(ac), Synthesized(synthesized) {}
1967 bool synthesized=
false);
2006 unsigned DeclAccess : 3;
2007 unsigned Synthesized : 1;
2015 :
FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
2019 void anchor()
override;
2065 struct DefinitionData {
2078 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
2084 void anchor()
override;
2086 DefinitionData &data()
const {
2087 assert(Data.getPointer() &&
"Objective-C protocol has no definition!");
2088 return *Data.getPointer();
2091 void allocateDefinitionData();
2096 return getNextRedeclaration();
2100 return getPreviousDecl();
2104 return getMostRecentDecl();
2122 return data().ReferencedProtocols;
2136 return data().ReferencedProtocols.begin();
2143 return data().ReferencedProtocols.end();
2157 return data().ReferencedProtocols.loc_begin();
2164 return data().ReferencedProtocols.loc_end();
2171 return data().ReferencedProtocols.size();
2179 data().ReferencedProtocols.set(List, Num, Locs, C);
2189 return lookupMethod(Sel,
true);
2193 return lookupMethod(Sel,
false);
2202 if (!Data.getOpaqueValue())
2203 getMostRecentDecl();
2205 return Data.getPointer();
2210 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2215 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2225 void startDefinition();
2229 StringRef getObjCRuntimeNameAsString()
const;
2232 if (isThisDeclarationADefinition())
2235 return SourceRange(getAtStartLoc(), getLocation());
2241 using redeclarable_base::redecls_begin;
2242 using redeclarable_base::redecls_end;
2243 using redeclarable_base::redecls;
2244 using redeclarable_base::getPreviousDecl;
2245 using redeclarable_base::getMostRecentDecl;
2246 using redeclarable_base::isFirstDecl;
2252 void collectPropertiesToImplement(
PropertyMap &PM,
2307 void anchor()
override;
2345 ReferencedProtocols.
set(List, Num, Locs, C);
2349 return ReferencedProtocols;
2360 return ReferencedProtocols.
begin();
2378 return ReferencedProtocols.
loc_end();
2386 return NextClassCategory;
2392 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2409 return ivar_begin() == ivar_end();
2428 void anchor()
override;
2436 ClassInterface(classInterface) {}
2464 llvm::iterator_range<specific_decl_iterator<ObjCPropertyImplDecl>>;
2481 return K >= firstObjCImpl && K <= lastObjCImpl;
2506 :
ObjCImplDecl(ObjCCategoryImpl, DC, classInterface, Id,
2507 nameLoc, atStartLoc),
2508 CategoryNameLoc(CategoryNameLoc) {}
2510 void anchor()
override;
2563 unsigned NumIvarInitializers = 0;
2567 bool HasNonZeroConstructors : 1;
2570 bool HasDestructors : 1;
2582 nameLoc, atStartLoc),
2583 SuperClass(superDecl), SuperLoc(superLoc),
2584 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc),
2585 HasNonZeroConstructors(
false), HasDestructors(
false) {}
2587 void anchor()
override;
2621 const auto *ConstThis =
this;
2630 return init_begin() + NumIvarInitializers;
2635 return init_begin() + NumIvarInitializers;
2640 return NumIvarInitializers;
2644 NumIvarInitializers = numNumIvarInitializers;
2649 unsigned numInitializers);
2664 return getClassInterface()->getIdentifier();
2673 assert(
getIdentifier() &&
"Name is not a simple identifier");
2686 StringRef getObjCRuntimeNameAsString()
const;
2700 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2717 return ivar_begin() == ivar_end();
2734 :
NamedDecl(ObjCCompatibleAlias, DC, L, Id), AliasedClass(aliasedClass) {}
2736 void anchor()
override;
2784 Expr *GetterCXXConstructor =
nullptr;
2788 Expr *SetterCXXAssignment =
nullptr;
2795 :
Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc),
2796 IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl) {
2797 assert(PK == Dynamic || PropertyIvarDecl);
2818 return PropertyDecl;
2823 return PropertyIvarDecl ? Synthesize : Dynamic;
2827 return PropertyIvarDecl;
2833 PropertyIvarDecl = Ivar;
2834 this->IvarLoc = IvarLoc;
2845 return IvarLoc.
isValid() && IvarLoc != getLocation();
2849 return GetterCXXConstructor;
2853 GetterCXXConstructor = getterCXXConstructor;
2857 return SetterCXXAssignment;
2861 SetterCXXAssignment = setterCXXAssignment;
2868 template<
bool (*Filter)(ObjCCategoryDecl *)>
2872 while (Current && !
Filter(Current))
2873 Current = Current->getNextClassCategoryRaw();
2876 template<
bool (*Filter)(ObjCCategoryDecl *)>
2879 Current = Current->getNextClassCategoryRaw();
2880 findAcceptableCategory();
2898 #endif // LLVM_CLANG_AST_DECLOBJC_H llvm::iterator_range< param_const_iterator > param_const_range
known_extensions_iterator known_extensions_begin() const
Retrieve an iterator to the beginning of the known-extensions list.
SourceLocation getGetterNameLoc() const
void setCategoryNameLoc(SourceLocation Loc)
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or with a spac...
ObjCMethodDecl * lookupPrivateClassMethod(const Selector &Sel)
bool hasDefinition() const
Determine whether this class has been defined.
ObjCPropertyQueryKind getQueryKind() const
llvm::iterator_range< visible_categories_iterator > visible_categories_range
const Type * getTypeForDecl() const
bool isClassMethod() const
static const Decl * getCanonicalDecl(const Decl *D)
unsigned ivar_size() const
param_type_iterator param_type_end() const
void setEndOfDefinitionLoc(SourceLocation LE)
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
propimpl_iterator propimpl_end() const
llvm::iterator_range< redecl_iterator > redecl_range
protocol_range protocols() const
Smart pointer class that efficiently represents Objective-C method names.
const ObjCInterfaceDecl * getDefinition() const
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
ObjCListBase & operator=(const ObjCListBase &)=delete
A (possibly-)qualified type.
visible_extensions_iterator visible_extensions_begin() const
Retrieve an iterator to the beginning of the visible-extensions list.
static bool classof(const Decl *D)
unsigned param_size() const
ObjCInterfaceDecl * getClassInterface()
all_protocol_range all_referenced_protocols() const
llvm::iterator_range< init_const_iterator > init_const_range
void setLParenLoc(SourceLocation L)
static bool classof(const Decl *D)
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
ObjCIvarDecl * getPropertyIvarDecl() const
const ParmVarDecl * getParamDecl(unsigned Idx) const
init_const_range inits() const
ObjCMethodDecl * getCategoryMethod(Selector Sel, bool isInstance) const
llvm::iterator_range< instmeth_iterator > instmeth_range
Stmt - This represents one statement.
const ObjCProtocolList & getReferencedProtocols() const
method_iterator meth_end() const
C Language Family Type Representation.
std::input_iterator_tag iterator_category
llvm::mapped_iterator< param_const_iterator, GetTypeFn > param_type_iterator
llvm::iterator_range< protocol_iterator > protocol_range
redeclarable_base::redecl_iterator redecl_iterator
Decl - This represents one declaration (or definition), e.g.
classprop_iterator classprop_end() const
AccessControl getCanonicalAccessControl() const
llvm::iterator_range< classmeth_iterator > classmeth_range
all_protocol_iterator all_referenced_protocol_begin() const
static bool classofKind(Kind K)
known_categories_range known_categories() const
ObjCInterfaceDecl * getClassInterface()
Expr * getSetterCXXAssignment() const
void setNumIvarInitializers(unsigned numNumIvarInitializers)
void ** List
List is an array of pointers to objects that are not owned by this object.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
unsigned getNumSelectorLocs() const
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
visible_extensions_iterator visible_extensions_end() const
Retrieve an iterator to the end of the visible-extensions list.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction...
void setPropertyImplementation(PropertyControl pc)
bool hasRedeclaration() const
True if redeclared in the same interface.
protocol_iterator protocol_begin() const
void setPropertyIvarDecl(ObjCIvarDecl *Ivar, SourceLocation IvarLoc)
static bool classofKind(Kind K)
ObjCCategoryDecl * getNextClassCategoryRaw() const
Retrieve the pointer to the next stored category (or extension), which may be hidden.
const ObjCInterfaceDecl * getCanonicalDecl() const
A container of type source information.
static ObjCMethodDecl * castFromDeclContext(const DeclContext *DC)
instmeth_iterator instmeth_end() const
void setPropertyAccessor(bool isAccessor)
SourceLocation getColonLoc() const
Retrieve the location of the ':' separating the type parameter name from the explicitly-specified bou...
Iterates over a filtered subrange of declarations stored in a DeclContext.
static bool classof(const Decl *D)
param_const_iterator param_end() const
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
static bool classofKind(Decl::Kind K)
static bool classofKind(Kind K)
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
llvm::iterator_range< param_iterator > param_range
llvm::iterator_range< classprop_iterator > classprop_range
method_iterator meth_begin() const
static bool classof(const Decl *D)
static bool classofKind(Kind K)
ObjCMethodDecl - Represents an instance or class method declaration.
void setSelfDecl(ImplicitParamDecl *SD)
classmeth_range class_methods() const
protocol_range protocols() const
pointer operator->() const
static const NamedDecl * getDefinition(const Decl *D)
Represents a parameter to a function.
const ObjCInterfaceDecl * getSuperClass() const
static DeclContext * castToDeclContext(const ObjCMethodDecl *D)
SourceLocation getDeclaratorEndLoc() const
Returns the location where the declarator ends.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
Provides common interface for the Decls that can be redeclared.
ObjCProtocolDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C protocol.
instprop_range instance_properties() const
One of these records is kept for each identifier that is lexed.
llvm::iterator_range< init_iterator > init_range
bool declaresOrInheritsDesignatedInitializers() const
Returns true if this interface decl declares a designated initializer or it inherites one from its su...
const ObjCProtocolDecl * getCanonicalDecl() const
const ObjCProtocolList & getReferencedProtocols() const
SourceLocation getIvarLBraceLoc() const
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
Expr * getGetterCXXConstructor() const
Represents a class type in Objective C.
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ObjCMethodDecl * getClassMethod(Selector Sel, bool AllowHidden=false) const
const ParmVarDecl *const * param_const_iterator
ObjCMethodFamily
A family of Objective-C methods.
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
QualType operator()(const ParmVarDecl *PD) const
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
ObjCImplDecl(Kind DK, DeclContext *DC, ObjCInterfaceDecl *classInterface, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
const ObjCInterfaceDecl * getClassInterface() const
Represents a member of a struct/union/class.
const_iterator end() const
protocol_iterator protocol_begin() const
llvm::iterator_range< protocol_iterator > protocol_range
instmeth_range instance_methods() const
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names the class interface associated with this implementation...
void setSuperClass(TypeSourceInfo *superClass)
method_range methods() const
std::string getNameAsString() const
Get the name of the class associated with this interface.
ObjCMethodDecl * getSetterMethodDecl() const
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
SourceRange getSourceRange() const
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
loc_iterator loc_begin() const
prop_range properties() const
protocol_iterator protocol_end() const
static bool classofKind(Kind K)
void setReturnType(QualType T)
visible_categories_range visible_categories() const
static bool classof(const Decl *D)
unsigned getIndex() const
Retrieve the index into its type parameter list.
static bool classof(const Decl *D)
void setDeclImplementation(ImplementationControl ic)
static ObjCContainerDecl * castFromDeclContext(const DeclContext *DC)
void set(ObjCProtocolDecl *const *InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx)
std::ptrdiff_t difference_type
bool isUnarySelector() const
bool isClassProperty() const
T * operator[](unsigned Idx) const
SourceLocation getIvarRBraceLoc() const
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
ObjCTypeParamDecl * AlignmentHack
void set(void *const *InList, unsigned Elts, ASTContext &Ctx)
ObjCContainerDecl - Represents a container for method declarations.
void setAccessControl(AccessControl ac)
void setAtLoc(SourceLocation L)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
unsigned ivar_size() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
PropertyAttributeKind getPropertyAttributes() const
protocol_loc_iterator protocol_loc_end() const
void setSuperClass(ObjCInterfaceDecl *superCls)
void setLazyBody(uint64_t Offset)
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
void setClassInterface(ObjCInterfaceDecl *D)
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Lookup a class method for a given selector.
SourceLocation getPropertyIvarDeclLoc() const
CompoundStmt * getCompoundBody()
Represents an Objective-C protocol declaration.
filtered_category_iterator operator++(int)
ObjCInterfaceDecl * getSuperClass()
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
void addInstanceMethod(ObjCMethodDecl *method)
PropertyControl getPropertyImplementation() const
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Represents an ObjC class declaration.
QualType getReturnType() const
all_protocol_iterator all_referenced_protocol_end() const
ObjCInterfaceDecl * getClassInterface()
bool isAtomic() const
isAtomic - Return true if the property is atomic.
SourceLocation getAtStartLoc() const
bool isInstanceProperty() const
void setGetterCXXConstructor(Expr *getterCXXConstructor)
Iterator that walks over the list of categories, filtering out those that do not meet specific criter...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
visible_categories_iterator visible_categories_end() const
Retrieve an iterator to the end of the visible-categories list.
void setVariadic(bool isVar)
classprop_iterator classprop_begin() const
protocol_loc_range protocol_locs() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
visible_extensions_range visible_extensions() const
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
void setHasDestructors(bool val)
void setIvarRBraceLoc(SourceLocation Loc)
unsigned ivar_size() const
static bool classofKind(Kind K)
void setNextIvar(ObjCIvarDecl *ivar)
bool hasDefinition() const
Determine whether this protocol has a definition.
void setSynthesize(bool synth)
void setType(QualType T, TypeSourceInfo *TSI)
classprop_range class_properties() const
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
ObjCTypeParamDecl *const * const_iterator
This represents one expression.
ivar_iterator ivar_end() const
known_extensions_range known_extensions() const
Selector getSetterName() const
static bool classof(const Decl *D)
ivar_iterator ivar_begin() const
TypeSourceInfo * getSuperClassTInfo() const
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
static bool classof(const Decl *D)
TypeSourceInfo * getTypeSourceInfo() const
const T * castAs() const
Member-template castAs<specific type>.
param_iterator param_end()
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
SourceLocation getStandardSelectorLoc(unsigned Index, Selector Sel, bool WithArgSpace, ArrayRef< Expr *> Args, SourceLocation EndLoc)
Get the "standard" location of a selector identifier, e.g: For nullary selectors, immediately before ...
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
SourceLocation getSelectorStartLoc() const
void setAtEndRange(SourceRange atEnd)
propimpl_iterator propimpl_begin() const
bool known_categories_empty() const
Determine whether the known-categories list is empty.
void setRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
redeclarable_base::redecl_iterator redecl_iterator
loc_iterator loc_end() const
void addClassMethod(ObjCMethodDecl *method)
ObjCInterfaceDecl * getSuperClass() const
void setDefined(bool isDefined)
ParmVarDecl *const * param_iterator
protocol_loc_iterator protocol_loc_begin() const
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
protocol_loc_iterator protocol_loc_end() const
propimpl_range property_impls() const
const_iterator begin() const
static bool classofKind(Kind K)
llvm::SmallDenseSet< const ObjCProtocolDecl *, 8 > ProtocolPropertySet
reference operator*() const
static bool classof(const Decl *D)
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
bool isInstanceMethod() const
static DeclContext * castToDeclContext(const ObjCContainerDecl *D)
static bool classof(const Decl *D)
unsigned getNumArgs() const
void setIvarRBraceLoc(SourceLocation Loc)
void setIsRedeclaration(bool RD)
Selector getSelector() const
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
ImplicitParamDecl * getSelfDecl() const
llvm::iterator_range< known_extensions_iterator > known_extensions_range
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
void setHasSkippedBody(bool Skipped=true)
static StringRef getIdentifier(const Token &Tok)
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
ObjCProtocolList::iterator protocol_iterator
filtered_category_iterator(ObjCCategoryDecl *Current)
llvm::iterator_range< instprop_iterator > instprop_range
protocol_loc_range protocol_locs() const
TypeSourceInfo * getReturnTypeSourceInfo() const
PODSourceRange Brackets
Location of the left and right angle brackets.
unsigned protocol_size() const
const ObjCIvarDecl * all_declared_ivar_begin() const
ivar_iterator ivar_end() const
ivar_iterator ivar_begin() const
classmeth_iterator classmeth_end() const
const ObjCInterfaceDecl * getClassInterface() const
Encodes a location in the source.
bool getSynthesize() const
ivar_iterator ivar_end() const
ObjCProtocolList::iterator protocol_iterator
clang::ObjCProtocolDecl *const * iterator
SourceLocation getSuperClassLoc() const
void setIvarLBraceLoc(SourceLocation Loc)
void setAtStartLoc(SourceLocation Loc)
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
static bool classof(const Decl *D)
void setObjCDeclQualifier(ObjCDeclQualifier QV)
SourceLocation getCategoryNameLoc() const
ObjCList - This is a simple template class used to hold various lists of decls etc, which is heavily used by the ObjC front-end.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCTypeParamDecl * front() const
ObjCCategoryDecl - Represents a category declaration.
llvm::iterator_range< specific_decl_iterator< ObjCPropertyImplDecl > > propimpl_range
void setOverriding(bool IsOver)
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Represents one property declaration in an Objective-C interface.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCMethodDecl * lookupPropertyAccessor(const Selector Sel, const ObjCCategoryDecl *Cat, bool IsClassProperty) const
Lookup a setter or getter in the class hierarchy, including in all categories except for category pas...
bool isIvarNameSpecified() const
For @synthesize, returns true if an ivar name was explicitly specified.
param_type_iterator param_type_begin() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
ObjCDeclQualifier getObjCDeclQualifier() const
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
prop_iterator prop_end() const
classmeth_iterator classmeth_begin() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isValid() const
Whether this pointer is non-NULL.
const ObjCIvarDecl * getNextIvar() const
SourceLocation getIvarLBraceLoc() const
const SourceLocation * loc_iterator
protocol_range protocols() const
ObjCTypeParamDecl * back() const
visible_categories_iterator visible_categories_begin() const
Retrieve an iterator to the beginning of the visible-categories list.
virtual void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const
This routine collects list of properties to be implemented in the class.
Defines various enumerations that describe declaration and type specifiers.
void setSetterCXXAssignment(Expr *setterCXXAssignment)
ObjCIvarDecl * getNextIvar()
Base class for declarations which introduce a typedef-name.
void setPropertyDecl(ObjCPropertyDecl *Prop)
static bool classofKind(Kind K)
protocol_iterator protocol_end() const
param_iterator param_begin()
const ObjCInterfaceDecl * getClassInterface() const
bool known_extensions_empty() const
Determine whether the known-extensions list is empty.
static bool classofKind(Kind K)
static bool classof(const Decl *D)
Dataflow Directional Tag Classes.
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
bool isValid() const
Return true if this is a valid SourceLocation object.
void setGetterName(Selector Sel, SourceLocation Loc=SourceLocation())
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
PropertyAttributeKind getPropertyAttributesAsWritten() const
instprop_iterator instprop_end() const
static std::string getName(const CallEvent &Call)
llvm::iterator_range< visible_extensions_iterator > visible_extensions_range
const ObjCMethodDecl * getCanonicalDecl() const
Kind getPropertyImplementation() const
llvm::iterator_range< protocol_iterator > protocol_range
SourceLocation getAtLoc() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
ObjCList< ObjCProtocolDecl >::iterator all_protocol_iterator
Reads an AST files chain containing the contents of a translation unit.
llvm::iterator_range< specific_decl_iterator< ObjCMethodDecl > > method_range
const ObjCProtocolList & getReferencedProtocols() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
void setIvarList(ObjCIvarDecl *ivar)
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
filtered_category_iterator & operator++()
Represents the declaration of an Objective-C type parameter.
friend bool operator!=(filtered_category_iterator X, filtered_category_iterator Y)
static bool classofKind(Kind K)
llvm::iterator_range< all_protocol_iterator > all_protocol_range
llvm::iterator_range< redecl_iterator > redecl_range
llvm::DenseMap< std::pair< IdentifierInfo *, unsigned >, ObjCPropertyDecl * > PropertyMap
init_const_iterator init_end() const
end() - Retrieve an iterator past the last initializer.
SourceLocation getSetterNameLoc() const
const ObjCInterfaceDecl * getClassInterface() const
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
void setHasNonZeroConstructors(bool val)
void overwritePropertyAttributes(unsigned PRVal)
protocol_loc_range protocol_locs() const
Represents a C++ base or member initializer.
SourceLocation getSelectorLoc(unsigned Index) const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isRetaining() const
isRetaining - Return true if the property retains its value.
protocol_iterator protocol_begin() const
const ObjCProtocolDecl * getDefinition() const
Retrieve the definition of this protocol, if any.
friend bool operator==(filtered_category_iterator X, filtered_category_iterator Y)
bool hasBody() const override
Determine whether this method has a body.
param_const_iterator param_begin() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
A list of Objective-C protocols, along with the source locations at which they were referenced...
void setCategoryListRaw(ObjCCategoryDecl *category)
Set the raw pointer to the start of the category/extension list.
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
void setSetterName(Selector Sel, SourceLocation Loc=SourceLocation())
llvm::iterator_range< known_categories_iterator > known_categories_range
bool IsClassExtension() const
ImplementationControl getImplementationControl() const
SourceRange getAtEndRange() const
prop_iterator prop_begin() const
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
known_categories_iterator known_categories_end() const
Retrieve an iterator to the end of the known-categories list.
static bool classofKind(Kind K)
Represents a field declaration created by an @defs(...).
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
Defines the clang::SourceLocation class and associated facilities.
SourceLocation getCategoryNameLoc() const
static bool isInstanceMethod(const Decl *D)
instprop_iterator instprop_begin() const
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName)
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
void setInstanceMethod(bool isInst)
void setHasRedeclaration(bool HRD) const
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getPropertyIvarDecl() const
void setReturnTypeSourceInfo(TypeSourceInfo *TInfo)
ObjCCategoryDecl * getNextClassCategory() const
void setIvarLBraceLoc(SourceLocation Loc)
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
ImplicitParamDecl * getCmdDecl() const
void setPropertyAttributes(PropertyAttributeKind PRVal)
protocol_iterator protocol_end() const
param_const_iterator sel_param_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classofKind(Kind K)
unsigned protocol_size() const
Kind
Lists the kind of concrete classes of Decl.
StringRef getName() const
getName - Get the name of identifier for the class interface associated with this implementation as a...
static ObjCPropertyQueryKind getQueryKind(bool isClassProperty)
known_extensions_iterator known_extensions_end() const
Retrieve an iterator to the end of the known-extensions list.
ObjCPropertyDecl * getPropertyDecl() const
bool visible_categories_empty() const
Determine whether the visible-categories list is empty.
SourceLocation getRAngleLoc() const
void setAtLoc(SourceLocation Loc)
llvm::iterator_range< specific_decl_iterator< ObjCPropertyDecl > > prop_range
protocol_loc_iterator protocol_loc_begin() const
static bool classof(const Decl *D)
A trivial tuple used to represent a source range.
instmeth_iterator instmeth_begin() const
void setLexicalDeclContext(DeclContext *DC)
ObjCMethodDecl * getGetterMethodDecl() const
known_categories_iterator known_categories_begin() const
Retrieve an iterator to the beginning of the known-categories list.
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
This represents a decl that may have a name.
static bool classof(const Decl *D)
void setVariance(ObjCTypeParamVariance variance)
Set the variance of this type parameter.
protocol_loc_iterator protocol_loc_begin() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
AccessControl getAccessControl() const
SourceLocation getIvarRBraceLoc() const
static bool classofKind(Kind K)
ivar_iterator ivar_begin() const
bool isPropertyAccessor() const
Selector getGetterName() const
SourceLocation getLParenLoc() const
SourceLocation getEndOfDefinitionLoc() const
bool visible_extensions_empty() const
Determine whether the visible-extensions list is empty.
protocol_loc_iterator protocol_loc_end() const
void setTypeForDecl(const Type *TD) const
SourceLocation getLAngleLoc() const
ObjCProtocolList::iterator protocol_iterator
SourceLocation ColonLoc
Location of ':'.
ParmVarDecl * getParamDecl(unsigned Idx)
unsigned getNumIvarInitializers() const
getNumArgs - Number of ivars which must be initialized.
unsigned size() const
Determine the number of type parameters in this list.
void setCmdDecl(ImplicitParamDecl *CD)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
The parameter is invariant: must match exactly.
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
ArrayRef< ParmVarDecl * > parameters() const
ObjCCompatibleAliasDecl - Represents alias of a class.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.