14 #ifndef LLVM_CLANG_AST_DECLOBJC_H 15 #define LLVM_CLANG_AST_DECLOBJC_H 27 #include "llvm/ADT/ArrayRef.h" 28 #include "llvm/ADT/DenseMap.h" 29 #include "llvm/ADT/DenseSet.h" 30 #include "llvm/ADT/None.h" 31 #include "llvm/ADT/PointerIntPair.h" 32 #include "llvm/ADT/STLExtras.h" 33 #include "llvm/ADT/StringRef.h" 34 #include "llvm/ADT/iterator_range.h" 35 #include "llvm/Support/Compiler.h" 36 #include "llvm/Support/TrailingObjects.h" 48 class CXXCtorInitializer;
50 class ObjCCategoryDecl;
51 class ObjCCategoryImplDecl;
52 class ObjCImplementationDecl;
53 class ObjCInterfaceDecl;
55 class ObjCPropertyDecl;
56 class ObjCPropertyImplDecl;
57 class ObjCProtocolDecl;
72 bool empty()
const {
return NumElts == 0; }
75 void set(
void *
const* InList,
unsigned Elts,
ASTContext &Ctx);
95 assert(Idx <
NumElts &&
"Invalid access");
150 unsigned IsInstance : 1;
151 unsigned IsVariadic : 1;
154 unsigned IsPropertyAccessor : 1;
157 unsigned IsDefined : 1;
160 unsigned IsRedeclaration : 1;
163 mutable unsigned HasRedeclaration : 1;
167 unsigned DeclImplementation : 2;
171 unsigned objcDeclQualifier : 7;
174 unsigned RelatedResultType : 1;
178 unsigned SelLocsKind : 2;
187 unsigned IsOverriding : 1;
190 unsigned HasSkippedBody : 1;
200 void *ParamsAndSelLocs =
nullptr;
201 unsigned NumParams = 0;
220 bool isVariadic =
false,
bool isPropertyAccessor =
false,
221 bool isImplicitlyDeclared =
false,
bool isDefined =
false,
223 bool HasRelatedResultType =
false)
224 :
NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo),
226 IsInstance(isInstance), IsVariadic(isVariadic),
227 IsPropertyAccessor(isPropertyAccessor), IsDefined(isDefined),
228 IsRedeclaration(0), HasRedeclaration(0), DeclImplementation(impControl),
229 objcDeclQualifier(OBJC_TQ_None),
230 RelatedResultType(HasRelatedResultType),
232 MethodDeclType(T), ReturnTInfo(ReturnTInfo), DeclEndLoc(endLoc) {
233 setImplicit(isImplicitlyDeclared);
240 bool hasStandardSelLocs()
const {
247 return reinterpret_cast<SourceLocation*
>(getParams() + NumParams);
250 return reinterpret_cast<const SourceLocation*
>(getParams() + NumParams);
256 return reinterpret_cast<ParmVarDecl **
>(ParamsAndSelLocs);
259 return reinterpret_cast<const ParmVarDecl *
const *
>(ParamsAndSelLocs);
264 unsigned getNumStoredSelLocs()
const {
265 if (hasStandardSelLocs())
267 return getNumSelectorLocs();
287 bool isVariadic =
false,
bool isPropertyAccessor =
false,
288 bool isImplicitlyDeclared =
false,
bool isDefined =
false,
290 bool HasRelatedResultType =
false);
329 return getLocStart();
330 return getSelectorLoc(0);
334 assert(Index < getNumSelectorLocs() &&
"Index out of range!");
335 if (hasStandardSelLocs())
340 return getStoredSelLocs()[Index];
400 return param_begin() + getSelector().getNumArgs();
406 return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
423 llvm::mapped_iterator<param_const_iterator, GetTypeFn>;
426 return llvm::map_iterator(param_begin(),
GetTypeFn());
430 return llvm::map_iterator(param_end(),
GetTypeFn());
442 bool &selfIsPseudoStrong,
bool &selfIsConsumed);
483 void getOverriddenMethods(
499 DeclImplementation = ic;
507 return getImplementationControl() == Optional;
512 bool isThisDeclarationADesignatedInitializer()
const;
520 bool isDesignatedInitializerForTheInterface(
527 Stmt *getBody()
const override;
581 unsigned Variance : 2;
597 Index(index), Variance(static_cast<unsigned>(variance)),
598 VarianceLoc(varianceLoc),
ColonLoc(colonLoc) {}
600 void anchor()
override;
625 Variance =
static_cast<unsigned>(variance);
657 struct PODSourceRange {
694 unsigned size()
const {
return NumParams; }
700 return getTrailingObjects<ObjCTypeParamDecl *>();
704 return begin() +
size();
708 assert(
size() > 0 &&
"empty Objective-C type parameter list");
713 assert(
size() > 0 &&
"empty Objective-C type parameter list");
726 return SourceRange(getLAngleLoc(), getRAngleLoc());
747 void anchor()
override;
751 OBJC_PR_noattr = 0x00,
752 OBJC_PR_readonly = 0x01,
753 OBJC_PR_getter = 0x02,
754 OBJC_PR_assign = 0x04,
755 OBJC_PR_readwrite = 0x08,
756 OBJC_PR_retain = 0x10,
758 OBJC_PR_nonatomic = 0x40,
759 OBJC_PR_setter = 0x80,
760 OBJC_PR_atomic = 0x100,
761 OBJC_PR_weak = 0x200,
762 OBJC_PR_strong = 0x400,
763 OBJC_PR_unsafe_unretained = 0x800,
766 OBJC_PR_nullability = 0x1000,
767 OBJC_PR_null_resettable = 0x2000,
768 OBJC_PR_class = 0x4000
774 NumPropertyAttrsBits = 15
789 unsigned PropertyAttributes : NumPropertyAttrsBits;
790 unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
793 unsigned PropertyImplementation : 2;
820 :
NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation),
821 LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI),
822 PropertyAttributes(OBJC_PR_noattr),
823 PropertyAttributesAsWritten(OBJC_PR_noattr),
824 PropertyImplementation(propControl), GetterName(
Selector()),
850 DeclTypeSourceInfo = TSI;
862 PropertyAttributes |= PRVal;
866 PropertyAttributes = PRVal;
874 PropertyAttributesAsWritten = PRVal;
881 return (PropertyAttributes & OBJC_PR_readonly);
886 return (PropertyAttributes & OBJC_PR_atomic);
891 return (PropertyAttributes &
892 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
912 if (PropertyAttributes & OBJC_PR_strong)
913 return getType()->isBlockPointerType() ? Copy : Retain;
914 if (PropertyAttributes & OBJC_PR_retain)
916 if (PropertyAttributes & OBJC_PR_copy)
918 if (PropertyAttributes & OBJC_PR_weak)
947 PropertyImplementation = pc;
955 return getPropertyImplementation() == PropertyControl::Optional;
959 PropertyIvarDecl = Ivar;
963 return PropertyIvarDecl;
993 void anchor()
override;
1004 llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>;
1053 llvm::iterator_range<specific_decl_iterator<ObjCMethodDecl>>;
1102 ObjCMethodDecl *getMethod(
Selector Sel,
bool isInstance,
1103 bool AllowHidden =
false)
const;
1106 bool AllowHidden =
false)
const {
1107 return getMethod(Sel,
true, AllowHidden);
1111 return getMethod(Sel,
false, AllowHidden);
1114 bool HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *
P)
const;
1123 ObjCPropertyDecl *>;
1146 return SourceRange(AtStart, getAtEndRange().getEnd());
1153 return K >= firstObjCContainer &&
1154 K <= lastObjCContainer;
1197 mutable const Type *TypeForDecl =
nullptr;
1199 struct DefinitionData {
1226 mutable unsigned ExternallyCompleted : 1;
1230 mutable unsigned IvarListMissingImplementation : 1;
1234 unsigned HasDesignatedInitializers : 1;
1236 enum InheritedDesignatedInitializersState {
1245 IDI_NotInherited = 2
1249 mutable unsigned InheritedDesignatedInitializers : 2;
1257 : ExternallyCompleted(
false), IvarListMissingImplementation(
true),
1258 HasDesignatedInitializers(
false),
1259 InheritedDesignatedInitializers(IDI_Unknown) {}
1270 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
1277 void anchor()
override;
1279 void LoadExternalDefinition()
const;
1281 DefinitionData &data()
const {
1282 assert(Data.getPointer() &&
"Declaration has no definition!");
1283 return *Data.getPointer();
1287 void allocateDefinitionData();
1292 return getNextRedeclaration();
1296 return getPreviousDecl();
1300 return getMostRecentDecl();
1310 bool isInternal =
false);
1331 return TypeParamList;
1335 if (isThisDeclarationADefinition())
1338 return SourceRange(getAtStartLoc(), getLocation());
1344 void setExternallyCompleted();
1348 void setHasDesignatedInitializers();
1352 bool hasDesignatedInitializers()
const;
1357 return hasDesignatedInitializers() || inheritsDesignatedInitializers();
1361 assert(
hasDefinition() &&
"Caller did not check for forward reference!");
1362 if (data().ExternallyCompleted)
1363 LoadExternalDefinition();
1365 return data().ReferencedProtocols;
1378 return isInstance ? getCategoryInstanceMethod(Sel)
1379 : getCategoryClassMethod(Sel);
1394 if (data().ExternallyCompleted)
1395 LoadExternalDefinition();
1397 return data().ReferencedProtocols.begin();
1405 if (data().ExternallyCompleted)
1406 LoadExternalDefinition();
1408 return data().ReferencedProtocols.end();
1423 if (data().ExternallyCompleted)
1424 LoadExternalDefinition();
1426 return data().ReferencedProtocols.loc_begin();
1434 if (data().ExternallyCompleted)
1435 LoadExternalDefinition();
1437 return data().ReferencedProtocols.loc_end();
1445 all_referenced_protocol_end());
1453 if (data().ExternallyCompleted)
1454 LoadExternalDefinition();
1456 return data().AllReferencedProtocols.empty()
1458 : data().AllReferencedProtocols.begin();
1466 if (data().ExternallyCompleted)
1467 LoadExternalDefinition();
1469 return data().AllReferencedProtocols.empty()
1471 : data().AllReferencedProtocols.end();
1475 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
1513 data().ReferencedProtocols.set(List, Num, Locs, C);
1524 StringRef getObjCRuntimeNameAsString()
const;
1531 void getDesignatedInitializers(
1544 isDesignatedInitializer(
Selector Sel,
1559 if (!Data.getOpaqueValue())
1560 getMostRecentDecl();
1562 return Data.getPointer();
1569 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1576 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1581 void startDefinition();
1597 if (data().ExternallyCompleted)
1598 LoadExternalDefinition();
1600 return data().SuperClassTInfo;
1608 data().SuperClassTInfo = superClass;
1616 template<
bool (*Filter)(ObjCCategoryDecl *)>
1620 void findAcceptableCategory();
1631 : Current(Current) {
1632 findAcceptableCategory();
1648 return X.Current == Y.Current;
1653 return X.Current != Y.Current;
1670 llvm::iterator_range<visible_categories_iterator>;
1674 visible_categories_end());
1690 return visible_categories_begin() == visible_categories_end();
1704 llvm::iterator_range<known_categories_iterator>;
1708 known_categories_end());
1724 return known_categories_begin() == known_categories_end();
1740 llvm::iterator_range<visible_extensions_iterator>;
1744 visible_extensions_end());
1760 return visible_extensions_begin() == visible_extensions_end();
1778 llvm::iterator_range<known_extensions_iterator>;
1782 known_extensions_end());
1798 return known_extensions_begin() == known_extensions_end();
1808 if (data().ExternallyCompleted)
1809 LoadExternalDefinition();
1811 return data().CategoryList;
1817 data().CategoryList = category;
1824 void collectPropertiesToImplement(
PropertyMap &PM,
1831 while (I !=
nullptr) {
1842 bool isArcWeakrefUnavailable()
const;
1853 return lookupInstanceVariable(IVarName, ClassDeclared);
1861 bool shallowCategoryLookup =
false,
1862 bool followSuper =
true,
1867 return lookupMethod(Sel,
true);
1872 return lookupMethod(Sel,
false);
1879 bool Instance=
true)
const;
1882 return lookupPrivateMethod(Sel,
false);
1890 bool IsClassProperty)
const {
1891 return lookupMethod(Sel, !IsClassProperty,
1899 return getLocation();
1901 return data().EndLoc;
1913 return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
1920 bool lookupCategory,
1921 bool RHSIsQualifiedID =
false);
1926 using redeclarable_base::redecls_begin;
1927 using redeclarable_base::redecls_end;
1928 using redeclarable_base::redecls;
1929 using redeclarable_base::getPreviousDecl;
1930 using redeclarable_base::getMostRecentDecl;
1931 using redeclarable_base::isFirstDecl;
1946 bool inheritsDesignatedInitializers()
const;
1965 void anchor()
override;
1977 :
FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
1979 DeclAccess(ac), Synthesized(synthesized) {}
1987 bool synthesized=
false);
2026 unsigned DeclAccess : 3;
2027 unsigned Synthesized : 1;
2035 :
FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
2039 void anchor()
override;
2085 struct DefinitionData {
2098 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
2104 void anchor()
override;
2106 DefinitionData &data()
const {
2107 assert(Data.getPointer() &&
"Objective-C protocol has no definition!");
2108 return *Data.getPointer();
2111 void allocateDefinitionData();
2116 return getNextRedeclaration();
2120 return getPreviousDecl();
2124 return getMostRecentDecl();
2142 return data().ReferencedProtocols;
2156 return data().ReferencedProtocols.begin();
2163 return data().ReferencedProtocols.end();
2177 return data().ReferencedProtocols.loc_begin();
2184 return data().ReferencedProtocols.loc_end();
2191 return data().ReferencedProtocols.size();
2199 data().ReferencedProtocols.set(List, Num, Locs, C);
2209 return lookupMethod(Sel,
true);
2213 return lookupMethod(Sel,
false);
2222 if (!Data.getOpaqueValue())
2223 getMostRecentDecl();
2225 return Data.getPointer();
2230 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2235 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2245 void startDefinition();
2249 StringRef getObjCRuntimeNameAsString()
const;
2252 if (isThisDeclarationADefinition())
2255 return SourceRange(getAtStartLoc(), getLocation());
2261 using redeclarable_base::redecls_begin;
2262 using redeclarable_base::redecls_end;
2263 using redeclarable_base::redecls;
2264 using redeclarable_base::getPreviousDecl;
2265 using redeclarable_base::getMostRecentDecl;
2266 using redeclarable_base::isFirstDecl;
2272 void collectPropertiesToImplement(
PropertyMap &PM,
2327 void anchor()
override;
2365 ReferencedProtocols.
set(List, Num, Locs, C);
2369 return ReferencedProtocols;
2380 return ReferencedProtocols.
begin();
2398 return ReferencedProtocols.
loc_end();
2406 return NextClassCategory;
2412 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2429 return ivar_begin() == ivar_end();
2448 void anchor()
override;
2456 ClassInterface(classInterface) {}
2484 llvm::iterator_range<specific_decl_iterator<ObjCPropertyImplDecl>>;
2501 return K >= firstObjCImpl && K <= lastObjCImpl;
2526 :
ObjCImplDecl(ObjCCategoryImpl, DC, classInterface, Id,
2527 nameLoc, atStartLoc),
2528 CategoryNameLoc(CategoryNameLoc) {}
2530 void anchor()
override;
2583 unsigned NumIvarInitializers = 0;
2587 bool HasNonZeroConstructors : 1;
2590 bool HasDestructors : 1;
2602 nameLoc, atStartLoc),
2603 SuperClass(superDecl), SuperLoc(superLoc),
2604 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc),
2605 HasNonZeroConstructors(
false), HasDestructors(
false) {}
2607 void anchor()
override;
2641 const auto *ConstThis =
this;
2650 return init_begin() + NumIvarInitializers;
2655 return init_begin() + NumIvarInitializers;
2660 return NumIvarInitializers;
2664 NumIvarInitializers = numNumIvarInitializers;
2669 unsigned numInitializers);
2684 return getClassInterface()->getIdentifier();
2693 assert(
getIdentifier() &&
"Name is not a simple identifier");
2706 StringRef getObjCRuntimeNameAsString()
const;
2720 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2737 return ivar_begin() == ivar_end();
2754 :
NamedDecl(ObjCCompatibleAlias, DC, L, Id), AliasedClass(aliasedClass) {}
2756 void anchor()
override;
2804 Expr *GetterCXXConstructor =
nullptr;
2808 Expr *SetterCXXAssignment =
nullptr;
2815 :
Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc),
2816 IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl) {
2817 assert(PK == Dynamic || PropertyIvarDecl);
2838 return PropertyDecl;
2843 return PropertyIvarDecl ? Synthesize : Dynamic;
2847 return PropertyIvarDecl;
2853 PropertyIvarDecl = Ivar;
2854 this->IvarLoc = IvarLoc;
2865 return IvarLoc.
isValid() && IvarLoc != getLocation();
2869 return GetterCXXConstructor;
2873 GetterCXXConstructor = getterCXXConstructor;
2877 return SetterCXXAssignment;
2881 SetterCXXAssignment = setterCXXAssignment;
2888 template<
bool (*Filter)(ObjCCategoryDecl *)>
2892 while (Current && !Filter(Current))
2893 Current = Current->getNextClassCategoryRaw();
2896 template<
bool (*Filter)(ObjCCategoryDecl *)>
2899 Current = Current->getNextClassCategoryRaw();
2900 findAcceptableCategory();
2918 #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
void setOverriding(bool isOverriding)
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
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)
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
SourceLocation getLocStart() const LLVM_READONLY
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)
ParmVarDecl - 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
getIdentifier - 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
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
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.
ObjCContainerDecl(Kind DK, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
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
Expr - 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
const FunctionProtoType * T
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.
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)
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
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.
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
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
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(...).
Defines the clang::SourceLocation class and associated facilities.
SourceLocation getCategoryNameLoc() const
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 SetRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
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
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)
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or immediately...
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.
NamedDecl - This represents a decl with 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 ':'.
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.