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");
155 void *ParamsAndSelLocs =
nullptr;
156 unsigned NumParams = 0;
175 bool isVariadic =
false,
bool isPropertyAccessor =
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 isImplicitlyDeclared =
false,
bool isDefined =
false,
238 bool HasRelatedResultType =
false);
252 ObjCMethodDeclBits.objcDeclQualifier = QV;
258 return ObjCMethodDeclBits.RelatedResultType;
263 ObjCMethodDeclBits.RelatedResultType = RRT;
274 ObjCMethodDeclBits.HasRedeclaration = HRD;
291 return getBeginLoc();
292 return getSelectorLoc(0);
296 assert(Index < getNumSelectorLocs() &&
"Index out of range!");
297 if (hasStandardSelLocs())
302 return getStoredSelLocs()[Index];
362 return param_begin() + getSelector().getNumArgs();
368 return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
373 assert(Idx < NumParams &&
"Index out of bounds!");
374 return getParams()[Idx];
393 llvm::mapped_iterator<param_const_iterator, GetTypeFn>;
396 return llvm::map_iterator(param_begin(),
GetTypeFn());
400 return llvm::map_iterator(param_end(),
GetTypeFn());
412 bool &selfIsPseudoStrong,
bool &selfIsConsumed);
424 ObjCMethodDeclBits.IsInstance = isInst;
427 bool isVariadic()
const {
return ObjCMethodDeclBits.IsVariadic; }
428 void setVariadic(
bool isVar) { ObjCMethodDeclBits.IsVariadic = isVar; }
433 return ObjCMethodDeclBits.IsPropertyAccessor;
437 ObjCMethodDeclBits.IsPropertyAccessor = isAccessor;
440 bool isDefined()
const {
return ObjCMethodDeclBits.IsDefined; }
441 void setDefined(
bool isDefined) { ObjCMethodDeclBits.IsDefined = isDefined; }
451 void setOverriding(
bool IsOver) { ObjCMethodDeclBits.IsOverriding = IsOver; }
461 void getOverriddenMethods(
467 ObjCMethodDeclBits.HasSkippedBody = Skipped;
479 ObjCMethodDeclBits.DeclImplementation = ic;
487 return getImplementationControl() == Optional;
492 bool isThisDeclarationADesignatedInitializer()
const;
500 bool isDesignatedInitializerForTheInterface(
507 Stmt *getBody()
const override;
518 bool definedInNSObject(
const ASTContext &)
const;
564 unsigned Variance : 2;
580 Index(index), Variance(static_cast<unsigned>(variance)),
581 VarianceLoc(varianceLoc),
ColonLoc(colonLoc) {}
583 void anchor()
override;
608 Variance =
static_cast<unsigned>(variance);
640 struct PODSourceRange {
677 unsigned size()
const {
return NumParams; }
683 return getTrailingObjects<ObjCTypeParamDecl *>();
687 return begin() +
size();
691 assert(
size() > 0 &&
"empty Objective-C type parameter list");
696 assert(
size() > 0 &&
"empty Objective-C type parameter list");
709 return SourceRange(getLAngleLoc(), getRAngleLoc());
730 void anchor()
override;
734 OBJC_PR_noattr = 0x00,
735 OBJC_PR_readonly = 0x01,
736 OBJC_PR_getter = 0x02,
737 OBJC_PR_assign = 0x04,
738 OBJC_PR_readwrite = 0x08,
739 OBJC_PR_retain = 0x10,
741 OBJC_PR_nonatomic = 0x40,
742 OBJC_PR_setter = 0x80,
743 OBJC_PR_atomic = 0x100,
744 OBJC_PR_weak = 0x200,
745 OBJC_PR_strong = 0x400,
746 OBJC_PR_unsafe_unretained = 0x800,
749 OBJC_PR_nullability = 0x1000,
750 OBJC_PR_null_resettable = 0x2000,
751 OBJC_PR_class = 0x4000
757 NumPropertyAttrsBits = 15
772 unsigned PropertyAttributes : NumPropertyAttrsBits;
773 unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
776 unsigned PropertyImplementation : 2;
803 :
NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation),
804 LParenLoc(LParenLocation), DeclType(T), DeclTypeSourceInfo(TSI),
805 PropertyAttributes(OBJC_PR_noattr),
806 PropertyAttributesAsWritten(OBJC_PR_noattr),
807 PropertyImplementation(propControl), GetterName(
Selector()),
833 DeclTypeSourceInfo = TSI;
845 PropertyAttributes |= PRVal;
849 PropertyAttributes = PRVal;
857 PropertyAttributesAsWritten = PRVal;
864 return (PropertyAttributes & OBJC_PR_readonly);
869 return (PropertyAttributes & OBJC_PR_atomic);
874 return (PropertyAttributes &
875 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
895 if (PropertyAttributes & OBJC_PR_strong)
896 return getType()->isBlockPointerType() ? Copy : Retain;
897 if (PropertyAttributes & OBJC_PR_retain)
899 if (PropertyAttributes & OBJC_PR_copy)
901 if (PropertyAttributes & OBJC_PR_weak)
930 PropertyImplementation = pc;
938 return getPropertyImplementation() == PropertyControl::Optional;
942 PropertyIvarDecl = Ivar;
946 return PropertyIvarDecl;
977 void anchor()
override;
986 llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>;
1035 llvm::iterator_range<specific_decl_iterator<ObjCMethodDecl>>;
1084 ObjCMethodDecl *getMethod(
Selector Sel,
bool isInstance,
1085 bool AllowHidden =
false)
const;
1088 bool AllowHidden =
false)
const {
1089 return getMethod(Sel,
true, AllowHidden);
1093 return getMethod(Sel,
false, AllowHidden);
1096 bool HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *
P)
const;
1105 ObjCPropertyDecl *>;
1118 ObjCContainerDeclBits.AtStart = Loc;
1127 return SourceRange(getAtStartLoc(), getAtEndRange().getEnd());
1134 return K >= firstObjCContainer &&
1135 K <= lastObjCContainer;
1178 mutable const Type *TypeForDecl =
nullptr;
1180 struct DefinitionData {
1207 mutable unsigned ExternallyCompleted : 1;
1211 mutable unsigned IvarListMissingImplementation : 1;
1215 unsigned HasDesignatedInitializers : 1;
1217 enum InheritedDesignatedInitializersState {
1226 IDI_NotInherited = 2
1230 mutable unsigned InheritedDesignatedInitializers : 2;
1238 : ExternallyCompleted(
false), IvarListMissingImplementation(
true),
1239 HasDesignatedInitializers(
false),
1240 InheritedDesignatedInitializers(IDI_Unknown) {}
1251 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
1258 void anchor()
override;
1260 void LoadExternalDefinition()
const;
1262 DefinitionData &data()
const {
1263 assert(Data.getPointer() &&
"Declaration has no definition!");
1264 return *Data.getPointer();
1268 void allocateDefinitionData();
1273 return getNextRedeclaration();
1277 return getPreviousDecl();
1281 return getMostRecentDecl();
1291 bool isInternal =
false);
1312 return TypeParamList;
1316 if (isThisDeclarationADefinition())
1319 return SourceRange(getAtStartLoc(), getLocation());
1325 void setExternallyCompleted();
1329 void setHasDesignatedInitializers();
1333 bool hasDesignatedInitializers()
const;
1338 return hasDesignatedInitializers() || inheritsDesignatedInitializers();
1342 assert(
hasDefinition() &&
"Caller did not check for forward reference!");
1343 if (data().ExternallyCompleted)
1344 LoadExternalDefinition();
1346 return data().ReferencedProtocols;
1359 return isInstance ? getCategoryInstanceMethod(Sel)
1360 : getCategoryClassMethod(Sel);
1375 if (data().ExternallyCompleted)
1376 LoadExternalDefinition();
1378 return data().ReferencedProtocols.begin();
1386 if (data().ExternallyCompleted)
1387 LoadExternalDefinition();
1389 return data().ReferencedProtocols.end();
1404 if (data().ExternallyCompleted)
1405 LoadExternalDefinition();
1407 return data().ReferencedProtocols.loc_begin();
1415 if (data().ExternallyCompleted)
1416 LoadExternalDefinition();
1418 return data().ReferencedProtocols.loc_end();
1426 all_referenced_protocol_end());
1434 if (data().ExternallyCompleted)
1435 LoadExternalDefinition();
1437 return data().AllReferencedProtocols.empty()
1439 : data().AllReferencedProtocols.begin();
1447 if (data().ExternallyCompleted)
1448 LoadExternalDefinition();
1450 return data().AllReferencedProtocols.empty()
1452 : data().AllReferencedProtocols.end();
1456 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
1494 data().ReferencedProtocols.set(List, Num, Locs, C);
1505 StringRef getObjCRuntimeNameAsString()
const;
1512 void getDesignatedInitializers(
1525 isDesignatedInitializer(
Selector Sel,
1540 if (!Data.getOpaqueValue())
1541 getMostRecentDecl();
1543 return Data.getPointer();
1550 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1557 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
1562 void startDefinition();
1578 if (data().ExternallyCompleted)
1579 LoadExternalDefinition();
1581 return data().SuperClassTInfo;
1589 data().SuperClassTInfo = superClass;
1597 template<
bool (*Filter)(ObjCCategoryDecl *)>
1601 void findAcceptableCategory();
1612 : Current(Current) {
1613 findAcceptableCategory();
1629 return X.Current == Y.Current;
1634 return X.Current != Y.Current;
1651 llvm::iterator_range<visible_categories_iterator>;
1655 visible_categories_end());
1671 return visible_categories_begin() == visible_categories_end();
1685 llvm::iterator_range<known_categories_iterator>;
1689 known_categories_end());
1705 return known_categories_begin() == known_categories_end();
1721 llvm::iterator_range<visible_extensions_iterator>;
1725 visible_extensions_end());
1741 return visible_extensions_begin() == visible_extensions_end();
1759 llvm::iterator_range<known_extensions_iterator>;
1763 known_extensions_end());
1779 return known_extensions_begin() == known_extensions_end();
1789 if (data().ExternallyCompleted)
1790 LoadExternalDefinition();
1792 return data().CategoryList;
1798 data().CategoryList = category;
1805 void collectPropertiesToImplement(
PropertyMap &PM,
1812 while (I !=
nullptr) {
1823 bool isArcWeakrefUnavailable()
const;
1834 return lookupInstanceVariable(IVarName, ClassDeclared);
1842 bool shallowCategoryLookup =
false,
1843 bool followSuper =
true,
1848 return lookupMethod(Sel,
true);
1853 return lookupMethod(Sel,
false);
1860 bool Instance=
true)
const;
1863 return lookupPrivateMethod(Sel,
false);
1871 bool IsClassProperty)
const {
1872 return lookupMethod(Sel, !IsClassProperty,
1880 return getLocation();
1882 return data().EndLoc;
1894 return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
1901 bool lookupCategory,
1902 bool RHSIsQualifiedID =
false);
1907 using redeclarable_base::redecls_begin;
1908 using redeclarable_base::redecls_end;
1909 using redeclarable_base::redecls;
1910 using redeclarable_base::getPreviousDecl;
1911 using redeclarable_base::getMostRecentDecl;
1912 using redeclarable_base::isFirstDecl;
1927 bool inheritsDesignatedInitializers()
const;
1946 void anchor()
override;
1958 :
FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
1960 DeclAccess(ac), Synthesized(synthesized) {}
1968 bool synthesized=
false);
2007 unsigned DeclAccess : 3;
2008 unsigned Synthesized : 1;
2016 :
FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
2020 void anchor()
override;
2066 struct DefinitionData {
2079 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
2085 void anchor()
override;
2087 DefinitionData &data()
const {
2088 assert(Data.getPointer() &&
"Objective-C protocol has no definition!");
2089 return *Data.getPointer();
2092 void allocateDefinitionData();
2097 return getNextRedeclaration();
2101 return getPreviousDecl();
2105 return getMostRecentDecl();
2123 return data().ReferencedProtocols;
2137 return data().ReferencedProtocols.begin();
2144 return data().ReferencedProtocols.end();
2158 return data().ReferencedProtocols.loc_begin();
2165 return data().ReferencedProtocols.loc_end();
2172 return data().ReferencedProtocols.size();
2180 data().ReferencedProtocols.set(List, Num, Locs, C);
2190 return lookupMethod(Sel,
true);
2194 return lookupMethod(Sel,
false);
2203 if (!Data.getOpaqueValue())
2204 getMostRecentDecl();
2206 return Data.getPointer();
2211 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2216 return hasDefinition()? Data.getPointer()->Definition :
nullptr;
2226 void startDefinition();
2230 StringRef getObjCRuntimeNameAsString()
const;
2233 if (isThisDeclarationADefinition())
2236 return SourceRange(getAtStartLoc(), getLocation());
2242 using redeclarable_base::redecls_begin;
2243 using redeclarable_base::redecls_end;
2244 using redeclarable_base::redecls;
2245 using redeclarable_base::getPreviousDecl;
2246 using redeclarable_base::getMostRecentDecl;
2247 using redeclarable_base::isFirstDecl;
2253 void collectPropertiesToImplement(
PropertyMap &PM,
2308 void anchor()
override;
2346 ReferencedProtocols.
set(List, Num, Locs, C);
2350 return ReferencedProtocols;
2361 return ReferencedProtocols.
begin();
2379 return ReferencedProtocols.
loc_end();
2387 return NextClassCategory;
2393 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2410 return ivar_begin() == ivar_end();
2429 void anchor()
override;
2437 ClassInterface(classInterface) {}
2465 llvm::iterator_range<specific_decl_iterator<ObjCPropertyImplDecl>>;
2482 return K >= firstObjCImpl && K <= lastObjCImpl;
2507 :
ObjCImplDecl(ObjCCategoryImpl, DC, classInterface, Id,
2508 nameLoc, atStartLoc),
2509 CategoryNameLoc(CategoryNameLoc) {}
2511 void anchor()
override;
2564 unsigned NumIvarInitializers = 0;
2568 bool HasNonZeroConstructors : 1;
2571 bool HasDestructors : 1;
2583 nameLoc, atStartLoc),
2584 SuperClass(superDecl), SuperLoc(superLoc),
2585 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc),
2586 HasNonZeroConstructors(
false), HasDestructors(
false) {}
2588 void anchor()
override;
2622 const auto *ConstThis =
this;
2631 return init_begin() + NumIvarInitializers;
2636 return init_begin() + NumIvarInitializers;
2641 return NumIvarInitializers;
2645 NumIvarInitializers = numNumIvarInitializers;
2650 unsigned numInitializers);
2665 return getClassInterface()->getIdentifier();
2674 assert(
getIdentifier() &&
"Name is not a simple identifier");
2687 StringRef getObjCRuntimeNameAsString()
const;
2701 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2718 return ivar_begin() == ivar_end();
2735 :
NamedDecl(ObjCCompatibleAlias, DC, L, Id), AliasedClass(aliasedClass) {}
2737 void anchor()
override;
2785 Expr *GetterCXXConstructor =
nullptr;
2789 Expr *SetterCXXAssignment =
nullptr;
2796 :
Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc),
2797 IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl) {
2798 assert(PK == Dynamic || PropertyIvarDecl);
2819 return PropertyDecl;
2824 return PropertyIvarDecl ? Synthesize : Dynamic;
2828 return PropertyIvarDecl;
2834 PropertyIvarDecl = Ivar;
2835 this->IvarLoc = IvarLoc;
2846 return IvarLoc.
isValid() && IvarLoc != getLocation();
2850 return GetterCXXConstructor;
2854 GetterCXXConstructor = getterCXXConstructor;
2858 return SetterCXXAssignment;
2862 SetterCXXAssignment = setterCXXAssignment;
2869 template<
bool (*Filter)(ObjCCategoryDecl *)>
2873 while (Current && !
Filter(Current))
2874 Current = Current->getNextClassCategoryRaw();
2877 template<
bool (*Filter)(ObjCCategoryDecl *)>
2880 Current = Current->getNextClassCategoryRaw();
2881 findAcceptableCategory();
2899 #endif // LLVM_CLANG_AST_DECLOBJC_H llvm::iterator_range< param_const_iterator > param_const_range
known_extensions_iterator known_extensions_begin() const
Retrieve an iterator to the beginning of the known-extensions list.
SourceLocation getGetterNameLoc() const
void setCategoryNameLoc(SourceLocation Loc)
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or with a spac...
ObjCMethodDecl * lookupPrivateClassMethod(const Selector &Sel)
bool hasDefinition() const
Determine whether this class has been defined.
ObjCPropertyQueryKind getQueryKind() const
llvm::iterator_range< visible_categories_iterator > visible_categories_range
const Type * getTypeForDecl() const
bool isClassMethod() const
static const Decl * getCanonicalDecl(const Decl *D)
unsigned ivar_size() const
param_type_iterator param_type_end() const
void setEndOfDefinitionLoc(SourceLocation LE)
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
propimpl_iterator propimpl_end() const
llvm::iterator_range< redecl_iterator > redecl_range
protocol_range protocols() const
Smart pointer class that efficiently represents Objective-C method names.
const ObjCInterfaceDecl * getDefinition() const
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
ObjCListBase & operator=(const ObjCListBase &)=delete
A (possibly-)qualified type.
visible_extensions_iterator visible_extensions_begin() const
Retrieve an iterator to the beginning of the visible-extensions list.
static bool classof(const Decl *D)
unsigned param_size() const
ObjCInterfaceDecl * getClassInterface()
all_protocol_range all_referenced_protocols() const
llvm::iterator_range< init_const_iterator > init_const_range
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
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
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.
PropertyAttributeKind getPropertyAttributes() const
protocol_loc_iterator protocol_loc_end() const
void setSuperClass(ObjCInterfaceDecl *superCls)
void setLazyBody(uint64_t Offset)
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
void setClassInterface(ObjCInterfaceDecl *D)
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Lookup a class method for a given selector.
SourceLocation getPropertyIvarDeclLoc() const
CompoundStmt * getCompoundBody()
Represents an Objective-C protocol declaration.
filtered_category_iterator operator++(int)
ObjCInterfaceDecl * getSuperClass()
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
void addInstanceMethod(ObjCMethodDecl *method)
PropertyControl getPropertyImplementation() const
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Represents an ObjC class declaration.
QualType getReturnType() const
all_protocol_iterator all_referenced_protocol_end() const
ObjCInterfaceDecl * getClassInterface()
bool isAtomic() const
isAtomic - Return true if the property is atomic.
SourceLocation getAtStartLoc() const
bool isInstanceProperty() const
void setGetterCXXConstructor(Expr *getterCXXConstructor)
Iterator that walks over the list of categories, filtering out those that do not meet specific criter...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
visible_categories_iterator visible_categories_end() const
Retrieve an iterator to the end of the visible-categories list.
void setVariadic(bool isVar)
classprop_iterator classprop_begin() const
protocol_loc_range protocol_locs() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
visible_extensions_range visible_extensions() const
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
void setHasDestructors(bool val)
void setIvarRBraceLoc(SourceLocation Loc)
unsigned ivar_size() const
static bool classofKind(Kind K)
void setNextIvar(ObjCIvarDecl *ivar)
bool hasDefinition() const
Determine whether this protocol has a definition.
void setSynthesize(bool synth)
void setType(QualType T, TypeSourceInfo *TSI)
classprop_range class_properties() const
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
ObjCTypeParamDecl *const * const_iterator
This represents one expression.
ivar_iterator ivar_end() const
known_extensions_range known_extensions() const
Selector getSetterName() const
static bool classof(const Decl *D)
ivar_iterator ivar_begin() const
TypeSourceInfo * getSuperClassTInfo() const
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
static bool classof(const Decl *D)
TypeSourceInfo * getTypeSourceInfo() const
const T * castAs() const
Member-template castAs<specific type>.
param_iterator param_end()
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
SourceLocation getStandardSelectorLoc(unsigned Index, Selector Sel, bool WithArgSpace, ArrayRef< Expr *> Args, SourceLocation EndLoc)
Get the "standard" location of a selector identifier, e.g: For nullary selectors, immediately before ...
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
SourceLocation getSelectorStartLoc() const
void setAtEndRange(SourceRange atEnd)
propimpl_iterator propimpl_begin() const
bool known_categories_empty() const
Determine whether the known-categories list is empty.
void setRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
redeclarable_base::redecl_iterator redecl_iterator
loc_iterator loc_end() const
void addClassMethod(ObjCMethodDecl *method)
ObjCInterfaceDecl * getSuperClass() const
void setDefined(bool isDefined)
ParmVarDecl *const * param_iterator
protocol_loc_iterator protocol_loc_begin() const
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
protocol_loc_iterator protocol_loc_end() const
propimpl_range property_impls() const
const_iterator begin() const
static bool classofKind(Kind K)
llvm::SmallDenseSet< const ObjCProtocolDecl *, 8 > ProtocolPropertySet
reference operator*() const
static bool classof(const Decl *D)
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
bool isInstanceMethod() const
static DeclContext * castToDeclContext(const ObjCContainerDecl *D)
static bool classof(const Decl *D)
unsigned getNumArgs() const
void setIvarRBraceLoc(SourceLocation Loc)
void setIsRedeclaration(bool RD)
Selector getSelector() const
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
ImplicitParamDecl * getSelfDecl() const
llvm::iterator_range< known_extensions_iterator > known_extensions_range
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
void setHasSkippedBody(bool Skipped=true)
static StringRef getIdentifier(const Token &Tok)
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
ObjCProtocolList::iterator protocol_iterator
filtered_category_iterator(ObjCCategoryDecl *Current)
llvm::iterator_range< instprop_iterator > instprop_range
protocol_loc_range protocol_locs() const
TypeSourceInfo * getReturnTypeSourceInfo() const
PODSourceRange Brackets
Location of the left and right angle brackets.
unsigned protocol_size() const
const ObjCIvarDecl * all_declared_ivar_begin() const
ivar_iterator ivar_end() const
ivar_iterator ivar_begin() const
classmeth_iterator classmeth_end() const
const ObjCInterfaceDecl * getClassInterface() const
Encodes a location in the source.
bool getSynthesize() const
ivar_iterator ivar_end() const
ObjCProtocolList::iterator protocol_iterator
clang::ObjCProtocolDecl *const * iterator
SourceLocation getSuperClassLoc() const
void setIvarLBraceLoc(SourceLocation Loc)
void setAtStartLoc(SourceLocation Loc)
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
static bool classof(const Decl *D)
void setObjCDeclQualifier(ObjCDeclQualifier QV)
SourceLocation getCategoryNameLoc() const
ObjCList - This is a simple template class used to hold various lists of decls etc, which is heavily used by the ObjC front-end.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCTypeParamDecl * front() const
ObjCCategoryDecl - Represents a category declaration.
llvm::iterator_range< specific_decl_iterator< ObjCPropertyImplDecl > > propimpl_range
void setOverriding(bool IsOver)
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Represents one property declaration in an Objective-C interface.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCMethodDecl * lookupPropertyAccessor(const Selector Sel, const ObjCCategoryDecl *Cat, bool IsClassProperty) const
Lookup a setter or getter in the class hierarchy, including in all categories except for category pas...
bool isIvarNameSpecified() const
For @synthesize, returns true if an ivar name was explicitly specified.
param_type_iterator param_type_begin() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
ObjCDeclQualifier getObjCDeclQualifier() const
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
prop_iterator prop_end() const
classmeth_iterator classmeth_begin() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
__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
static bool isInstanceMethod(const Decl *D)
instprop_iterator instprop_begin() const
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName)
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
void setInstanceMethod(bool isInst)
void setHasRedeclaration(bool HRD) const
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getPropertyIvarDecl() const
void setReturnTypeSourceInfo(TypeSourceInfo *TInfo)
ObjCCategoryDecl * getNextClassCategory() const
void setIvarLBraceLoc(SourceLocation Loc)
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
ImplicitParamDecl * getCmdDecl() const
void setPropertyAttributes(PropertyAttributeKind PRVal)
protocol_iterator protocol_end() const
param_const_iterator sel_param_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classofKind(Kind K)
unsigned protocol_size() const
Kind
Lists the kind of concrete classes of Decl.
StringRef getName() const
getName - Get the name of identifier for the class interface associated with this implementation as a...
static ObjCPropertyQueryKind getQueryKind(bool isClassProperty)
known_extensions_iterator known_extensions_end() const
Retrieve an iterator to the end of the known-extensions list.
ObjCPropertyDecl * getPropertyDecl() const
bool visible_categories_empty() const
Determine whether the visible-categories list is empty.
SourceLocation getRAngleLoc() const
void setAtLoc(SourceLocation Loc)
llvm::iterator_range< specific_decl_iterator< ObjCPropertyDecl > > prop_range
protocol_loc_iterator protocol_loc_begin() const
static bool classof(const Decl *D)
A trivial tuple used to represent a source range.
instmeth_iterator instmeth_begin() const
void setLexicalDeclContext(DeclContext *DC)
ObjCMethodDecl * getGetterMethodDecl() const
known_categories_iterator known_categories_begin() const
Retrieve an iterator to the beginning of the known-categories list.
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
This represents a decl that may have a name.
static bool classof(const Decl *D)
void setVariance(ObjCTypeParamVariance variance)
Set the variance of this type parameter.
protocol_loc_iterator protocol_loc_begin() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
AccessControl getAccessControl() const
SourceLocation getIvarRBraceLoc() const
static bool classofKind(Kind K)
ivar_iterator ivar_begin() const
bool isPropertyAccessor() const
Selector getGetterName() const
SourceLocation getLParenLoc() const
SourceLocation getEndOfDefinitionLoc() const
bool visible_extensions_empty() const
Determine whether the visible-extensions list is empty.
protocol_loc_iterator protocol_loc_end() const
void setTypeForDecl(const Type *TD) const
SourceLocation getLAngleLoc() const
ObjCProtocolList::iterator protocol_iterator
SourceLocation ColonLoc
Location of ':'.
ParmVarDecl * getParamDecl(unsigned Idx)
unsigned getNumIvarInitializers() const
getNumArgs - Number of ivars which must be initialized.
unsigned size() const
Determine the number of type parameters in this list.
void setCmdDecl(ImplicitParamDecl *CD)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
The parameter is invariant: must match exactly.
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
ArrayRef< ParmVarDecl * > parameters() const
ObjCCompatibleAliasDecl - Represents alias of a class.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.