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);
85 void set(T*
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);
331 return getLocStart();
332 return getSelectorLoc(0);
336 assert(Index < getNumSelectorLocs() &&
"Index out of range!");
337 if (hasStandardSelLocs())
342 return getStoredSelLocs()[Index];
402 return param_begin() + getSelector().getNumArgs();
408 return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
425 llvm::mapped_iterator<param_const_iterator, GetTypeFn>;
428 return llvm::map_iterator(param_begin(),
GetTypeFn());
432 return llvm::map_iterator(param_end(),
GetTypeFn());
444 bool &selfIsPseudoStrong,
bool &selfIsConsumed);
485 void getOverriddenMethods(
501 DeclImplementation = ic;
509 return getImplementationControl() == Optional;
514 bool isThisDeclarationADesignatedInitializer()
const;
522 bool isDesignatedInitializerForTheInterface(
529 Stmt *getBody()
const override;
583 unsigned Variance : 2;
599 Index(index), Variance(static_cast<unsigned>(variance)),
600 VarianceLoc(varianceLoc),
ColonLoc(colonLoc) {}
602 void anchor()
override;
627 Variance =
static_cast<unsigned>(variance);
659 struct PODSourceRange {
696 unsigned size()
const {
return NumParams; }
702 return getTrailingObjects<ObjCTypeParamDecl *>();
706 return begin() +
size();
710 assert(
size() > 0 &&
"empty Objective-C type parameter list");
715 assert(
size() > 0 &&
"empty Objective-C type parameter list");
728 return SourceRange(getLAngleLoc(), getRAngleLoc());
749 void anchor()
override;
753 OBJC_PR_noattr = 0x00,
754 OBJC_PR_readonly = 0x01,
755 OBJC_PR_getter = 0x02,
756 OBJC_PR_assign = 0x04,
757 OBJC_PR_readwrite = 0x08,
758 OBJC_PR_retain = 0x10,
760 OBJC_PR_nonatomic = 0x40,
761 OBJC_PR_setter = 0x80,
762 OBJC_PR_atomic = 0x100,
763 OBJC_PR_weak = 0x200,
764 OBJC_PR_strong = 0x400,
765 OBJC_PR_unsafe_unretained = 0x800,
768 OBJC_PR_nullability = 0x1000,
769 OBJC_PR_null_resettable = 0x2000,
770 OBJC_PR_class = 0x4000
776 NumPropertyAttrsBits = 15
791 unsigned PropertyAttributes : NumPropertyAttrsBits;
792 unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
795 unsigned PropertyImplementation : 2;
822 :
NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation),
823 LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI),
824 PropertyAttributes(OBJC_PR_noattr),
825 PropertyAttributesAsWritten(OBJC_PR_noattr),
826 PropertyImplementation(propControl), GetterName(
Selector()),
852 DeclTypeSourceInfo = TSI;
864 PropertyAttributes |= PRVal;
868 PropertyAttributes = PRVal;
876 PropertyAttributesAsWritten = PRVal;
883 return (PropertyAttributes & OBJC_PR_readonly);
888 return (PropertyAttributes & OBJC_PR_atomic);
893 return (PropertyAttributes &
894 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
914 if (PropertyAttributes & OBJC_PR_strong)
915 return getType()->isBlockPointerType() ? Copy : Retain;
916 if (PropertyAttributes & OBJC_PR_retain)
918 if (PropertyAttributes & OBJC_PR_copy)
920 if (PropertyAttributes & OBJC_PR_weak)
949 PropertyImplementation = pc;
957 return getPropertyImplementation() == PropertyControl::Optional;
961 PropertyIvarDecl = Ivar;
965 return PropertyIvarDecl;
995 void anchor()
override;
1006 llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>;
1055 llvm::iterator_range<specific_decl_iterator<ObjCMethodDecl>>;
1104 ObjCMethodDecl *getMethod(
Selector Sel,
bool isInstance,
1105 bool AllowHidden =
false)
const;
1108 bool AllowHidden =
false)
const {
1109 return getMethod(Sel,
true, AllowHidden);
1113 return getMethod(Sel,
false, AllowHidden);
1116 bool HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *
P)
const;
1125 ObjCPropertyDecl *>;
1148 return SourceRange(AtStart, getAtEndRange().getEnd());
1155 return K >= firstObjCContainer &&
1156 K <= lastObjCContainer;
1199 mutable const Type *TypeForDecl =
nullptr;
1201 struct DefinitionData {
1228 mutable unsigned ExternallyCompleted : 1;
1232 mutable unsigned IvarListMissingImplementation : 1;
1236 unsigned HasDesignatedInitializers : 1;
1238 enum InheritedDesignatedInitializersState {
1247 IDI_NotInherited = 2
1251 mutable unsigned InheritedDesignatedInitializers : 2;
1259 : ExternallyCompleted(
false), IvarListMissingImplementation(
true),
1260 HasDesignatedInitializers(
false),
1261 InheritedDesignatedInitializers(IDI_Unknown) {}
1272 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
1279 void anchor()
override;
1281 void LoadExternalDefinition()
const;
1283 DefinitionData &data()
const {
1284 assert(Data.getPointer() &&
"Declaration has no definition!");
1285 return *Data.getPointer();
1289 void allocateDefinitionData();
1294 return getNextRedeclaration();
1298 return getPreviousDecl();
1302 return getMostRecentDecl();
1312 bool isInternal =
false);
1333 return TypeParamList;
1337 if (isThisDeclarationADefinition())
1340 return SourceRange(getAtStartLoc(), getLocation());
1346 void setExternallyCompleted();
1350 void setHasDesignatedInitializers();
1354 bool hasDesignatedInitializers()
const;
1359 return hasDesignatedInitializers() || inheritsDesignatedInitializers();
1363 assert(
hasDefinition() &&
"Caller did not check for forward reference!");
1364 if (data().ExternallyCompleted)
1365 LoadExternalDefinition();
1367 return data().ReferencedProtocols;
1380 return isInstance ? getCategoryInstanceMethod(Sel)
1381 : getCategoryClassMethod(Sel);
1396 if (data().ExternallyCompleted)
1397 LoadExternalDefinition();
1399 return data().ReferencedProtocols.begin();
1407 if (data().ExternallyCompleted)
1408 LoadExternalDefinition();
1410 return data().ReferencedProtocols.end();
1425 if (data().ExternallyCompleted)
1426 LoadExternalDefinition();
1428 return data().ReferencedProtocols.loc_begin();
1436 if (data().ExternallyCompleted)
1437 LoadExternalDefinition();
1439 return data().ReferencedProtocols.loc_end();
1447 all_referenced_protocol_end());
1455 if (data().ExternallyCompleted)
1456 LoadExternalDefinition();
1458 return data().AllReferencedProtocols.empty()
1460 : data().AllReferencedProtocols.begin();
1468 if (data().ExternallyCompleted)
1469 LoadExternalDefinition();
1471 return data().AllReferencedProtocols.empty()
1473 : data().AllReferencedProtocols.end();
1477 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
1515 data().ReferencedProtocols.set(List, Num, Locs, C);
1526 StringRef getObjCRuntimeNameAsString()
const;
1533 void getDesignatedInitializers(
1546 isDesignatedInitializer(
Selector Sel,
1561 if (!Data.getOpaqueValue())
1562 getMostRecentDecl();
1564 return Data.getPointer();
1571 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1578 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1583 void startDefinition();
1599 if (data().ExternallyCompleted)
1600 LoadExternalDefinition();
1602 return data().SuperClassTInfo;
1610 data().SuperClassTInfo = superClass;
1618 template<
bool (*Filter)(ObjCCategoryDecl *)>
1622 void findAcceptableCategory();
1633 : Current(Current) {
1634 findAcceptableCategory();
1650 return X.Current == Y.Current;
1655 return X.Current != Y.Current;
1672 llvm::iterator_range<visible_categories_iterator>;
1676 visible_categories_end());
1692 return visible_categories_begin() == visible_categories_end();
1706 llvm::iterator_range<known_categories_iterator>;
1710 known_categories_end());
1726 return known_categories_begin() == known_categories_end();
1742 llvm::iterator_range<visible_extensions_iterator>;
1746 visible_extensions_end());
1762 return visible_extensions_begin() == visible_extensions_end();
1780 llvm::iterator_range<known_extensions_iterator>;
1784 known_extensions_end());
1800 return known_extensions_begin() == known_extensions_end();
1810 if (data().ExternallyCompleted)
1811 LoadExternalDefinition();
1813 return data().CategoryList;
1819 data().CategoryList = category;
1826 void collectPropertiesToImplement(
PropertyMap &PM,
1833 while (I !=
nullptr) {
1844 bool isArcWeakrefUnavailable()
const;
1855 return lookupInstanceVariable(IVarName, ClassDeclared);
1863 bool shallowCategoryLookup =
false,
1864 bool followSuper =
true,
1869 return lookupMethod(Sel,
true);
1874 return lookupMethod(Sel,
false);
1881 bool Instance=
true)
const;
1884 return lookupPrivateMethod(Sel,
false);
1892 bool IsClassProperty)
const {
1893 return lookupMethod(Sel, !IsClassProperty,
1901 return getLocation();
1903 return data().EndLoc;
1915 return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
1922 bool lookupCategory,
1923 bool RHSIsQualifiedID =
false);
1928 using redeclarable_base::redecls_begin;
1929 using redeclarable_base::redecls_end;
1930 using redeclarable_base::redecls;
1931 using redeclarable_base::getPreviousDecl;
1932 using redeclarable_base::getMostRecentDecl;
1933 using redeclarable_base::isFirstDecl;
1948 bool inheritsDesignatedInitializers()
const;
1967 void anchor()
override;
1979 :
FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
1981 DeclAccess(ac), Synthesized(synthesized) {}
1989 bool synthesized=
false);
2028 unsigned DeclAccess : 3;
2029 unsigned Synthesized : 1;
2037 :
FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
2041 void anchor()
override;
2087 struct DefinitionData {
2100 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
2106 void anchor()
override;
2108 DefinitionData &data()
const {
2109 assert(Data.getPointer() &&
"Objective-C protocol has no definition!");
2110 return *Data.getPointer();
2113 void allocateDefinitionData();
2118 return getNextRedeclaration();
2122 return getPreviousDecl();
2126 return getMostRecentDecl();
2144 return data().ReferencedProtocols;
2158 return data().ReferencedProtocols.begin();
2165 return data().ReferencedProtocols.end();
2179 return data().ReferencedProtocols.loc_begin();
2186 return data().ReferencedProtocols.loc_end();
2193 return data().ReferencedProtocols.size();
2201 data().ReferencedProtocols.set(List, Num, Locs, C);
2211 return lookupMethod(Sel,
true);
2215 return lookupMethod(Sel,
false);
2224 if (!Data.getOpaqueValue())
2225 getMostRecentDecl();
2227 return Data.getPointer();
2232 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2237 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2247 void startDefinition();
2251 StringRef getObjCRuntimeNameAsString()
const;
2254 if (isThisDeclarationADefinition())
2257 return SourceRange(getAtStartLoc(), getLocation());
2263 using redeclarable_base::redecls_begin;
2264 using redeclarable_base::redecls_end;
2265 using redeclarable_base::redecls;
2266 using redeclarable_base::getPreviousDecl;
2267 using redeclarable_base::getMostRecentDecl;
2268 using redeclarable_base::isFirstDecl;
2274 void collectPropertiesToImplement(
PropertyMap &PM,
2329 void anchor()
override;
2367 ReferencedProtocols.
set(List, Num, Locs, C);
2371 return ReferencedProtocols;
2382 return ReferencedProtocols.
begin();
2400 return ReferencedProtocols.
loc_end();
2408 return NextClassCategory;
2414 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2431 return ivar_begin() == ivar_end();
2450 void anchor()
override;
2458 ClassInterface(classInterface) {}
2486 llvm::iterator_range<specific_decl_iterator<ObjCPropertyImplDecl>>;
2503 return K >= firstObjCImpl && K <= lastObjCImpl;
2528 :
ObjCImplDecl(ObjCCategoryImpl, DC, classInterface, Id,
2529 nameLoc, atStartLoc),
2530 CategoryNameLoc(CategoryNameLoc) {}
2532 void anchor()
override;
2585 unsigned NumIvarInitializers = 0;
2589 bool HasNonZeroConstructors : 1;
2592 bool HasDestructors : 1;
2604 nameLoc, atStartLoc),
2605 SuperClass(superDecl), SuperLoc(superLoc),
2606 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc),
2607 HasNonZeroConstructors(
false), HasDestructors(
false) {}
2609 void anchor()
override;
2643 const auto *ConstThis =
this;
2652 return init_begin() + NumIvarInitializers;
2657 return init_begin() + NumIvarInitializers;
2662 return NumIvarInitializers;
2666 NumIvarInitializers = numNumIvarInitializers;
2671 unsigned numInitializers);
2686 return getClassInterface()->getIdentifier();
2695 assert(
getIdentifier() &&
"Name is not a simple identifier");
2708 StringRef getObjCRuntimeNameAsString()
const;
2722 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2739 return ivar_begin() == ivar_end();
2756 :
NamedDecl(ObjCCompatibleAlias, DC, L, Id), AliasedClass(aliasedClass) {}
2758 void anchor()
override;
2806 Expr *GetterCXXConstructor =
nullptr;
2810 Expr *SetterCXXAssignment =
nullptr;
2817 :
Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc),
2818 IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl) {
2819 assert(PK == Dynamic || PropertyIvarDecl);
2841 return PropertyDecl;
2846 return PropertyIvarDecl ? Synthesize : Dynamic;
2850 return PropertyIvarDecl;
2856 PropertyIvarDecl = Ivar;
2857 this->IvarLoc = IvarLoc;
2868 return IvarLoc.
isValid() && IvarLoc != getLocation();
2872 return GetterCXXConstructor;
2876 GetterCXXConstructor = getterCXXConstructor;
2880 return SetterCXXAssignment;
2884 SetterCXXAssignment = setterCXXAssignment;
2891 template<
bool (*Filter)(ObjCCategoryDecl *)>
2895 while (Current && !Filter(Current))
2896 Current = Current->getNextClassCategoryRaw();
2899 template<
bool (*Filter)(ObjCCategoryDecl *)>
2902 Current = Current->getNextClassCategoryRaw();
2903 findAcceptableCategory();
2921 #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
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
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
Represents a parameter to a function.
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
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.
ObjCContainerDecl(Kind DK, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
SourceLocation getLocEnd() const LLVM_READONLY
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
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
SourceLocation getBeginLoc() const LLVM_READONLY
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
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)
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.
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 ':'.
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.