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 isSynthesizedAccessorStub =
false,
176 bool isImplicitlyDeclared =
false,
bool isDefined =
false,
178 bool HasRelatedResultType =
false);
185 ObjCMethodDeclBits.SelLocsKind =
Kind;
188 bool hasStandardSelLocs()
const {
195 return reinterpret_cast<SourceLocation *
>(getParams() + NumParams);
198 return reinterpret_cast<const SourceLocation *
>(getParams() + NumParams);
204 return reinterpret_cast<ParmVarDecl **
>(ParamsAndSelLocs);
207 return reinterpret_cast<const ParmVarDecl *
const *
>(ParamsAndSelLocs);
212 unsigned getNumStoredSelLocs()
const {
213 if (hasStandardSelLocs())
215 return getNumSelectorLocs();
235 bool isVariadic =
false,
bool isPropertyAccessor =
false,
236 bool isSynthesizedAccessorStub =
false,
237 bool isImplicitlyDeclared =
false,
bool isDefined =
false,
239 bool HasRelatedResultType =
false);
253 ObjCMethodDeclBits.objcDeclQualifier = QV;
259 return ObjCMethodDeclBits.RelatedResultType;
264 ObjCMethodDeclBits.RelatedResultType = RRT;
275 ObjCMethodDeclBits.HasRedeclaration = HRD;
292 return getBeginLoc();
293 return getSelectorLoc(0);
297 assert(Index < getNumSelectorLocs() &&
"Index out of range!");
298 if (hasStandardSelLocs())
303 return getStoredSelLocs()[Index];
363 return param_begin() + getSelector().getNumArgs();
369 return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
374 assert(Idx < NumParams &&
"Index out of bounds!");
375 return getParams()[Idx];
394 llvm::mapped_iterator<param_const_iterator, GetTypeFn>;
397 return llvm::map_iterator(param_begin(),
GetTypeFn());
401 return llvm::map_iterator(param_end(),
GetTypeFn());
413 bool &selfIsPseudoStrong,
bool &selfIsConsumed)
const;
425 ObjCMethodDeclBits.IsInstance = isInst;
428 bool isVariadic()
const {
return ObjCMethodDeclBits.IsVariadic; }
429 void setVariadic(
bool isVar) { ObjCMethodDeclBits.IsVariadic = isVar; }
434 return ObjCMethodDeclBits.IsPropertyAccessor;
438 ObjCMethodDeclBits.IsPropertyAccessor = isAccessor;
442 return ObjCMethodDeclBits.IsSynthesizedAccessorStub;
446 ObjCMethodDeclBits.IsSynthesizedAccessorStub = isSynthesizedAccessorStub;
449 bool isDefined()
const {
return ObjCMethodDeclBits.IsDefined; }
450 void setDefined(
bool isDefined) { ObjCMethodDeclBits.IsDefined = isDefined; }
460 void setOverriding(
bool IsOver) { ObjCMethodDeclBits.IsOverriding = IsOver; }
470 void getOverriddenMethods(
476 ObjCMethodDeclBits.HasSkippedBody = Skipped;
480 bool isDirectMethod()
const;
491 ObjCMethodDeclBits.DeclImplementation = ic;
499 return getImplementationControl() ==
Optional;
504 bool isThisDeclarationADesignatedInitializer()
const;
512 bool isDesignatedInitializerForTheInterface(
519 Stmt *getBody()
const override;
530 bool definedInNSObject(
const ASTContext &)
const;
576 unsigned Variance : 2;
592 Index(index), Variance(static_cast<unsigned>(variance)),
593 VarianceLoc(varianceLoc),
ColonLoc(colonLoc) {}
595 void anchor()
override;
620 Variance =
static_cast<unsigned>(variance);
652 struct PODSourceRange {
689 unsigned size()
const {
return NumParams; }
695 return getTrailingObjects<ObjCTypeParamDecl *>();
699 return begin() +
size();
703 assert(
size() > 0 &&
"empty Objective-C type parameter list");
708 assert(
size() > 0 &&
"empty Objective-C type parameter list");
721 return SourceRange(getLAngleLoc(), getRAngleLoc());
742 void anchor()
override;
746 OBJC_PR_noattr = 0x00,
747 OBJC_PR_readonly = 0x01,
748 OBJC_PR_getter = 0x02,
749 OBJC_PR_assign = 0x04,
750 OBJC_PR_readwrite = 0x08,
751 OBJC_PR_retain = 0x10,
753 OBJC_PR_nonatomic = 0x40,
754 OBJC_PR_setter = 0x80,
755 OBJC_PR_atomic = 0x100,
756 OBJC_PR_weak = 0x200,
757 OBJC_PR_strong = 0x400,
758 OBJC_PR_unsafe_unretained = 0x800,
761 OBJC_PR_nullability = 0x1000,
762 OBJC_PR_null_resettable = 0x2000,
763 OBJC_PR_class = 0x4000,
764 OBJC_PR_direct = 0x8000
770 NumPropertyAttrsBits = 16
785 unsigned PropertyAttributes : NumPropertyAttrsBits;
786 unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
789 unsigned PropertyImplementation : 2;
816 :
NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation),
817 LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI),
818 PropertyAttributes(OBJC_PR_noattr),
819 PropertyAttributesAsWritten(OBJC_PR_noattr),
820 PropertyImplementation(propControl), GetterName(
Selector()),
846 DeclTypeSourceInfo = TSI;
858 PropertyAttributes |= PRVal;
862 PropertyAttributes = PRVal;
870 PropertyAttributesAsWritten = PRVal;
877 return (PropertyAttributes & OBJC_PR_readonly);
882 return (PropertyAttributes & OBJC_PR_atomic);
887 return (PropertyAttributes &
888 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
909 if (PropertyAttributes & OBJC_PR_strong)
910 return getType()->isBlockPointerType() ? Copy : Retain;
911 if (PropertyAttributes & OBJC_PR_retain)
913 if (PropertyAttributes & OBJC_PR_copy)
915 if (PropertyAttributes & OBJC_PR_weak)
944 PropertyImplementation = pc;
956 PropertyIvarDecl = Ivar;
960 return PropertyIvarDecl;
991 void anchor()
override;
1000 llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>;
1049 llvm::iterator_range<specific_decl_iterator<ObjCMethodDecl>>;
1098 ObjCMethodDecl *getMethod(
Selector Sel,
bool isInstance,
1099 bool AllowHidden =
false)
const;
1102 bool AllowHidden =
false)
const {
1103 return getMethod(Sel,
true, AllowHidden);
1107 return getMethod(Sel,
false, AllowHidden);
1110 bool HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *
P)
const;
1119 ObjCPropertyDecl *>;
1132 ObjCContainerDeclBits.AtStart = Loc;
1141 return SourceRange(getAtStartLoc(), getAtEndRange().getEnd());
1148 return K >= firstObjCContainer &&
1149 K <= lastObjCContainer;
1192 mutable const Type *TypeForDecl =
nullptr;
1194 struct DefinitionData {
1221 mutable unsigned ExternallyCompleted : 1;
1225 mutable unsigned IvarListMissingImplementation : 1;
1229 unsigned HasDesignatedInitializers : 1;
1231 enum InheritedDesignatedInitializersState {
1240 IDI_NotInherited = 2
1244 mutable unsigned InheritedDesignatedInitializers : 2;
1252 : ExternallyCompleted(
false), IvarListMissingImplementation(
true),
1253 HasDesignatedInitializers(
false),
1254 InheritedDesignatedInitializers(IDI_Unknown) {}
1265 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
1272 void anchor()
override;
1274 void LoadExternalDefinition()
const;
1276 DefinitionData &data()
const {
1277 assert(Data.getPointer() &&
"Declaration has no definition!");
1278 return *Data.getPointer();
1282 void allocateDefinitionData();
1287 return getNextRedeclaration();
1291 return getPreviousDecl();
1295 return getMostRecentDecl();
1305 bool isInternal =
false);
1326 return TypeParamList;
1330 if (isThisDeclarationADefinition())
1333 return SourceRange(getAtStartLoc(), getLocation());
1339 void setExternallyCompleted();
1343 void setHasDesignatedInitializers();
1347 bool hasDesignatedInitializers()
const;
1352 return hasDesignatedInitializers() || inheritsDesignatedInitializers();
1356 assert(
hasDefinition() &&
"Caller did not check for forward reference!");
1357 if (data().ExternallyCompleted)
1358 LoadExternalDefinition();
1360 return data().ReferencedProtocols;
1373 return isInstance ? getCategoryInstanceMethod(Sel)
1374 : getCategoryClassMethod(Sel);
1389 if (data().ExternallyCompleted)
1390 LoadExternalDefinition();
1392 return data().ReferencedProtocols.begin();
1400 if (data().ExternallyCompleted)
1401 LoadExternalDefinition();
1403 return data().ReferencedProtocols.end();
1418 if (data().ExternallyCompleted)
1419 LoadExternalDefinition();
1421 return data().ReferencedProtocols.loc_begin();
1429 if (data().ExternallyCompleted)
1430 LoadExternalDefinition();
1432 return data().ReferencedProtocols.loc_end();
1440 all_referenced_protocol_end());
1448 if (data().ExternallyCompleted)
1449 LoadExternalDefinition();
1451 return data().AllReferencedProtocols.empty()
1453 : data().AllReferencedProtocols.begin();
1461 if (data().ExternallyCompleted)
1462 LoadExternalDefinition();
1464 return data().AllReferencedProtocols.empty()
1466 : data().AllReferencedProtocols.end();
1470 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
1508 data().ReferencedProtocols.set(List, Num, Locs, C);
1519 StringRef getObjCRuntimeNameAsString()
const;
1526 void getDesignatedInitializers(
1539 isDesignatedInitializer(
Selector Sel,
1554 if (!Data.getOpaqueValue())
1555 getMostRecentDecl();
1557 return Data.getPointer();
1564 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1571 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1576 void startDefinition();
1592 if (data().ExternallyCompleted)
1593 LoadExternalDefinition();
1595 return data().SuperClassTInfo;
1603 data().SuperClassTInfo = superClass;
1611 template<
bool (*Filter)(ObjCCategoryDecl *)>
1615 void findAcceptableCategory();
1626 : Current(Current) {
1627 findAcceptableCategory();
1643 return X.Current == Y.Current;
1648 return X.Current != Y.Current;
1665 llvm::iterator_range<visible_categories_iterator>;
1669 visible_categories_end());
1685 return visible_categories_begin() == visible_categories_end();
1699 llvm::iterator_range<known_categories_iterator>;
1703 known_categories_end());
1719 return known_categories_begin() == known_categories_end();
1735 llvm::iterator_range<visible_extensions_iterator>;
1739 visible_extensions_end());
1755 return visible_extensions_begin() == visible_extensions_end();
1773 llvm::iterator_range<known_extensions_iterator>;
1777 known_extensions_end());
1793 return known_extensions_begin() == known_extensions_end();
1803 if (data().ExternallyCompleted)
1804 LoadExternalDefinition();
1806 return data().CategoryList;
1812 data().CategoryList = category;
1819 void collectPropertiesToImplement(
PropertyMap &PM,
1826 while (I !=
nullptr) {
1837 bool isArcWeakrefUnavailable()
const;
1848 return lookupInstanceVariable(IVarName, ClassDeclared);
1856 bool shallowCategoryLookup =
false,
1857 bool followSuper =
true,
1862 return lookupMethod(Sel,
true);
1867 return lookupMethod(Sel,
false);
1874 bool Instance=
true)
const;
1877 return lookupPrivateMethod(Sel,
false);
1885 bool IsClassProperty)
const {
1886 return lookupMethod(Sel, !IsClassProperty,
1894 return getLocation();
1896 return data().EndLoc;
1908 return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
1915 bool lookupCategory,
1916 bool RHSIsQualifiedID =
false);
1921 using redeclarable_base::redecls_begin;
1922 using redeclarable_base::redecls_end;
1923 using redeclarable_base::redecls;
1924 using redeclarable_base::getPreviousDecl;
1925 using redeclarable_base::getMostRecentDecl;
1926 using redeclarable_base::isFirstDecl;
1941 bool inheritsDesignatedInitializers()
const;
1960 void anchor()
override;
1972 :
FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
1974 DeclAccess(ac), Synthesized(synthesized) {}
1982 bool synthesized=
false);
2021 unsigned DeclAccess : 3;
2022 unsigned Synthesized : 1;
2030 :
FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
2034 void anchor()
override;
2080 struct DefinitionData {
2093 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
2099 void anchor()
override;
2101 DefinitionData &data()
const {
2102 assert(Data.getPointer() &&
"Objective-C protocol has no definition!");
2103 return *Data.getPointer();
2106 void allocateDefinitionData();
2111 return getNextRedeclaration();
2115 return getPreviousDecl();
2119 return getMostRecentDecl();
2137 return data().ReferencedProtocols;
2151 return data().ReferencedProtocols.begin();
2158 return data().ReferencedProtocols.end();
2172 return data().ReferencedProtocols.loc_begin();
2179 return data().ReferencedProtocols.loc_end();
2186 return data().ReferencedProtocols.size();
2194 data().ReferencedProtocols.set(List, Num, Locs, C);
2204 return lookupMethod(Sel,
true);
2208 return lookupMethod(Sel,
false);
2217 if (!Data.getOpaqueValue())
2218 getMostRecentDecl();
2220 return Data.getPointer();
2225 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2230 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2240 void startDefinition();
2244 StringRef getObjCRuntimeNameAsString()
const;
2247 if (isThisDeclarationADefinition())
2250 return SourceRange(getAtStartLoc(), getLocation());
2256 using redeclarable_base::redecls_begin;
2257 using redeclarable_base::redecls_end;
2258 using redeclarable_base::redecls;
2259 using redeclarable_base::getPreviousDecl;
2260 using redeclarable_base::getMostRecentDecl;
2261 using redeclarable_base::isFirstDecl;
2267 void collectPropertiesToImplement(
PropertyMap &PM,
2322 void anchor()
override;
2360 ReferencedProtocols.
set(List, Num, Locs, C);
2364 return ReferencedProtocols;
2375 return ReferencedProtocols.
begin();
2393 return ReferencedProtocols.
loc_end();
2401 return NextClassCategory;
2407 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2424 return ivar_begin() == ivar_end();
2443 void anchor()
override;
2451 ClassInterface(classInterface) {}
2479 llvm::iterator_range<specific_decl_iterator<ObjCPropertyImplDecl>>;
2496 return K >= firstObjCImpl && K <= lastObjCImpl;
2521 :
ObjCImplDecl(ObjCCategoryImpl, DC, classInterface, Id,
2522 nameLoc, atStartLoc),
2523 CategoryNameLoc(CategoryNameLoc) {}
2525 void anchor()
override;
2578 unsigned NumIvarInitializers = 0;
2582 bool HasNonZeroConstructors : 1;
2585 bool HasDestructors : 1;
2597 nameLoc, atStartLoc),
2598 SuperClass(superDecl), SuperLoc(superLoc),
2599 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc),
2600 HasNonZeroConstructors(
false), HasDestructors(
false) {}
2602 void anchor()
override;
2636 const auto *ConstThis =
this;
2645 return init_begin() + NumIvarInitializers;
2650 return init_begin() + NumIvarInitializers;
2655 return NumIvarInitializers;
2659 NumIvarInitializers = numNumIvarInitializers;
2664 unsigned numInitializers);
2679 return getClassInterface()->getIdentifier();
2688 assert(
getIdentifier() &&
"Name is not a simple identifier");
2701 StringRef getObjCRuntimeNameAsString()
const;
2715 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2732 return ivar_begin() == ivar_end();
2749 :
NamedDecl(ObjCCompatibleAlias, DC, L, Id), AliasedClass(aliasedClass) {}
2751 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();
2875 return GetterCXXConstructor;
2879 GetterCXXConstructor = getterCXXConstructor;
2883 return SetterCXXAssignment;
2887 SetterCXXAssignment = setterCXXAssignment;
2894 template<
bool (*Filter)(ObjCCategoryDecl *)>
2898 while (Current && !
Filter(Current))
2899 Current = Current->getNextClassCategoryRaw();
2902 template<
bool (*Filter)(ObjCCategoryDecl *)>
2905 Current = Current->getNextClassCategoryRaw();
2906 findAcceptableCategory();
2924 #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
void setGetterMethodDecl(ObjCMethodDecl *MD)
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...
llvm::Optional< T > Optional
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
ObjCMethodDecl * getSetterMethodDecl() const
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
ObjCMethodDecl * getGetterMethodDecl() const
bool isDirectProperty() const
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.
bool isSynthesizedAccessorStub() const
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
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 setSetterMethodDecl(ObjCMethodDecl *MD)
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
bool LE(InterpState &S, CodePtr OpPC)
void setSynthesizedAccessorStub(bool isSynthesizedAccessorStub)
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.