clang 8.0.0

DeclObjC.h
Go to the documentation of this file.
1 //===- DeclObjC.h - Classes for representing declarations -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the DeclObjC interface and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_AST_DECLOBJC_H
15 #define LLVM_CLANG_AST_DECLOBJC_H
16
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclBase.h"
19 #include "clang/AST/ExternalASTSource.h"
20 #include "clang/AST/Redeclarable.h"
21 #include "clang/AST/SelectorLocationsKind.h"
22 #include "clang/AST/Type.h"
23 #include "clang/Basic/IdentifierTable.h"
24 #include "clang/Basic/LLVM.h"
25 #include "clang/Basic/SourceLocation.h"
26 #include "clang/Basic/Specifiers.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"
37 #include <cassert>
38 #include <cstddef>
39 #include <cstdint>
40 #include <iterator>
41 #include <string>
42 #include <utility>
43
44 namespace clang {
45
46 class ASTContext;
47 class CompoundStmt;
48 class CXXCtorInitializer;
49 class Expr;
50 class ObjCCategoryDecl;
51 class ObjCCategoryImplDecl;
52 class ObjCImplementationDecl;
53 class ObjCInterfaceDecl;
54 class ObjCIvarDecl;
55 class ObjCPropertyDecl;
56 class ObjCPropertyImplDecl;
57 class ObjCProtocolDecl;
58 class Stmt;
59
60 class ObjCListBase {
61 protected:
62 /// List is an array of pointers to objects that are not owned by this object.
63 void **List = nullptr;
64 unsigned NumElts = 0;
65
66 public:
67 ObjCListBase() = default;
68 ObjCListBase(const ObjCListBase &) = delete;
69 ObjCListBase &operator=(const ObjCListBase &) = delete;
70
71 unsigned size() const { return NumElts; }
72 bool empty() const { return NumElts == 0; }
73
74 protected:
75 void set(void *const* InList, unsigned Elts, ASTContext &Ctx);
76 };
77
78 /// ObjCList - This is a simple template class used to hold various lists of
79 /// decls etc, which is heavily used by the ObjC front-end. This only use case
80 /// this supports is setting the list all at once and then reading elements out
81 /// of it.
82 template <typename T>
83 class ObjCList : public ObjCListBase {
84 public:
85 void set(T* const* InList, unsigned Elts, ASTContext &Ctx) {
86 ObjCListBase::set(reinterpret_cast<void*const*>(InList), Elts, Ctx);
87 }
88
89 using iterator = T* const *;
90
91 iterator begin() const { return (iterator)List; }
92 iterator end() const { return (iterator)List+NumElts; }
93
94 T* operator[](unsigned Idx) const {
95 assert(Idx < NumElts && "Invalid access");
96 return (T*)List[Idx];
97 }
98 };
99
100 /// A list of Objective-C protocols, along with the source
101 /// locations at which they were referenced.
102 class ObjCProtocolList : public ObjCList<ObjCProtocolDecl> {
103 SourceLocation *Locations = nullptr;
104
105 using ObjCList<ObjCProtocolDecl>::set;
106
107 public:
108 ObjCProtocolList() = default;
109
110 using loc_iterator = const SourceLocation *;
111
112 loc_iterator loc_begin() const { return Locations; }
113 loc_iterator loc_end() const { return Locations + size(); }
114
115 void set(ObjCProtocolDecl* const* InList, unsigned Elts,
116 const SourceLocation *Locs, ASTContext &Ctx);
117 };
118
119 /// ObjCMethodDecl - Represents an instance or class method declaration.
120 /// ObjC methods can be declared within 4 contexts: class interfaces,
121 /// categories, protocols, and class implementations. While C++ member
122 /// functions leverage C syntax, Objective-C method syntax is modeled after
123 /// Smalltalk (using colons to specify argument types/expressions).
124 /// Here are some brief examples:
125 ///
126 /// Setter/getter instance methods:
127 /// - (void)setMenu:(NSMenu *)menu;
128 /// - (NSMenu *)menu;
129 ///
130 /// Instance method that takes 2 NSView arguments:
131 /// - (void)replaceSubview:(NSView *)oldView with:(NSView *)newView;
132 ///
133 /// Getter class method:
134 /// + (NSMenu *)defaultMenu;
135 ///
136 /// A selector represents a unique name for a method. The selector names for
137 /// the above methods are setMenu:, menu, replaceSubview:with:, and defaultMenu.
138 ///
139 class ObjCMethodDecl : public NamedDecl, public DeclContext {
140 // This class stores some data in DeclContext::ObjCMethodDeclBits
141 // to save some space. Use the provided accessors to access it.
142
143 public:
144 enum ImplementationControl { None, Required, Optional };
145
146 private:
147 /// Return type of this method.
148 QualType MethodDeclType;
149
150 /// Type source information for the return type.
151 TypeSourceInfo *ReturnTInfo;
152
153 /// Array of ParmVarDecls for the formal parameters of this method
154 /// and optionally followed by selector locations.
155 void *ParamsAndSelLocs = nullptr;
156 unsigned NumParams = 0;
157
158 /// List of attributes for this method declaration.
159 SourceLocation DeclEndLoc; // the location of the ';' or '{'.
160
161 /// The following are only used for method definitions, null otherwise.
162 LazyDeclStmtPtr Body;
163
164 /// SelfDecl - Decl for the implicit self parameter. This is lazily
165 /// constructed by createImplicitParams.
166 ImplicitParamDecl *SelfDecl = nullptr;
167
168 /// CmdDecl - Decl for the implicit _cmd parameter. This is lazily
169 /// constructed by createImplicitParams.
170 ImplicitParamDecl *CmdDecl = nullptr;
171
172 ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc,
173 Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
174 DeclContext *contextDecl, bool isInstance = true,
175 bool isVariadic = false, bool isPropertyAccessor = false,
176 bool isImplicitlyDeclared = false, bool isDefined = false,
177 ImplementationControl impControl = None,
178 bool HasRelatedResultType = false);
179
180 SelectorLocationsKind getSelLocsKind() const {
181 return static_cast<SelectorLocationsKind>(ObjCMethodDeclBits.SelLocsKind);
182 }
183
184 void setSelLocsKind(SelectorLocationsKind Kind) {
185 ObjCMethodDeclBits.SelLocsKind = Kind;
186 }
187
188 bool hasStandardSelLocs() const {
189 return getSelLocsKind() != SelLoc_NonStandard;
190 }
191
192 /// Get a pointer to the stored selector identifiers locations array.
193 /// No locations will be stored if HasStandardSelLocs is true.
194 SourceLocation *getStoredSelLocs() {
195 return reinterpret_cast<SourceLocation *>(getParams() + NumParams);
196 }
197 const SourceLocation *getStoredSelLocs() const {
198 return reinterpret_cast<const SourceLocation *>(getParams() + NumParams);
199 }
200
201 /// Get a pointer to the stored selector identifiers locations array.
202 /// No locations will be stored if HasStandardSelLocs is true.
203 ParmVarDecl **getParams() {
204 return reinterpret_cast<ParmVarDecl **>(ParamsAndSelLocs);
205 }
206 const ParmVarDecl *const *getParams() const {
207 return reinterpret_cast<const ParmVarDecl *const *>(ParamsAndSelLocs);
208 }
209
210 /// Get the number of stored selector identifiers locations.
211 /// No locations will be stored if HasStandardSelLocs is true.
212 unsigned getNumStoredSelLocs() const {
213 if (hasStandardSelLocs())
214 return 0;
215 return getNumSelectorLocs();
216 }
217
218 void setParamsAndSelLocs(ASTContext &C,
219 ArrayRef<ParmVarDecl*> Params,
220 ArrayRef<SourceLocation> SelLocs);
221
222 /// A definition will return its interface declaration.
223 /// An interface declaration will return its definition.
224 /// Otherwise it will return itself.
225 ObjCMethodDecl *getNextRedeclarationImpl() override;
226
227 public:
228 friend class ASTDeclReader;
229 friend class ASTDeclWriter;
230
231 static ObjCMethodDecl *
232 Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc,
233 Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
234 DeclContext *contextDecl, bool isInstance = true,
235 bool isVariadic = false, bool isPropertyAccessor = false,
236 bool isImplicitlyDeclared = false, bool isDefined = false,
237 ImplementationControl impControl = None,
238 bool HasRelatedResultType = false);
239
240 static ObjCMethodDecl *CreateDeserialized(ASTContext &C, unsigned ID);
241
242 ObjCMethodDecl *getCanonicalDecl() override;
243 const ObjCMethodDecl *getCanonicalDecl() const {
244 return const_cast<ObjCMethodDecl*>(this)->getCanonicalDecl();
245 }
246
247 ObjCDeclQualifier getObjCDeclQualifier() const {
248 return static_cast<ObjCDeclQualifier>(ObjCMethodDeclBits.objcDeclQualifier);
249 }
250
251 void setObjCDeclQualifier(ObjCDeclQualifier QV) {
252 ObjCMethodDeclBits.objcDeclQualifier = QV;
253 }
254
255 /// Determine whether this method has a result type that is related
256 /// to the message receiver's type.
257 bool hasRelatedResultType() const {
258 return ObjCMethodDeclBits.RelatedResultType;
259 }
260
261 /// Note whether this method has a related result type.
262 void setRelatedResultType(bool RRT = true) {
263 ObjCMethodDeclBits.RelatedResultType = RRT;
264 }
265
266 /// True if this is a method redeclaration in the same interface.
267 bool isRedeclaration() const { return ObjCMethodDeclBits.IsRedeclaration; }
268 void setIsRedeclaration(bool RD) { ObjCMethodDeclBits.IsRedeclaration = RD; }
269 void setAsRedeclaration(const ObjCMethodDecl *PrevMethod);
270
271 /// True if redeclared in the same interface.
272 bool hasRedeclaration() const { return ObjCMethodDeclBits.HasRedeclaration; }
273 void setHasRedeclaration(bool HRD) const {
274 ObjCMethodDeclBits.HasRedeclaration = HRD;
275 }
276
277 /// Returns the location where the declarator ends. It will be
278 /// the location of ';' for a method declaration and the location of '{'
279 /// for a method definition.
280 SourceLocation getDeclaratorEndLoc() const { return DeclEndLoc; }
281
282 // Location information, modeled after the Stmt API.
283 SourceLocation getBeginLoc() const LLVM_READONLY { return getLocation(); }
284 SourceLocation getEndLoc() const LLVM_READONLY;
285 SourceRange getSourceRange() const override LLVM_READONLY {
286 return SourceRange(getLocation(), getEndLoc());
287 }
288
289 SourceLocation getSelectorStartLoc() const {
290 if (isImplicit())
291 return getBeginLoc();
292 return getSelectorLoc(0);
293 }
294
295 SourceLocation getSelectorLoc(unsigned Index) const {
296 assert(Index < getNumSelectorLocs() && "Index out of range!");
297 if (hasStandardSelLocs())
298 return getStandardSelectorLoc(Index, getSelector(),
299 getSelLocsKind() == SelLoc_StandardWithSpace,
300 parameters(),
301 DeclEndLoc);
302 return getStoredSelLocs()[Index];
303 }
304
305 void getSelectorLocs(SmallVectorImpl<SourceLocation> &SelLocs) const;
306
307 unsigned getNumSelectorLocs() const {
308 if (isImplicit())
309 return 0;
310 Selector Sel = getSelector();
311 if (Sel.isUnarySelector())
312 return 1;
313 return Sel.getNumArgs();
314 }
315
316 ObjCInterfaceDecl *getClassInterface();
317 const ObjCInterfaceDecl *getClassInterface() const {
318 return const_cast<ObjCMethodDecl*>(this)->getClassInterface();
319 }
320
321 Selector getSelector() const { return getDeclName().getObjCSelector(); }
322
323 QualType getReturnType() const { return MethodDeclType; }
324 void setReturnType(QualType T) { MethodDeclType = T; }
325 SourceRange getReturnTypeSourceRange() const;
326
327 /// Determine the type of an expression that sends a message to this
328 /// function. This replaces the type parameters with the types they would
329 /// get if the receiver was parameterless (e.g. it may replace the type
330 /// parameter with 'id').
331 QualType getSendResultType() const;
332
333 /// Determine the type of an expression that sends a message to this
334 /// function with the given receiver type.
335 QualType getSendResultType(QualType receiverType) const;
336
337 TypeSourceInfo *getReturnTypeSourceInfo() const { return ReturnTInfo; }
338 void setReturnTypeSourceInfo(TypeSourceInfo *TInfo) { ReturnTInfo = TInfo; }
339
340 // Iterator access to formal parameters.
341 unsigned param_size() const { return NumParams; }
342
343 using param_const_iterator = const ParmVarDecl *const *;
344 using param_iterator = ParmVarDecl *const *;
345 using param_range = llvm::iterator_range<param_iterator>;
346 using param_const_range = llvm::iterator_range<param_const_iterator>;
347
348 param_const_iterator param_begin() const {
349 return param_const_iterator(getParams());
350 }
351
352 param_const_iterator param_end() const {
353 return param_const_iterator(getParams() + NumParams);
354 }
355
356 param_iterator param_begin() { return param_iterator(getParams()); }
357 param_iterator param_end() { return param_iterator(getParams() + NumParams); }
358
359 // This method returns and of the parameters which are part of the selector
360 // name mangling requirements.
361 param_const_iterator sel_param_end() const {
362 return param_begin() + getSelector().getNumArgs();
363 }
364
365 // ArrayRef access to formal parameters. This should eventually
366 // replace the iterator interface above.
367 ArrayRef<ParmVarDecl*> parameters() const {
368 return llvm::makeArrayRef(const_cast<ParmVarDecl**>(getParams()),
369 NumParams);
370 }
371
372 ParmVarDecl *getParamDecl(unsigned Idx) {
373 assert(Idx < NumParams && "Index out of bounds!");
374 return getParams()[Idx];
375 }
376 const ParmVarDecl *getParamDecl(unsigned Idx) const {
377 return const_cast<ObjCMethodDecl *>(this)->getParamDecl(Idx);
378 }
379
380 /// Sets the method's parameters and selector source locations.
381 /// If the method is implicit (not coming from source) \p SelLocs is
382 /// ignored.
383 void setMethodParams(ASTContext &C,
384 ArrayRef<ParmVarDecl*> Params,
385 ArrayRef<SourceLocation> SelLocs = llvm::None);
386
387 // Iterator access to parameter types.
388 struct GetTypeFn {
389 QualType operator()(const ParmVarDecl *PD) const { return PD->getType(); }
390 };
391
392 using param_type_iterator =
393 llvm::mapped_iterator<param_const_iterator, GetTypeFn>;
394
395 param_type_iterator param_type_begin() const {
396 return llvm::map_iterator(param_begin(), GetTypeFn());
397 }
398
399 param_type_iterator param_type_end() const {
400 return llvm::map_iterator(param_end(), GetTypeFn());
401 }
402
403 /// createImplicitParams - Used to lazily create the self and cmd
404 /// implict parameters. This must be called prior to using getSelfDecl()
405 /// or getCmdDecl(). The call is ignored if the implicit parameters
406 /// have already been created.
407 void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID);
408
409 /// \return the type for \c self and set \arg selfIsPseudoStrong and
410 /// \arg selfIsConsumed accordingly.
411 QualType getSelfType(ASTContext &Context, const ObjCInterfaceDecl *OID,
412 bool &selfIsPseudoStrong, bool &selfIsConsumed);
413
414 ImplicitParamDecl * getSelfDecl() const { return SelfDecl; }
415 void setSelfDecl(ImplicitParamDecl *SD) { SelfDecl = SD; }
416 ImplicitParamDecl * getCmdDecl() const { return CmdDecl; }
417 void setCmdDecl(ImplicitParamDecl *CD) { CmdDecl = CD; }
418
419 /// Determines the family of this method.
420 ObjCMethodFamily getMethodFamily() const;
421
422 bool isInstanceMethod() const { return ObjCMethodDeclBits.IsInstance; }
423 void setInstanceMethod(bool isInst) {
424 ObjCMethodDeclBits.IsInstance = isInst;
425 }
426
427 bool isVariadic() const { return ObjCMethodDeclBits.IsVariadic; }
428 void setVariadic(bool isVar) { ObjCMethodDeclBits.IsVariadic = isVar; }
429
430 bool isClassMethod() const { return !isInstanceMethod(); }
431
432 bool isPropertyAccessor() const {
433 return ObjCMethodDeclBits.IsPropertyAccessor;
434 }
435
436 void setPropertyAccessor(bool isAccessor) {
437 ObjCMethodDeclBits.IsPropertyAccessor = isAccessor;
438 }
439
440 bool isDefined() const { return ObjCMethodDeclBits.IsDefined; }
441 void setDefined(bool isDefined) { ObjCMethodDeclBits.IsDefined = isDefined; }
442
443 /// Whether this method overrides any other in the class hierarchy.
444 ///
445 /// A method is said to override any method in the class's
446 /// base classes, its protocols, or its categories' protocols, that has
447 /// the same selector and is of the same kind (class or instance).
448 /// A method in an implementation is not considered as overriding the same
449 /// method in the interface or its categories.
450 bool isOverriding() const { return ObjCMethodDeclBits.IsOverriding; }
451 void setOverriding(bool IsOver) { ObjCMethodDeclBits.IsOverriding = IsOver; }
452
453 /// Return overridden methods for the given \p Method.
454 ///
455 /// An ObjC method is considered to override any method in the class's
456 /// base classes (and base's categories), its protocols, or its categories'
457 /// protocols, that has
458 /// the same selector and is of the same kind (class or instance).
459 /// A method in an implementation is not considered as overriding the same
460 /// method in the interface or its categories.
461 void getOverriddenMethods(
462 SmallVectorImpl<const ObjCMethodDecl *> &Overridden) const;
463
464 /// True if the method was a definition but its body was skipped.
465 bool hasSkippedBody() const { return ObjCMethodDeclBits.HasSkippedBody; }
466 void setHasSkippedBody(bool Skipped = true) {
467 ObjCMethodDeclBits.HasSkippedBody = Skipped;
468 }
469
470 /// Returns the property associated with this method's selector.
471 ///
472 /// Note that even if this particular method is not marked as a property
473 /// accessor, it is still possible for it to match a property declared in a
474 /// superclass. Pass \c false if you only want to check the current class.
475 const ObjCPropertyDecl *findPropertyDecl(bool CheckOverrides = true) const;
476
477 // Related to protocols declared in \@protocol
478 void setDeclImplementation(ImplementationControl ic) {
479 ObjCMethodDeclBits.DeclImplementation = ic;
480 }
481
482 ImplementationControl getImplementationControl() const {
483 return ImplementationControl(ObjCMethodDeclBits.DeclImplementation);
484 }
485
486 bool isOptional() const {
487 return getImplementationControl() == Optional;
488 }
489
490 /// Returns true if this specific method declaration is marked with the
491 /// designated initializer attribute.
492 bool isThisDeclarationADesignatedInitializer() const;
493
494 /// Returns true if the method selector resolves to a designated initializer
495 /// in the class's interface.
496 ///
497 /// \param InitMethod if non-null and the function returns true, it receives
498 /// the method declaration that was marked with the designated initializer
499 /// attribute.
500 bool isDesignatedInitializerForTheInterface(
501 const ObjCMethodDecl **InitMethod = nullptr) const;
502
503 /// Determine whether this method has a body.
504 bool hasBody() const override { return Body.isValid(); }
505
506 /// Retrieve the body of this method, if it has one.
507 Stmt *getBody() const override;
508
509 void setLazyBody(uint64_t Offset) { Body = Offset; }
510
511 CompoundStmt *getCompoundBody() { return (CompoundStmt*)getBody(); }
512 void setBody(Stmt *B) { Body = B; }
513
514 /// Returns whether this specific method is a definition.
515 bool isThisDeclarationADefinition() const { return hasBody(); }
516
517 /// Is this method defined in the NSObject base class?
518 bool definedInNSObject(const ASTContext &) const;
519
520 // Implement isa/cast/dyncast/etc.
521 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
522 static bool classofKind(Kind K) { return K == ObjCMethod; }
523
524 static DeclContext *castToDeclContext(const ObjCMethodDecl *D) {
525 return static_cast<DeclContext *>(const_cast<ObjCMethodDecl*>(D));
526 }
527
528 static ObjCMethodDecl *castFromDeclContext(const DeclContext *DC) {
529 return static_cast<ObjCMethodDecl *>(const_cast<DeclContext*>(DC));
530 }
531 };
532
533 /// Describes the variance of a given generic parameter.
534 enum class ObjCTypeParamVariance : uint8_t {
535 /// The parameter is invariant: must match exactly.
536 Invariant,
537
538 /// The parameter is covariant, e.g., X<T> is a subtype of X<U> when
539 /// the type parameter is covariant and T is a subtype of U.
540 Covariant,
541
542 /// The parameter is contravariant, e.g., X<T> is a subtype of X<U>
543 /// when the type parameter is covariant and U is a subtype of T.
544 Contravariant,
545 };
546
547 /// Represents the declaration of an Objective-C type parameter.
548 ///
549 /// \code
550 /// @interface NSDictionary<Key : id<NSCopying>, Value>
551 /// @end
552 /// \endcode
553 ///
554 /// In the example above, both \c Key and \c Value are represented by
555 /// \c ObjCTypeParamDecl. \c Key has an explicit bound of \c id<NSCopying>,
556 /// while \c Value gets an implicit bound of \c id.
557 ///
558 /// Objective-C type parameters are typedef-names in the grammar,
559 class ObjCTypeParamDecl : public TypedefNameDecl {
560 /// Index of this type parameter in the type parameter list.
561 unsigned Index : 14;
562
563 /// The variance of the type parameter.
564 unsigned Variance : 2;
565
566 /// The location of the variance, if any.
567 SourceLocation VarianceLoc;
568
569 /// The location of the ':', which will be valid when the bound was
570 /// explicitly specified.
571 SourceLocation ColonLoc;
572
573 ObjCTypeParamDecl(ASTContext &ctx, DeclContext *dc,
574 ObjCTypeParamVariance variance, SourceLocation varianceLoc,
575 unsigned index,
576 SourceLocation nameLoc, IdentifierInfo *name,
577 SourceLocation colonLoc, TypeSourceInfo *boundInfo)
578 : TypedefNameDecl(ObjCTypeParam, ctx, dc, nameLoc, nameLoc, name,
579 boundInfo),
580 Index(index), Variance(static_cast<unsigned>(variance)),
581 VarianceLoc(varianceLoc), ColonLoc(colonLoc) {}
582
583 void anchor() override;
584
585 public:
586 friend class ASTDeclReader;
587 friend class ASTDeclWriter;
588
589 static ObjCTypeParamDecl *Create(ASTContext &ctx, DeclContext *dc,
590 ObjCTypeParamVariance variance,
591 SourceLocation varianceLoc,
592 unsigned index,
593 SourceLocation nameLoc,
594 IdentifierInfo *name,
595 SourceLocation colonLoc,
596 TypeSourceInfo *boundInfo);
597 static ObjCTypeParamDecl *CreateDeserialized(ASTContext &ctx, unsigned ID);
598
599 SourceRange getSourceRange() const override LLVM_READONLY;
600
601 /// Determine the variance of this type parameter.
602 ObjCTypeParamVariance getVariance() const {
603 return static_cast<ObjCTypeParamVariance>(Variance);
604 }
605
606 /// Set the variance of this type parameter.
607 void setVariance(ObjCTypeParamVariance variance) {
608 Variance = static_cast<unsigned>(variance);
609 }
610
611 /// Retrieve the location of the variance keyword.
612 SourceLocation getVarianceLoc() const { return VarianceLoc; }
613
614 /// Retrieve the index into its type parameter list.
615 unsigned getIndex() const { return Index; }
616
617 /// Whether this type parameter has an explicitly-written type bound, e.g.,
618 /// "T : NSView".
619 bool hasExplicitBound() const { return ColonLoc.isValid(); }
620
621 /// Retrieve the location of the ':' separating the type parameter name
622 /// from the explicitly-specified bound.
623 SourceLocation getColonLoc() const { return ColonLoc; }
624
625 // Implement isa/cast/dyncast/etc.
626 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
627 static bool classofKind(Kind K) { return K == ObjCTypeParam; }
628 };
629
630 /// Stores a list of Objective-C type parameters for a parameterized class
631 /// or a category/extension thereof.
632 ///
633 /// \code
634 /// @interface NSArray<T> // stores the <T>
635 /// @end
636 /// \endcode
637 class ObjCTypeParamList final
638 : private llvm::TrailingObjects<ObjCTypeParamList, ObjCTypeParamDecl *> {
639 /// Stores the components of a SourceRange as a POD.
640 struct PODSourceRange {
641 unsigned Begin;
642 unsigned End;
643 };
644
645 union {
646 /// Location of the left and right angle brackets.
647 PODSourceRange Brackets;
648
649 // Used only for alignment.
650 ObjCTypeParamDecl *AlignmentHack;
651 };
652
653 /// The number of parameters in the list, which are tail-allocated.
654 unsigned NumParams;
655
656 ObjCTypeParamList(SourceLocation lAngleLoc,
657 ArrayRef<ObjCTypeParamDecl *> typeParams,
658 SourceLocation rAngleLoc);
659
660 public:
661 friend TrailingObjects;
662
663 /// Create a new Objective-C type parameter list.
664 static ObjCTypeParamList *create(ASTContext &ctx,
665 SourceLocation lAngleLoc,
666 ArrayRef<ObjCTypeParamDecl *> typeParams,
667 SourceLocation rAngleLoc);
668
669 /// Iterate through the type parameters in the list.
670 using iterator = ObjCTypeParamDecl **;
671
672 iterator begin() { return getTrailingObjects<ObjCTypeParamDecl *>(); }
673
674 iterator end() { return begin() + size(); }
675
676 /// Determine the number of type parameters in this list.
677 unsigned size() const { return NumParams; }
678
679 // Iterate through the type parameters in the list.
680 using const_iterator = ObjCTypeParamDecl * const *;
681
682 const_iterator begin() const {
683 return getTrailingObjects<ObjCTypeParamDecl *>();
684 }
685
686 const_iterator end() const {
687 return begin() + size();
688 }
689
690 ObjCTypeParamDecl *front() const {
691 assert(size() > 0 && "empty Objective-C type parameter list");
692 return *begin();
693 }
694
695 ObjCTypeParamDecl *back() const {
696 assert(size() > 0 && "empty Objective-C type parameter list");
697 return *(end() - 1);
698 }
699
700 SourceLocation getLAngleLoc() const {
701 return SourceLocation::getFromRawEncoding(Brackets.Begin);
702 }
703
704 SourceLocation getRAngleLoc() const {
705 return SourceLocation::getFromRawEncoding(Brackets.End);
706 }
707
708 SourceRange getSourceRange() const {
709 return SourceRange(getLAngleLoc(), getRAngleLoc());
710 }
711
712 /// Gather the default set of type arguments to be substituted for
713 /// these type parameters when dealing with an unspecialized type.
714 void gatherDefaultTypeArgs(SmallVectorImpl<QualType> &typeArgs) const;
715 };
716
717 enum class ObjCPropertyQueryKind : uint8_t {
718 OBJC_PR_query_unknown = 0x00,
719 OBJC_PR_query_instance,
720 OBJC_PR_query_class
721 };
722
723 /// Represents one property declaration in an Objective-C interface.
724 ///
725 /// For example:
726 /// \code{.mm}
727 /// \@property (assign, readwrite) int MyProperty;
728 /// \endcode
729 class ObjCPropertyDecl : public NamedDecl {
730 void anchor() override;
731
732 public:
733 enum PropertyAttributeKind {
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,
740 OBJC_PR_copy = 0x20,
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,
747 /// Indicates that the nullability of the type was spelled with a
748 /// property attribute rather than a type qualifier.
749 OBJC_PR_nullability = 0x1000,
750 OBJC_PR_null_resettable = 0x2000,
751 OBJC_PR_class = 0x4000
752 // Adding a property should change NumPropertyAttrsBits
753 };
754
755 enum {
756 /// Number of bits fitting all the property attributes.
757 NumPropertyAttrsBits = 15
758 };
759
760 enum SetterKind { Assign, Retain, Copy, Weak };
761 enum PropertyControl { None, Required, Optional };
762
763 private:
764 // location of \@property
765 SourceLocation AtLoc;
766
767 // location of '(' starting attribute list or null.
768 SourceLocation LParenLoc;
769
770 QualType DeclType;
771 TypeSourceInfo *DeclTypeSourceInfo;
772 unsigned PropertyAttributes : NumPropertyAttrsBits;
773 unsigned PropertyAttributesAsWritten : NumPropertyAttrsBits;
774
775 // \@required/\@optional
776 unsigned PropertyImplementation : 2;
777
778 // getter name of NULL if no getter
779 Selector GetterName;
780
781 // setter name of NULL if no setter
782 Selector SetterName;
783
784 // location of the getter attribute's value
785 SourceLocation GetterNameLoc;
786
787 // location of the setter attribute's value
788 SourceLocation SetterNameLoc;
789
790 // Declaration of getter instance method
791 ObjCMethodDecl *GetterMethodDecl = nullptr;
792
793 // Declaration of setter instance method
794 ObjCMethodDecl *SetterMethodDecl = nullptr;
795
796 // Synthesize ivar for this property
797 ObjCIvarDecl *PropertyIvarDecl = nullptr;
798
799 ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
800 SourceLocation AtLocation, SourceLocation LParenLocation,
801 QualType T, TypeSourceInfo *TSI,
802 PropertyControl propControl)
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()),
808 SetterName(Selector()) {}
809
810 public:
811 static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC,
812 SourceLocation L,
813 IdentifierInfo *Id, SourceLocation AtLocation,
814 SourceLocation LParenLocation,
815 QualType T,
816 TypeSourceInfo *TSI,
817 PropertyControl propControl = None);
818
819 static ObjCPropertyDecl *CreateDeserialized(ASTContext &C, unsigned ID);
820
821 SourceLocation getAtLoc() const { return AtLoc; }
822 void setAtLoc(SourceLocation L) { AtLoc = L; }
823
824 SourceLocation getLParenLoc() const { return LParenLoc; }
825 void setLParenLoc(SourceLocation L) { LParenLoc = L; }
826
827 TypeSourceInfo *getTypeSourceInfo() const { return DeclTypeSourceInfo; }
828
829 QualType getType() const { return DeclType; }
830
831 void setType(QualType T, TypeSourceInfo *TSI) {
832 DeclType = T;
833 DeclTypeSourceInfo = TSI;
834 }
835
836 /// Retrieve the type when this property is used with a specific base object
837 /// type.
838 QualType getUsageType(QualType objectType) const;
839
840 PropertyAttributeKind getPropertyAttributes() const {
841 return PropertyAttributeKind(PropertyAttributes);
842 }
843
844 void setPropertyAttributes(PropertyAttributeKind PRVal) {
845 PropertyAttributes |= PRVal;
846 }
847
848 void overwritePropertyAttributes(unsigned PRVal) {
849 PropertyAttributes = PRVal;
850 }
851
852 PropertyAttributeKind getPropertyAttributesAsWritten() const {
853 return PropertyAttributeKind(PropertyAttributesAsWritten);
854 }
855
856 void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal) {
857 PropertyAttributesAsWritten = PRVal;
858 }
859
860 // Helper methods for accessing attributes.
861
862 /// isReadOnly - Return true iff the property has a setter.
863 bool isReadOnly() const {
864 return (PropertyAttributes & OBJC_PR_readonly);
865 }
866
867 /// isAtomic - Return true if the property is atomic.
868 bool isAtomic() const {
869 return (PropertyAttributes & OBJC_PR_atomic);
870 }
871
872 /// isRetaining - Return true if the property retains its value.
873 bool isRetaining() const {
874 return (PropertyAttributes &
875 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
876 }
877
878 bool isInstanceProperty() const { return !isClassProperty(); }
879 bool isClassProperty() const { return PropertyAttributes & OBJC_PR_class; }
880
881 ObjCPropertyQueryKind getQueryKind() const {
882 return isClassProperty() ? ObjCPropertyQueryKind::OBJC_PR_query_class :
883 ObjCPropertyQueryKind::OBJC_PR_query_instance;
884 }
885
886 static ObjCPropertyQueryKind getQueryKind(bool isClassProperty) {
887 return isClassProperty ? ObjCPropertyQueryKind::OBJC_PR_query_class :
888 ObjCPropertyQueryKind::OBJC_PR_query_instance;
889 }
890
891 /// getSetterKind - Return the method used for doing assignment in
892 /// the property setter. This is only valid if the property has been
893 /// defined to have a setter.
894 SetterKind getSetterKind() const {
895 if (PropertyAttributes & OBJC_PR_strong)
896 return getType()->isBlockPointerType() ? Copy : Retain;
897 if (PropertyAttributes & OBJC_PR_retain)
898 return Retain;
899 if (PropertyAttributes & OBJC_PR_copy)
900 return Copy;
901 if (PropertyAttributes & OBJC_PR_weak)
902 return Weak;
903 return Assign;
904 }
905
906 Selector getGetterName() const { return GetterName; }
907 SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
908
909 void setGetterName(Selector Sel, SourceLocation Loc = SourceLocation()) {
910 GetterName = Sel;
911 GetterNameLoc = Loc;
912 }
913
914 Selector getSetterName() const { return SetterName; }
915 SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
916
917 void setSetterName(Selector Sel, SourceLocation Loc = SourceLocation()) {
918 SetterName = Sel;
919 SetterNameLoc = Loc;
920 }
921
922 ObjCMethodDecl *getGetterMethodDecl() const { return GetterMethodDecl; }
923 void setGetterMethodDecl(ObjCMethodDecl *gDecl) { GetterMethodDecl = gDecl; }
924
925 ObjCMethodDecl *getSetterMethodDecl() const { return SetterMethodDecl; }
926 void setSetterMethodDecl(ObjCMethodDecl *gDecl) { SetterMethodDecl = gDecl; }
927
928 // Related to \@optional/\@required declared in \@protocol
929 void setPropertyImplementation(PropertyControl pc) {
930 PropertyImplementation = pc;
931 }
932
933 PropertyControl getPropertyImplementation() const {
934 return PropertyControl(PropertyImplementation);
935 }
936
937 bool isOptional() const {
938 return getPropertyImplementation() == PropertyControl::Optional;
939 }
940
941 void setPropertyIvarDecl(ObjCIvarDecl *Ivar) {
942 PropertyIvarDecl = Ivar;
943 }
944
945 ObjCIvarDecl *getPropertyIvarDecl() const {
946 return PropertyIvarDecl;
947 }
948
949 SourceRange getSourceRange() const override LLVM_READONLY {
950 return SourceRange(AtLoc, getLocation());
951 }
952
953 /// Get the default name of the synthesized ivar.
954 IdentifierInfo *getDefaultSynthIvarName(ASTContext &Ctx) const;
955
956 /// Lookup a property by name in the specified DeclContext.
957 static ObjCPropertyDecl *findPropertyDecl(const DeclContext *DC,
958 const IdentifierInfo *propertyID,
959 ObjCPropertyQueryKind queryKind);
960
961 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
962 static bool classofKind(Kind K) { return K == ObjCProperty; }
963 };
964
965 /// ObjCContainerDecl - Represents a container for method declarations.
966 /// Current sub-classes are ObjCInterfaceDecl, ObjCCategoryDecl,
967 /// ObjCProtocolDecl, and ObjCImplDecl.
968 ///
969 class ObjCContainerDecl : public NamedDecl, public DeclContext {
970 // This class stores some data in DeclContext::ObjCContainerDeclBits
971 // to save some space. Use the provided accessors to access it.
972
973 // These two locations in the range mark the end of the method container.
974 // The first points to the '@' token, and the second to the 'end' token.
975 SourceRange AtEnd;
976
977 void anchor() override;
978
979 public:
980 ObjCContainerDecl(Kind DK, DeclContext *DC, IdentifierInfo *Id,
981 SourceLocation nameLoc, SourceLocation atStartLoc);
982
983 // Iterator access to instance/class properties.
984 using prop_iterator = specific_decl_iterator<ObjCPropertyDecl>;
985 using prop_range =
986 llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>;
987
988 prop_range properties() const { return prop_range(prop_begin(), prop_end()); }
989
990 prop_iterator prop_begin() const {
991 return prop_iterator(decls_begin());
992 }
993
994 prop_iterator prop_end() const {
995 return prop_iterator(decls_end());
996 }
997
998 using instprop_iterator =
999 filtered_decl_iterator<ObjCPropertyDecl,
1000 &ObjCPropertyDecl::isInstanceProperty>;
1001 using instprop_range = llvm::iterator_range<instprop_iterator>;
1002
1003 instprop_range instance_properties() const {
1004 return instprop_range(instprop_begin(), instprop_end());
1005 }
1006
1007 instprop_iterator instprop_begin() const {
1008 return instprop_iterator(decls_begin());
1009 }
1010
1011 instprop_iterator instprop_end() const {
1012 return instprop_iterator(decls_end());
1013 }
1014
1015 using classprop_iterator =
1016 filtered_decl_iterator<ObjCPropertyDecl,
1017 &ObjCPropertyDecl::isClassProperty>;
1018 using classprop_range = llvm::iterator_range<classprop_iterator>;
1019
1020 classprop_range class_properties() const {
1021 return classprop_range(classprop_begin(), classprop_end());
1022 }
1023
1024 classprop_iterator classprop_begin() const {
1025 return classprop_iterator(decls_begin());
1026 }
1027
1028 classprop_iterator classprop_end() const {
1029 return classprop_iterator(decls_end());
1030 }
1031
1032 // Iterator access to instance/class methods.
1033 using method_iterator = specific_decl_iterator<ObjCMethodDecl>;
1034 using method_range =
1035 llvm::iterator_range<specific_decl_iterator<ObjCMethodDecl>>;
1036
1037 method_range methods() const {
1038 return method_range(meth_begin(), meth_end());
1039 }
1040
1041 method_iterator meth_begin() const {
1042 return method_iterator(decls_begin());
1043 }
1044
1045 method_iterator meth_end() const {
1046 return method_iterator(decls_end());
1047 }
1048
1049 using instmeth_iterator =
1050 filtered_decl_iterator<ObjCMethodDecl,
1051 &ObjCMethodDecl::isInstanceMethod>;
1052 using instmeth_range = llvm::iterator_range<instmeth_iterator>;
1053
1054 instmeth_range instance_methods() const {
1055 return instmeth_range(instmeth_begin(), instmeth_end());
1056 }
1057
1058 instmeth_iterator instmeth_begin() const {
1059 return instmeth_iterator(decls_begin());
1060 }
1061
1062 instmeth_iterator instmeth_end() const {
1063 return instmeth_iterator(decls_end());
1064 }
1065
1066 using classmeth_iterator =
1067 filtered_decl_iterator<ObjCMethodDecl,
1068 &ObjCMethodDecl::isClassMethod>;
1069 using classmeth_range = llvm::iterator_range<classmeth_iterator>;
1070
1071 classmeth_range class_methods() const {
1072 return classmeth_range(classmeth_begin(), classmeth_end());
1073 }
1074
1075 classmeth_iterator classmeth_begin() const {
1076 return classmeth_iterator(decls_begin());
1077 }
1078
1079 classmeth_iterator classmeth_end() const {
1080 return classmeth_iterator(decls_end());
1081 }
1082
1083 // Get the local instance/class method declared in this interface.
1084 ObjCMethodDecl *getMethod(Selector Sel, bool isInstance,
1085 bool AllowHidden = false) const;
1086
1087 ObjCMethodDecl *getInstanceMethod(Selector Sel,
1088 bool AllowHidden = false) const {
1089 return getMethod(Sel, true/*isInstance*/, AllowHidden);
1090 }
1091
1092 ObjCMethodDecl *getClassMethod(Selector Sel, bool AllowHidden = false) const {
1093 return getMethod(Sel, false/*isInstance*/, AllowHidden);
1094 }
1095
1096 bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const;
1097 ObjCIvarDecl *getIvarDecl(IdentifierInfo *Id) const;
1098
1099 ObjCPropertyDecl *
1100 FindPropertyDeclaration(const IdentifierInfo *PropertyId,
1101 ObjCPropertyQueryKind QueryKind) const;
1102
1103 using PropertyMap =
1104 llvm::DenseMap<std::pair<IdentifierInfo *, unsigned/*isClassProperty*/>,
1105 ObjCPropertyDecl *>;
1106 using ProtocolPropertySet = llvm::SmallDenseSet<const ObjCProtocolDecl *, 8>;
1107 using PropertyDeclOrder = llvm::SmallVector<ObjCPropertyDecl *, 8>;
1108
1109 /// This routine collects list of properties to be implemented in the class.
1110 /// This includes, class's and its conforming protocols' properties.
1111 /// Note, the superclass's properties are not included in the list.
1112 virtual void collectPropertiesToImplement(PropertyMap &PM,
1113 PropertyDeclOrder &PO) const {}
1114
1115 SourceLocation getAtStartLoc() const { return ObjCContainerDeclBits.AtStart; }
1116
1117 void setAtStartLoc(SourceLocation Loc) {
1118 ObjCContainerDeclBits.AtStart = Loc;
1119 }
1120
1121 // Marks the end of the container.
1122 SourceRange getAtEndRange() const { return AtEnd; }
1123
1124 void setAtEndRange(SourceRange atEnd) { AtEnd = atEnd; }
1125
1126 SourceRange getSourceRange() const override LLVM_READONLY {
1127 return SourceRange(getAtStartLoc(), getAtEndRange().getEnd());
1128 }
1129
1130 // Implement isa/cast/dyncast/etc.
1131 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1132
1133 static bool classofKind(Kind K) {
1134 return K >= firstObjCContainer &&
1135 K <= lastObjCContainer;
1136 }
1137
1138 static DeclContext *castToDeclContext(const ObjCContainerDecl *D) {
1139 return static_cast<DeclContext *>(const_cast<ObjCContainerDecl*>(D));
1140 }
1141
1142 static ObjCContainerDecl *castFromDeclContext(const DeclContext *DC) {
1143 return static_cast<ObjCContainerDecl *>(const_cast<DeclContext*>(DC));
1144 }
1145 };
1146
1147 /// Represents an ObjC class declaration.
1148 ///
1149 /// For example:
1150 ///
1151 /// \code
1152 /// // MostPrimitive declares no super class (not particularly useful).
1153 /// \@interface MostPrimitive
1154 /// // no instance variables or methods.
1155 /// \@end
1156 ///
1157 /// // NSResponder inherits from NSObject & implements NSCoding (a protocol).
1158 /// \@interface NSResponder : NSObject <NSCoding>
1159 /// { // instance variables are represented by ObjCIvarDecl.
1160 /// id nextResponder; // nextResponder instance variable.
1161 /// }
1162 /// - (NSResponder *)nextResponder; // return a pointer to NSResponder.
1163 /// - (void)mouseMoved:(NSEvent *)theEvent; // return void, takes a pointer
1164 /// \@end // to an NSEvent.
1165 /// \endcode
1166 ///
1167 /// Unlike C/C++, forward class declarations are accomplished with \@class.
1168 /// Unlike C/C++, \@class allows for a list of classes to be forward declared.
1169 /// Unlike C++, ObjC is a single-rooted class model. In Cocoa, classes
1170 /// typically inherit from NSObject (an exception is NSProxy).
1171 ///
1172 class ObjCInterfaceDecl : public ObjCContainerDecl
1173 , public Redeclarable<ObjCInterfaceDecl> {
1174 friend class ASTContext;
1175
1176 /// TypeForDecl - This indicates the Type object that represents this
1177 /// TypeDecl. It is a cache maintained by ASTContext::getObjCInterfaceType
1178 mutable const Type *TypeForDecl = nullptr;
1179
1180 struct DefinitionData {
1181 /// The definition of this class, for quick access from any
1182 /// declaration.
1183 ObjCInterfaceDecl *Definition = nullptr;
1184
1185 /// When non-null, this is always an ObjCObjectType.
1186 TypeSourceInfo *SuperClassTInfo = nullptr;
1187
1188 /// Protocols referenced in the \@interface declaration
1189 ObjCProtocolList ReferencedProtocols;
1190
1191 /// Protocols reference in both the \@interface and class extensions.
1192 ObjCList<ObjCProtocolDecl> AllReferencedProtocols;
1193
1194 /// List of categories and class extensions defined for this class.
1195 ///
1196 /// Categories are stored as a linked list in the AST, since the categories
1197 /// and class extensions come long after the initial interface declaration,
1198 /// and we avoid dynamically-resized arrays in the AST wherever possible.
1199 ObjCCategoryDecl *CategoryList = nullptr;
1200
1201 /// IvarList - List of all ivars defined by this class; including class
1202 /// extensions and implementation. This list is built lazily.
1203 ObjCIvarDecl *IvarList = nullptr;
1204
1205 /// Indicates that the contents of this Objective-C class will be
1206 /// completed by the external AST source when required.
1207 mutable unsigned ExternallyCompleted : 1;
1208
1209 /// Indicates that the ivar cache does not yet include ivars
1210 /// declared in the implementation.
1211 mutable unsigned IvarListMissingImplementation : 1;
1212
1213 /// Indicates that this interface decl contains at least one initializer
1214 /// marked with the 'objc_designated_initializer' attribute.
1215 unsigned HasDesignatedInitializers : 1;
1216
1217 enum InheritedDesignatedInitializersState {
1218 /// We didn't calculate whether the designated initializers should be
1219 /// inherited or not.
1220 IDI_Unknown = 0,
1221
1222 /// Designated initializers are inherited for the super class.
1223 IDI_Inherited = 1,
1224
1225 /// The class does not inherit designated initializers.
1226 IDI_NotInherited = 2
1227 };
1228
1229 /// One of the \c InheritedDesignatedInitializersState enumeratos.
1230 mutable unsigned InheritedDesignatedInitializers : 2;
1231
1232 /// The location of the last location in this declaration, before
1233 /// the properties/methods. For example, this will be the '>', '}', or
1234 /// identifier,
1235 SourceLocation EndLoc;
1236
1237 DefinitionData()
1238 : ExternallyCompleted(false), IvarListMissingImplementation(true),
1239 HasDesignatedInitializers(false),
1240 InheritedDesignatedInitializers(IDI_Unknown) {}
1241 };
1242
1243 /// The type parameters associated with this class, if any.
1244 ObjCTypeParamList *TypeParamList = nullptr;
1245
1246 /// Contains a pointer to the data associated with this class,
1247 /// which will be NULL if this class has not yet been defined.
1248 ///
1249 /// The bit indicates when we don't need to check for out-of-date
1250 /// declarations. It will be set unless modules are enabled.
1251 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
1252
1253 ObjCInterfaceDecl(const ASTContext &C, DeclContext *DC, SourceLocation AtLoc,
1254 IdentifierInfo *Id, ObjCTypeParamList *typeParamList,
1255 SourceLocation CLoc, ObjCInterfaceDecl *PrevDecl,
1256 bool IsInternal);
1257
1258 void anchor() override;
1259
1260 void LoadExternalDefinition() const;
1261
1262 DefinitionData &data() const {
1263 assert(Data.getPointer() && "Declaration has no definition!");
1264 return *Data.getPointer();
1265 }
1266
1267 /// Allocate the definition data for this class.
1268 void allocateDefinitionData();
1269
1270 using redeclarable_base = Redeclarable<ObjCInterfaceDecl>;
1271
1272 ObjCInterfaceDecl *getNextRedeclarationImpl() override {
1273 return getNextRedeclaration();
1274 }
1275
1276 ObjCInterfaceDecl *getPreviousDeclImpl() override {
1277 return getPreviousDecl();
1278 }
1279
1280 ObjCInterfaceDecl *getMostRecentDeclImpl() override {
1281 return getMostRecentDecl();
1282 }
1283
1284 public:
1285 static ObjCInterfaceDecl *Create(const ASTContext &C, DeclContext *DC,
1286 SourceLocation atLoc,
1287 IdentifierInfo *Id,
1288 ObjCTypeParamList *typeParamList,
1289 ObjCInterfaceDecl *PrevDecl,
1290 SourceLocation ClassLoc = SourceLocation(),
1291 bool isInternal = false);
1292
1293 static ObjCInterfaceDecl *CreateDeserialized(const ASTContext &C, unsigned ID);
1294
1295 /// Retrieve the type parameters of this class.
1296 ///
1297 /// This function looks for a type parameter list for the given
1298 /// class; if the class has been declared (with \c \@class) but not
1299 /// defined (with \c \@interface), it will search for a declaration that
1300 /// has type parameters, skipping any declarations that do not.
1301 ObjCTypeParamList *getTypeParamList() const;
1302
1303 /// Set the type parameters of this class.
1304 ///
1305 /// This function is used by the AST importer, which must import the type
1306 /// parameters after creating their DeclContext to avoid loops.
1307 void setTypeParamList(ObjCTypeParamList *TPL);
1308
1309 /// Retrieve the type parameters written on this particular declaration of
1310 /// the class.
1311 ObjCTypeParamList *getTypeParamListAsWritten() const {
1312 return TypeParamList;
1313 }
1314
1315 SourceRange getSourceRange() const override LLVM_READONLY {
1316 if (isThisDeclarationADefinition())
1317 return ObjCContainerDecl::getSourceRange();
1318
1319 return SourceRange(getAtStartLoc(), getLocation());
1320 }
1321
1322 /// Indicate that this Objective-C class is complete, but that
1323 /// the external AST source will be responsible for filling in its contents
1324 /// when a complete class is required.
1325 void setExternallyCompleted();
1326
1327 /// Indicate that this interface decl contains at least one initializer
1328 /// marked with the 'objc_designated_initializer' attribute.
1329 void setHasDesignatedInitializers();
1330
1331 /// Returns true if this interface decl contains at least one initializer
1332 /// marked with the 'objc_designated_initializer' attribute.
1333 bool hasDesignatedInitializers() const;
1334
1335 /// Returns true if this interface decl declares a designated initializer
1336 /// or it inherites one from its super class.
1337 bool declaresOrInheritsDesignatedInitializers() const {
1338 return hasDesignatedInitializers() || inheritsDesignatedInitializers();
1339 }
1340
1341 const ObjCProtocolList &getReferencedProtocols() const {
1342 assert(hasDefinition() && "Caller did not check for forward reference!");
1343 if (data().ExternallyCompleted)
1344 LoadExternalDefinition();
1345
1346 return data().ReferencedProtocols;
1347 }
1348
1349 ObjCImplementationDecl *getImplementation() const;
1350 void setImplementation(ObjCImplementationDecl *ImplD);
1351
1352 ObjCCategoryDecl *FindCategoryDeclaration(IdentifierInfo *CategoryId) const;
1353
1354 // Get the local instance/class method declared in a category.
1355 ObjCMethodDecl *getCategoryInstanceMethod(Selector Sel) const;
1356 ObjCMethodDecl *getCategoryClassMethod(Selector Sel) const;
1357
1358 ObjCMethodDecl *getCategoryMethod(Selector Sel, bool isInstance) const {
1359 return isInstance ? getCategoryInstanceMethod(Sel)
1360 : getCategoryClassMethod(Sel);
1361 }
1362
1363 using protocol_iterator = ObjCProtocolList::iterator;
1364 using protocol_range = llvm::iterator_range<protocol_iterator>;
1365
1366 protocol_range protocols() const {
1367 return protocol_range(protocol_begin(), protocol_end());
1368 }
1369
1370 protocol_iterator protocol_begin() const {
1371 // FIXME: Should make sure no callers ever do this.
1372 if (!hasDefinition())
1373 return protocol_iterator();
1374
1375 if (data().ExternallyCompleted)
1376 LoadExternalDefinition();
1377
1378 return data().ReferencedProtocols.begin();
1379 }
1380
1381 protocol_iterator protocol_end() const {
1382 // FIXME: Should make sure no callers ever do this.
1383 if (!hasDefinition())
1384 return protocol_iterator();
1385
1386 if (data().ExternallyCompleted)
1387 LoadExternalDefinition();
1388
1389 return data().ReferencedProtocols.end();
1390 }
1391
1392 using protocol_loc_iterator = ObjCProtocolList::loc_iterator;
1393 using protocol_loc_range = llvm::iterator_range<protocol_loc_iterator>;
1394
1395 protocol_loc_range protocol_locs() const {
1396 return protocol_loc_range(protocol_loc_begin(), protocol_loc_end());
1397 }
1398
1399 protocol_loc_iterator protocol_loc_begin() const {
1400 // FIXME: Should make sure no callers ever do this.
1401 if (!hasDefinition())
1402 return protocol_loc_iterator();
1403
1404 if (data().ExternallyCompleted)
1405 LoadExternalDefinition();
1406
1407 return data().ReferencedProtocols.loc_begin();
1408 }
1409
1410 protocol_loc_iterator protocol_loc_end() const {
1411 // FIXME: Should make sure no callers ever do this.
1412 if (!hasDefinition())
1413 return protocol_loc_iterator();
1414
1415 if (data().ExternallyCompleted)
1416 LoadExternalDefinition();
1417
1418 return data().ReferencedProtocols.loc_end();
1419 }
1420
1421 using all_protocol_iterator = ObjCList<ObjCProtocolDecl>::iterator;
1422 using all_protocol_range = llvm::iterator_range<all_protocol_iterator>;
1423
1424 all_protocol_range all_referenced_protocols() const {
1425 return all_protocol_range(all_referenced_protocol_begin(),
1426 all_referenced_protocol_end());
1427 }
1428
1429 all_protocol_iterator all_referenced_protocol_begin() const {
1430 // FIXME: Should make sure no callers ever do this.
1431 if (!hasDefinition())
1432 return all_protocol_iterator();
1433
1434 if (data().ExternallyCompleted)
1435 LoadExternalDefinition();
1436
1437 return data().AllReferencedProtocols.empty()
1438 ? protocol_begin()
1439 : data().AllReferencedProtocols.begin();
1440 }
1441
1442 all_protocol_iterator all_referenced_protocol_end() const {
1443 // FIXME: Should make sure no callers ever do this.
1444 if (!hasDefinition())
1445 return all_protocol_iterator();
1446
1447 if (data().ExternallyCompleted)
1448 LoadExternalDefinition();
1449
1450 return data().AllReferencedProtocols.empty()
1451 ? protocol_end()
1452 : data().AllReferencedProtocols.end();
1453 }
1454
1455 using ivar_iterator = specific_decl_iterator<ObjCIvarDecl>;
1456 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
1457
1458 ivar_range ivars() const { return ivar_range(ivar_begin(), ivar_end()); }
1459
1460 ivar_iterator ivar_begin() const {
1461 if (const ObjCInterfaceDecl *Def = getDefinition())
1462 return ivar_iterator(Def->decls_begin());
1463
1464 // FIXME: Should make sure no callers ever do this.
1465 return ivar_iterator();
1466 }
1467
1468 ivar_iterator ivar_end() const {
1469 if (const ObjCInterfaceDecl *Def = getDefinition())
1470 return ivar_iterator(Def->decls_end());
1471
1472 // FIXME: Should make sure no callers ever do this.
1473 return ivar_iterator();
1474 }
1475
1476 unsigned ivar_size() const {
1477 return std::distance(ivar_begin(), ivar_end());
1478 }
1479
1480 bool ivar_empty() const { return ivar_begin() == ivar_end(); }
1481
1482 ObjCIvarDecl *all_declared_ivar_begin();
1483 const ObjCIvarDecl *all_declared_ivar_begin() const {
1484 // Even though this modifies IvarList, it's conceptually const:
1485 // the ivar chain is essentially a cached property of ObjCInterfaceDecl.
1486 return const_cast<ObjCInterfaceDecl *>(this)->all_declared_ivar_begin();
1487 }
1488 void setIvarList(ObjCIvarDecl *ivar) { data().IvarList = ivar; }
1489
1490 /// setProtocolList - Set the list of protocols that this interface
1491 /// implements.
1492 void setProtocolList(ObjCProtocolDecl *const* List, unsigned Num,
1493 const SourceLocation *Locs, ASTContext &C) {
1494 data().ReferencedProtocols.set(List, Num, Locs, C);
1495 }
1496
1497 /// mergeClassExtensionProtocolList - Merge class extension's protocol list
1498 /// into the protocol list for this class.
1499 void mergeClassExtensionProtocolList(ObjCProtocolDecl *const* List,
1500 unsigned Num,
1501 ASTContext &C);
1502
1503 /// Produce a name to be used for class's metadata. It comes either via
1504 /// objc_runtime_name attribute or class name.
1505 StringRef getObjCRuntimeNameAsString() const;
1506
1507 /// Returns the designated initializers for the interface.
1508 ///
1509 /// If this declaration does not have methods marked as designated
1510 /// initializers then the interface inherits the designated initializers of
1511 /// its super class.
1512 void getDesignatedInitializers(
1513 llvm::SmallVectorImpl<const ObjCMethodDecl *> &Methods) const;
1514
1515 /// Returns true if the given selector is a designated initializer for the
1516 /// interface.
1517 ///
1518 /// If this declaration does not have methods marked as designated
1519 /// initializers then the interface inherits the designated initializers of
1520 /// its super class.
1521 ///
1522 /// \param InitMethod if non-null and the function returns true, it receives
1523 /// the method that was marked as a designated initializer.
1524 bool
1525 isDesignatedInitializer(Selector Sel,
1526 const ObjCMethodDecl **InitMethod = nullptr) const;
1527
1528 /// Determine whether this particular declaration of this class is
1529 /// actually also a definition.
1530 bool isThisDeclarationADefinition() const {
1531 return getDefinition() == this;
1532 }
1533
1534 /// Determine whether this class has been defined.
1535 bool hasDefinition() const {
1536 // If the name of this class is out-of-date, bring it up-to-date, which
1537 // might bring in a definition.
1538 // Note: a null value indicates that we don't have a definition and that
1539 // modules are enabled.
1540 if (!Data.getOpaqueValue())
1541 getMostRecentDecl();
1542
1543 return Data.getPointer();
1544 }
1545
1546 /// Retrieve the definition of this class, or NULL if this class
1547 /// has been forward-declared (with \@class) but not yet defined (with
1548 /// \@interface).
1549 ObjCInterfaceDecl *getDefinition() {
1550 return hasDefinition()? Data.getPointer()->Definition : nullptr;
1551 }
1552
1553 /// Retrieve the definition of this class, or NULL if this class
1554 /// has been forward-declared (with \@class) but not yet defined (with
1555 /// \@interface).
1556 const ObjCInterfaceDecl *getDefinition() const {
1557 return hasDefinition()? Data.getPointer()->Definition : nullptr;
1558 }
1559
1560 /// Starts the definition of this Objective-C class, taking it from
1561 /// a forward declaration (\@class) to a definition (\@interface).
1562 void startDefinition();
1563
1564 /// Retrieve the superclass type.
1565 const ObjCObjectType *getSuperClassType() const {
1566 if (TypeSourceInfo *TInfo = getSuperClassTInfo())
1567 return TInfo->getType()->castAs<ObjCObjectType>();
1568
1569 return nullptr;
1570 }
1571
1572 // Retrieve the type source information for the superclass.
1573 TypeSourceInfo *getSuperClassTInfo() const {
1574 // FIXME: Should make sure no callers ever do this.
1575 if (!hasDefinition())
1576 return nullptr;
1577
1578 if (data().ExternallyCompleted)
1579 LoadExternalDefinition();
1580
1581 return data().SuperClassTInfo;
1582 }
1583
1584 // Retrieve the declaration for the superclass of this class, which
1585 // does not include any type arguments that apply to the superclass.
1586 ObjCInterfaceDecl *getSuperClass() const;
1587
1588 void setSuperClass(TypeSourceInfo *superClass) {
1589 data().SuperClassTInfo = superClass;
1590 }
1591
1592 /// Iterator that walks over the list of categories, filtering out
1593 /// those that do not meet specific criteria.
1594 ///
1595 /// This class template is used for the various permutations of category
1596 /// and extension iterators.
1597 template<bool (*Filter)(ObjCCategoryDecl *)>
1598 class filtered_category_iterator {
1599 ObjCCategoryDecl *Current = nullptr;
1600
1601 void findAcceptableCategory();
1602
1603 public:
1604 using value_type = ObjCCategoryDecl *;
1605 using reference = value_type;
1606 using pointer = value_type;
1607 using difference_type = std::ptrdiff_t;
1608 using iterator_category = std::input_iterator_tag;
1609
1610 filtered_category_iterator() = default;
1611 explicit filtered_category_iterator(ObjCCategoryDecl *Current)
1612 : Current(Current) {
1613 findAcceptableCategory();
1614 }
1615
1616 reference operator*() const { return Current; }
1617 pointer operator->() const { return Current; }
1618
1619 filtered_category_iterator &operator++();
1620
1621 filtered_category_iterator operator++(int) {
1622 filtered_category_iterator Tmp = *this;
1623 ++(*this);
1624 return Tmp;
1625 }
1626
1627 friend bool operator==(filtered_category_iterator X,
1628 filtered_category_iterator Y) {
1629 return X.Current == Y.Current;
1630 }
1631
1632 friend bool operator!=(filtered_category_iterator X,
1633 filtered_category_iterator Y) {
1634 return X.Current != Y.Current;
1635 }
1636 };
1637
1638 private:
1639 /// Test whether the given category is visible.
1640 ///
1641 /// Used in the \c visible_categories_iterator.
1642 static bool isVisibleCategory(ObjCCategoryDecl *Cat);
1643
1644 public:
1645 /// Iterator that walks over the list of categories and extensions
1646 /// that are visible, i.e., not hidden in a non-imported submodule.
1647 using visible_categories_iterator =
1648 filtered_category_iterator<isVisibleCategory>;
1649
1650 using visible_categories_range =
1651 llvm::iterator_range<visible_categories_iterator>;
1652
1653 visible_categories_range visible_categories() const {
1654 return visible_categories_range(visible_categories_begin(),
1655 visible_categories_end());
1656 }
1657
1658 /// Retrieve an iterator to the beginning of the visible-categories
1659 /// list.
1660 visible_categories_iterator visible_categories_begin() const {
1661 return visible_categories_iterator(getCategoryListRaw());
1662 }
1663
1664 /// Retrieve an iterator to the end of the visible-categories list.
1665 visible_categories_iterator visible_categories_end() const {
1666 return visible_categories_iterator();
1667 }
1668
1669 /// Determine whether the visible-categories list is empty.
1670 bool visible_categories_empty() const {
1671 return visible_categories_begin() == visible_categories_end();
1672 }
1673
1674 private:
1675 /// Test whether the given category... is a category.
1676 ///
1677 /// Used in the \c known_categories_iterator.
1678 static bool isKnownCategory(ObjCCategoryDecl *) { return true; }
1679
1680 public:
1681 /// Iterator that walks over all of the known categories and
1682 /// extensions, including those that are hidden.
1683 using known_categories_iterator = filtered_category_iterator<isKnownCategory>;
1684 using known_categories_range =
1685 llvm::iterator_range<known_categories_iterator>;
1686
1687 known_categories_range known_categories() const {
1688 return known_categories_range(known_categories_begin(),
1689 known_categories_end());
1690 }
1691
1692 /// Retrieve an iterator to the beginning of the known-categories
1693 /// list.
1694 known_categories_iterator known_categories_begin() const {
1695 return known_categories_iterator(getCategoryListRaw());
1696 }
1697
1698 /// Retrieve an iterator to the end of the known-categories list.
1699 known_categories_iterator known_categories_end() const {
1700 return known_categories_iterator();
1701 }
1702
1703 /// Determine whether the known-categories list is empty.
1704 bool known_categories_empty() const {
1705 return known_categories_begin() == known_categories_end();
1706 }
1707
1708 private:
1709 /// Test whether the given category is a visible extension.
1710 ///
1711 /// Used in the \c visible_extensions_iterator.
1712 static bool isVisibleExtension(ObjCCategoryDecl *Cat);
1713
1714 public:
1715 /// Iterator that walks over all of the visible extensions, skipping
1716 /// any that are known but hidden.
1717 using visible_extensions_iterator =
1718 filtered_category_iterator<isVisibleExtension>;
1719
1720 using visible_extensions_range =
1721 llvm::iterator_range<visible_extensions_iterator>;
1722
1723 visible_extensions_range visible_extensions() const {
1724 return visible_extensions_range(visible_extensions_begin(),
1725 visible_extensions_end());
1726 }
1727
1728 /// Retrieve an iterator to the beginning of the visible-extensions
1729 /// list.
1730 visible_extensions_iterator visible_extensions_begin() const {
1731 return visible_extensions_iterator(getCategoryListRaw());
1732 }
1733
1734 /// Retrieve an iterator to the end of the visible-extensions list.
1735 visible_extensions_iterator visible_extensions_end() const {
1736 return visible_extensions_iterator();
1737 }
1738
1739 /// Determine whether the visible-extensions list is empty.
1740 bool visible_extensions_empty() const {
1741 return visible_extensions_begin() == visible_extensions_end();
1742 }
1743
1744 private:
1745 /// Test whether the given category is an extension.
1746 ///
1747 /// Used in the \c known_extensions_iterator.
1748 static bool isKnownExtension(ObjCCategoryDecl *Cat);
1749
1750 public:
1751 friend class ASTDeclReader;
1752 friend class ASTDeclWriter;
1753 friend class ASTReader;
1754
1755 /// Iterator that walks over all of the known extensions.
1756 using known_extensions_iterator =
1757 filtered_category_iterator<isKnownExtension>;
1758 using known_extensions_range =
1759 llvm::iterator_range<known_extensions_iterator>;
1760
1761 known_extensions_range known_extensions() const {
1762 return known_extensions_range(known_extensions_begin(),
1763 known_extensions_end());
1764 }
1765
1766 /// Retrieve an iterator to the beginning of the known-extensions
1767 /// list.
1768 known_extensions_iterator known_extensions_begin() const {
1769 return known_extensions_iterator(getCategoryListRaw());
1770 }
1771
1772 /// Retrieve an iterator to the end of the known-extensions list.
1773 known_extensions_iterator known_extensions_end() const {
1774 return known_extensions_iterator();
1775 }
1776
1777 /// Determine whether the known-extensions list is empty.
1778 bool known_extensions_empty() const {
1779 return known_extensions_begin() == known_extensions_end();
1780 }
1781
1782 /// Retrieve the raw pointer to the start of the category/extension
1783 /// list.
1784 ObjCCategoryDecl* getCategoryListRaw() const {
1785 // FIXME: Should make sure no callers ever do this.
1786 if (!hasDefinition())
1787 return nullptr;
1788
1789 if (data().ExternallyCompleted)
1790 LoadExternalDefinition();
1791
1792 return data().CategoryList;
1793 }
1794
1795 /// Set the raw pointer to the start of the category/extension
1796 /// list.
1797 void setCategoryListRaw(ObjCCategoryDecl *category) {
1798 data().CategoryList = category;
1799 }
1800
1801 ObjCPropertyDecl
1802 *FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId,
1803 ObjCPropertyQueryKind QueryKind) const;
1804
1805 void collectPropertiesToImplement(PropertyMap &PM,
1806 PropertyDeclOrder &PO) const override;
1807
1808 /// isSuperClassOf - Return true if this class is the specified class or is a
1809 /// super class of the specified interface class.
1810 bool isSuperClassOf(const ObjCInterfaceDecl *I) const {
1811 // If RHS is derived from LHS it is OK; else it is not OK.
1812 while (I != nullptr) {
1813 if (declaresSameEntity(this, I))
1814 return true;
1815
1816 I = I->getSuperClass();
1817 }
1818 return false;
1819 }
1820
1821 /// isArcWeakrefUnavailable - Checks for a class or one of its super classes
1822 /// to be incompatible with __weak references. Returns true if it is.
1823 bool isArcWeakrefUnavailable() const;
1824
1825 /// isObjCRequiresPropertyDefs - Checks that a class or one of its super
1826 /// classes must not be auto-synthesized. Returns class decl. if it must not
1827 /// be; 0, otherwise.
1828 const ObjCInterfaceDecl *isObjCRequiresPropertyDefs() const;
1829
1830 ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
1831 ObjCInterfaceDecl *&ClassDeclared);
1832 ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName) {
1833 ObjCInterfaceDecl *ClassDeclared;
1834 return lookupInstanceVariable(IVarName, ClassDeclared);
1835 }
1836
1837 ObjCProtocolDecl *lookupNestedProtocol(IdentifierInfo *Name);
1838
1839 // Lookup a method. First, we search locally. If a method isn't
1840 // found, we search referenced protocols and class categories.
1841 ObjCMethodDecl *lookupMethod(Selector Sel, bool isInstance,
1842 bool shallowCategoryLookup = false,
1843 bool followSuper = true,
1844 const ObjCCategoryDecl *C = nullptr) const;
1845
1846 /// Lookup an instance method for a given selector.
1847 ObjCMethodDecl *lookupInstanceMethod(Selector Sel) const {
1848 return lookupMethod(Sel, true/*isInstance*/);
1849 }
1850
1851 /// Lookup a class method for a given selector.
1852 ObjCMethodDecl *lookupClassMethod(Selector Sel) const {
1853 return lookupMethod(Sel, false/*isInstance*/);
1854 }
1855
1856 ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
1857
1858 /// Lookup a method in the classes implementation hierarchy.
1859 ObjCMethodDecl *lookupPrivateMethod(const Selector &Sel,
1860 bool Instance=true) const;
1861
1862 ObjCMethodDecl *lookupPrivateClassMethod(const Selector &Sel) {
1863 return lookupPrivateMethod(Sel, false);
1864 }
1865
1866 /// Lookup a setter or getter in the class hierarchy,
1867 /// including in all categories except for category passed
1868 /// as argument.
1869 ObjCMethodDecl *lookupPropertyAccessor(const Selector Sel,
1870 const ObjCCategoryDecl *Cat,
1871 bool IsClassProperty) const {
1872 return lookupMethod(Sel, !IsClassProperty/*isInstance*/,
1873 false/*shallowCategoryLookup*/,
1874 true /* followsSuper */,
1875 Cat);
1876 }
1877
1878 SourceLocation getEndOfDefinitionLoc() const {
1879 if (!hasDefinition())
1880 return getLocation();
1881
1882 return data().EndLoc;
1883 }
1884
1885 void setEndOfDefinitionLoc(SourceLocation LE) { data().EndLoc = LE; }
1886
1887 /// Retrieve the starting location of the superclass.
1888 SourceLocation getSuperClassLoc() const;
1889
1890 /// isImplicitInterfaceDecl - check that this is an implicitly declared
1891 /// ObjCInterfaceDecl node. This is for legacy objective-c \@implementation
1892 /// declaration without an \@interface declaration.
1893 bool isImplicitInterfaceDecl() const {
1894 return hasDefinition() ? data().Definition->isImplicit() : isImplicit();
1895 }
1896
1897 /// ClassImplementsProtocol - Checks that 'lProto' protocol
1898 /// has been implemented in IDecl class, its super class or categories (if
1899 /// lookupCategory is true).
1900 bool ClassImplementsProtocol(ObjCProtocolDecl *lProto,
1901 bool lookupCategory,
1902 bool RHSIsQualifiedID = false);
1903
1904 using redecl_range = redeclarable_base::redecl_range;
1905 using redecl_iterator = redeclarable_base::redecl_iterator;
1906
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;
1913
1914 /// Retrieves the canonical declaration of this Objective-C class.
1915 ObjCInterfaceDecl *getCanonicalDecl() override { return getFirstDecl(); }
1916 const ObjCInterfaceDecl *getCanonicalDecl() const { return getFirstDecl(); }
1917
1918 // Low-level accessor
1919 const Type *getTypeForDecl() const { return TypeForDecl; }
1920 void setTypeForDecl(const Type *TD) const { TypeForDecl = TD; }
1921
1922 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1923 static bool classofKind(Kind K) { return K == ObjCInterface; }
1924
1925 private:
1926 const ObjCInterfaceDecl *findInterfaceWithDesignatedInitializers() const;
1927 bool inheritsDesignatedInitializers() const;
1928 };
1929
1930 /// ObjCIvarDecl - Represents an ObjC instance variable. In general, ObjC
1931 /// instance variables are identical to C. The only exception is Objective-C
1932 /// supports C++ style access control. For example:
1933 ///
1934 /// \@interface IvarExample : NSObject
1935 /// {
1936 /// id defaultToProtected;
1937 /// \@public:
1938 /// id canBePublic; // same as C++.
1939 /// \@protected:
1940 /// id canBeProtected; // same as C++.
1941 /// \@package:
1942 /// id canBePackage; // framework visibility (not available in C++).
1943 /// }
1944 ///
1945 class ObjCIvarDecl : public FieldDecl {
1946 void anchor() override;
1947
1948 public:
1949 enum AccessControl {
1950 None, Private, Protected, Public, Package
1951 };
1952
1953 private:
1954 ObjCIvarDecl(ObjCContainerDecl *DC, SourceLocation StartLoc,
1955 SourceLocation IdLoc, IdentifierInfo *Id,
1956 QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW,
1957 bool synthesized)
1958 : FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
1959 /*Mutable=*/false, /*HasInit=*/ICIS_NoInit),
1960 DeclAccess(ac), Synthesized(synthesized) {}
1961
1962 public:
1963 static ObjCIvarDecl *Create(ASTContext &C, ObjCContainerDecl *DC,
1964 SourceLocation StartLoc, SourceLocation IdLoc,
1965 IdentifierInfo *Id, QualType T,
1966 TypeSourceInfo *TInfo,
1967 AccessControl ac, Expr *BW = nullptr,
1968 bool synthesized=false);
1969
1970 static ObjCIvarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1971
1972 /// Return the class interface that this ivar is logically contained
1973 /// in; this is either the interface where the ivar was declared, or the
1974 /// interface the ivar is conceptually a part of in the case of synthesized
1975 /// ivars.
1976 const ObjCInterfaceDecl *getContainingInterface() const;
1977
1978 ObjCIvarDecl *getNextIvar() { return NextIvar; }
1979 const ObjCIvarDecl *getNextIvar() const { return NextIvar; }
1980 void setNextIvar(ObjCIvarDecl *ivar) { NextIvar = ivar; }
1981
1982 void setAccessControl(AccessControl ac) { DeclAccess = ac; }
1983
1984 AccessControl getAccessControl() const { return AccessControl(DeclAccess); }
1985
1986 AccessControl getCanonicalAccessControl() const {
1987 return DeclAccess == None ? Protected : AccessControl(DeclAccess);
1988 }
1989
1990 void setSynthesize(bool synth) { Synthesized = synth; }
1991 bool getSynthesize() const { return Synthesized; }
1992
1993 /// Retrieve the type of this instance variable when viewed as a member of a
1994 /// specific object type.
1995 QualType getUsageType(QualType objectType) const;
1996
1997 // Implement isa/cast/dyncast/etc.
1998 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1999 static bool classofKind(Kind K) { return K == ObjCIvar; }
2000
2001 private:
2002 /// NextIvar - Next Ivar in the list of ivars declared in class; class's
2003 /// extensions and class's implementation
2004 ObjCIvarDecl *NextIvar = nullptr;
2005
2006 // NOTE: VC++ treats enums as signed, avoid using the AccessControl enum
2007 unsigned DeclAccess : 3;
2008 unsigned Synthesized : 1;
2009 };
2010
2011 /// Represents a field declaration created by an \@defs(...).
2012 class ObjCAtDefsFieldDecl : public FieldDecl {
2013 ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation StartLoc,
2014 SourceLocation IdLoc, IdentifierInfo *Id,
2015 QualType T, Expr *BW)
2016 : FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
2017 /*TInfo=*/nullptr, // FIXME: Do ObjCAtDefs have declarators ?
2018 BW, /*Mutable=*/false, /*HasInit=*/ICIS_NoInit) {}
2019
2020 void anchor() override;
2021
2022 public:
2023 static ObjCAtDefsFieldDecl *Create(ASTContext &C, DeclContext *DC,
2024 SourceLocation StartLoc,
2025 SourceLocation IdLoc, IdentifierInfo *Id,
2026 QualType T, Expr *BW);
2027
2028 static ObjCAtDefsFieldDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2029
2030 // Implement isa/cast/dyncast/etc.
2031 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2032 static bool classofKind(Kind K) { return K == ObjCAtDefsField; }
2033 };
2034
2035 /// Represents an Objective-C protocol declaration.
2036 ///
2037 /// Objective-C protocols declare a pure abstract type (i.e., no instance
2038 /// variables are permitted). Protocols originally drew inspiration from
2039 /// C++ pure virtual functions (a C++ feature with nice semantics and lousy
2040 /// syntax:-). Here is an example:
2041 ///
2042 /// \code
2043 /// \@protocol NSDraggingInfo <refproto1, refproto2>
2044 /// - (NSWindow *)draggingDestinationWindow;
2045 /// - (NSImage *)draggedImage;
2046 /// \@end
2047 /// \endcode
2048 ///
2049 /// This says that NSDraggingInfo requires two methods and requires everything
2050 /// that the two "referenced protocols" 'refproto1' and 'refproto2' require as
2051 /// well.
2052 ///
2053 /// \code
2054 /// \@interface ImplementsNSDraggingInfo : NSObject <NSDraggingInfo>
2055 /// \@end
2056 /// \endcode
2057 ///
2058 /// ObjC protocols inspired Java interfaces. Unlike Java, ObjC classes and
2059 /// protocols are in distinct namespaces. For example, Cocoa defines both
2060 /// an NSObject protocol and class (which isn't allowed in Java). As a result,
2061 /// protocols are referenced using angle brackets as follows:
2062 ///
2063 /// id <NSDraggingInfo> anyObjectThatImplementsNSDraggingInfo;
2064 class ObjCProtocolDecl : public ObjCContainerDecl,
2065 public Redeclarable<ObjCProtocolDecl> {
2066 struct DefinitionData {
2067 // The declaration that defines this protocol.
2068 ObjCProtocolDecl *Definition;
2069
2070 /// Referenced protocols
2071 ObjCProtocolList ReferencedProtocols;
2072 };
2073
2074 /// Contains a pointer to the data associated with this class,
2075 /// which will be NULL if this class has not yet been defined.
2076 ///
2077 /// The bit indicates when we don't need to check for out-of-date
2078 /// declarations. It will be set unless modules are enabled.
2079 llvm::PointerIntPair<DefinitionData *, 1, bool> Data;
2080
2081 ObjCProtocolDecl(ASTContext &C, DeclContext *DC, IdentifierInfo *Id,
2082 SourceLocation nameLoc, SourceLocation atStartLoc,
2083 ObjCProtocolDecl *PrevDecl);
2084
2085 void anchor() override;
2086
2087 DefinitionData &data() const {
2088 assert(Data.getPointer() && "Objective-C protocol has no definition!");
2089 return *Data.getPointer();
2090 }
2091
2092 void allocateDefinitionData();
2093
2094 using redeclarable_base = Redeclarable<ObjCProtocolDecl>;
2095
2096 ObjCProtocolDecl *getNextRedeclarationImpl() override {
2097 return getNextRedeclaration();
2098 }
2099
2100 ObjCProtocolDecl *getPreviousDeclImpl() override {
2101 return getPreviousDecl();
2102 }
2103
2104 ObjCProtocolDecl *getMostRecentDeclImpl() override {
2105 return getMostRecentDecl();
2106 }
2107
2108 public:
2109 friend class ASTDeclReader;
2110 friend class ASTDeclWriter;
2111 friend class ASTReader;
2112
2113 static ObjCProtocolDecl *Create(ASTContext &C, DeclContext *DC,
2114 IdentifierInfo *Id,
2115 SourceLocation nameLoc,
2116 SourceLocation atStartLoc,
2117 ObjCProtocolDecl *PrevDecl);
2118
2119 static ObjCProtocolDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2120
2121 const ObjCProtocolList &getReferencedProtocols() const {
2122 assert(hasDefinition() && "No definition available!");
2123 return data().ReferencedProtocols;
2124 }
2125
2126 using protocol_iterator = ObjCProtocolList::iterator;
2127 using protocol_range = llvm::iterator_range<protocol_iterator>;
2128
2129 protocol_range protocols() const {
2130 return protocol_range(protocol_begin(), protocol_end());
2131 }
2132
2133 protocol_iterator protocol_begin() const {
2134 if (!hasDefinition())
2135 return protocol_iterator();
2136
2137 return data().ReferencedProtocols.begin();
2138 }
2139
2140 protocol_iterator protocol_end() const {
2141 if (!hasDefinition())
2142 return protocol_iterator();
2143
2144 return data().ReferencedProtocols.end();
2145 }
2146
2147 using protocol_loc_iterator = ObjCProtocolList::loc_iterator;
2148 using protocol_loc_range = llvm::iterator_range<protocol_loc_iterator>;
2149
2150 protocol_loc_range protocol_locs() const {
2151 return protocol_loc_range(protocol_loc_begin(), protocol_loc_end());
2152 }
2153
2154 protocol_loc_iterator protocol_loc_begin() const {
2155 if (!hasDefinition())
2156 return protocol_loc_iterator();
2157
2158 return data().ReferencedProtocols.loc_begin();
2159 }
2160
2161 protocol_loc_iterator protocol_loc_end() const {
2162 if (!hasDefinition())
2163 return protocol_loc_iterator();
2164
2165 return data().ReferencedProtocols.loc_end();
2166 }
2167
2168 unsigned protocol_size() const {
2169 if (!hasDefinition())
2170 return 0;
2171
2172 return data().ReferencedProtocols.size();
2173 }
2174
2175 /// setProtocolList - Set the list of protocols that this interface
2176 /// implements.
2177 void setProtocolList(ObjCProtocolDecl *const*List, unsigned Num,
2178 const SourceLocation *Locs, ASTContext &C) {
2179 assert(hasDefinition() && "Protocol is not defined");
2180 data().ReferencedProtocols.set(List, Num, Locs, C);
2181 }
2182
2183 ObjCProtocolDecl *lookupProtocolNamed(IdentifierInfo *PName);
2184
2185 // Lookup a method. First, we search locally. If a method isn't
2186 // found, we search referenced protocols and class categories.
2187 ObjCMethodDecl *lookupMethod(Selector Sel, bool isInstance) const;
2188
2189 ObjCMethodDecl *lookupInstanceMethod(Selector Sel) const {
2190 return lookupMethod(Sel, true/*isInstance*/);
2191 }
2192
2193 ObjCMethodDecl *lookupClassMethod(Selector Sel) const {
2194 return lookupMethod(Sel, false/*isInstance*/);
2195 }
2196
2197 /// Determine whether this protocol has a definition.
2198 bool hasDefinition() const {
2199 // If the name of this protocol is out-of-date, bring it up-to-date, which
2200 // might bring in a definition.
2201 // Note: a null value indicates that we don't have a definition and that
2202 // modules are enabled.
2203 if (!Data.getOpaqueValue())
2204 getMostRecentDecl();
2205
2206 return Data.getPointer();
2207 }
2208
2209 /// Retrieve the definition of this protocol, if any.
2210 ObjCProtocolDecl *getDefinition() {
2211 return hasDefinition()? Data.getPointer()->Definition : nullptr;
2212 }
2213
2214 /// Retrieve the definition of this protocol, if any.
2215 const ObjCProtocolDecl *getDefinition() const {
2216 return hasDefinition()? Data.getPointer()->Definition : nullptr;
2217 }
2218
2219 /// Determine whether this particular declaration is also the
2220 /// definition.
2221 bool isThisDeclarationADefinition() const {
2222 return getDefinition() == this;
2223 }
2224
2225 /// Starts the definition of this Objective-C protocol.
2226 void startDefinition();
2227
2228 /// Produce a name to be used for protocol's metadata. It comes either via
2229 /// objc_runtime_name attribute or protocol name.
2230 StringRef getObjCRuntimeNameAsString() const;
2231
2232 SourceRange getSourceRange() const override LLVM_READONLY {
2233 if (isThisDeclarationADefinition())
2234 return ObjCContainerDecl::getSourceRange();
2235
2236 return SourceRange(getAtStartLoc(), getLocation());
2237 }
2238
2239 using redecl_range = redeclarable_base::redecl_range;
2240 using redecl_iterator = redeclarable_base::redecl_iterator;
2241
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;
2248
2249 /// Retrieves the canonical declaration of this Objective-C protocol.
2250 ObjCProtocolDecl *getCanonicalDecl() override { return getFirstDecl(); }
2251 const ObjCProtocolDecl *getCanonicalDecl() const { return getFirstDecl(); }
2252
2253 void collectPropertiesToImplement(PropertyMap &PM,
2254 PropertyDeclOrder &PO) const override;
2255
2256 void collectInheritedProtocolProperties(const ObjCPropertyDecl *Property,
2257 ProtocolPropertySet &PS,
2258 PropertyDeclOrder &PO) const;
2259
2260 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2261 static bool classofKind(Kind K) { return K == ObjCProtocol; }
2262 };
2263
2264 /// ObjCCategoryDecl - Represents a category declaration. A category allows
2265 /// you to add methods to an existing class (without subclassing or modifying
2266 /// the original class interface or implementation:-). Categories don't allow
2267 /// you to add instance data. The following example adds "myMethod" to all
2268 /// NSView's within a process:
2269 ///
2270 /// \@interface NSView (MyViewMethods)
2271 /// - myMethod;
2272 /// \@end
2273 ///
2274 /// Categories also allow you to split the implementation of a class across
2275 /// several files (a feature more naturally supported in C++).
2276 ///
2277 /// Categories were originally inspired by dynamic languages such as Common
2278 /// Lisp and Smalltalk. More traditional class-based languages (C++, Java)
2279 /// don't support this level of dynamism, which is both powerful and dangerous.
2280 class ObjCCategoryDecl : public ObjCContainerDecl {
2281 /// Interface belonging to this category
2282 ObjCInterfaceDecl *ClassInterface;
2283
2284 /// The type parameters associated with this category, if any.
2285 ObjCTypeParamList *TypeParamList = nullptr;
2286
2287 /// referenced protocols in this category.
2288 ObjCProtocolList ReferencedProtocols;
2289
2290 /// Next category belonging to this class.
2291 /// FIXME: this should not be a singly-linked list. Move storage elsewhere.
2292 ObjCCategoryDecl *NextClassCategory = nullptr;
2293
2294 /// The location of the category name in this declaration.
2295 SourceLocation CategoryNameLoc;
2296
2297 /// class extension may have private ivars.
2298 SourceLocation IvarLBraceLoc;
2299 SourceLocation IvarRBraceLoc;
2300
2301 ObjCCategoryDecl(DeclContext *DC, SourceLocation AtLoc,
2302 SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc,
2303 IdentifierInfo *Id, ObjCInterfaceDecl *IDecl,
2304 ObjCTypeParamList *typeParamList,
2305 SourceLocation IvarLBraceLoc = SourceLocation(),
2306 SourceLocation IvarRBraceLoc = SourceLocation());
2307
2308 void anchor() override;
2309
2310 public:
2311 friend class ASTDeclReader;
2312 friend class ASTDeclWriter;
2313
2314 static ObjCCategoryDecl *Create(ASTContext &C, DeclContext *DC,
2315 SourceLocation AtLoc,
2316 SourceLocation ClassNameLoc,
2317 SourceLocation CategoryNameLoc,
2318 IdentifierInfo *Id,
2319 ObjCInterfaceDecl *IDecl,
2320 ObjCTypeParamList *typeParamList,
2321 SourceLocation IvarLBraceLoc=SourceLocation(),
2322 SourceLocation IvarRBraceLoc=SourceLocation());
2323 static ObjCCategoryDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2324
2325 ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
2326 const ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
2327
2328 /// Retrieve the type parameter list associated with this category or
2329 /// extension.
2330 ObjCTypeParamList *getTypeParamList() const { return TypeParamList; }
2331
2332 /// Set the type parameters of this category.
2333 ///
2334 /// This function is used by the AST importer, which must import the type
2335 /// parameters after creating their DeclContext to avoid loops.
2336 void setTypeParamList(ObjCTypeParamList *TPL);
2337
2338
2339 ObjCCategoryImplDecl *getImplementation() const;
2340 void setImplementation(ObjCCategoryImplDecl *ImplD);
2341
2342 /// setProtocolList - Set the list of protocols that this interface
2343 /// implements.
2344 void setProtocolList(ObjCProtocolDecl *const*List, unsigned Num,
2345 const SourceLocation *Locs, ASTContext &C) {
2346 ReferencedProtocols.set(List, Num, Locs, C);
2347 }
2348
2349 const ObjCProtocolList &getReferencedProtocols() const {
2350 return ReferencedProtocols;
2351 }
2352
2353 using protocol_iterator = ObjCProtocolList::iterator;
2354 using protocol_range = llvm::iterator_range<protocol_iterator>;
2355
2356 protocol_range protocols() const {
2357 return protocol_range(protocol_begin(), protocol_end());
2358 }
2359
2360 protocol_iterator protocol_begin() const {
2361 return ReferencedProtocols.begin();
2362 }
2363
2364 protocol_iterator protocol_end() const { return ReferencedProtocols.end(); }
2365 unsigned protocol_size() const { return ReferencedProtocols.size(); }
2366
2367 using protocol_loc_iterator = ObjCProtocolList::loc_iterator;
2368 using protocol_loc_range = llvm::iterator_range<protocol_loc_iterator>;
2369
2370 protocol_loc_range protocol_locs() const {
2371 return protocol_loc_range(protocol_loc_begin(), protocol_loc_end());
2372 }
2373
2374 protocol_loc_iterator protocol_loc_begin() const {
2375 return ReferencedProtocols.loc_begin();
2376 }
2377
2378 protocol_loc_iterator protocol_loc_end() const {
2379 return ReferencedProtocols.loc_end();
2380 }
2381
2382 ObjCCategoryDecl *getNextClassCategory() const { return NextClassCategory; }
2383
2384 /// Retrieve the pointer to the next stored category (or extension),
2385 /// which may be hidden.
2386 ObjCCategoryDecl *getNextClassCategoryRaw() const {
2387 return NextClassCategory;
2388 }
2389
2390 bool IsClassExtension() const { return getIdentifier() == nullptr; }
2391
2392 using ivar_iterator = specific_decl_iterator<ObjCIvarDecl>;
2393 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2394
2395 ivar_range ivars() const { return ivar_range(ivar_begin(), ivar_end()); }
2396
2397 ivar_iterator ivar_begin() const {
2398 return ivar_iterator(decls_begin());
2399 }
2400
2401 ivar_iterator ivar_end() const {
2402 return ivar_iterator(decls_end());
2403 }
2404
2405 unsigned ivar_size() const {
2406 return std::distance(ivar_begin(), ivar_end());
2407 }
2408
2409 bool ivar_empty() const {
2410 return ivar_begin() == ivar_end();
2411 }
2412
2413 SourceLocation getCategoryNameLoc() const { return CategoryNameLoc; }
2414 void setCategoryNameLoc(SourceLocation Loc) { CategoryNameLoc = Loc; }
2415
2416 void setIvarLBraceLoc(SourceLocation Loc) { IvarLBraceLoc = Loc; }
2417 SourceLocation getIvarLBraceLoc() const { return IvarLBraceLoc; }
2418 void setIvarRBraceLoc(SourceLocation Loc) { IvarRBraceLoc = Loc; }
2419 SourceLocation getIvarRBraceLoc() const { return IvarRBraceLoc; }
2420
2421 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2422 static bool classofKind(Kind K) { return K == ObjCCategory; }
2423 };
2424
2425 class ObjCImplDecl : public ObjCContainerDecl {
2426 /// Class interface for this class/category implementation
2427 ObjCInterfaceDecl *ClassInterface;
2428
2429 void anchor() override;
2430
2431 protected:
2432 ObjCImplDecl(Kind DK, DeclContext *DC,
2433 ObjCInterfaceDecl *classInterface,
2434 IdentifierInfo *Id,
2435 SourceLocation nameLoc, SourceLocation atStartLoc)
2436 : ObjCContainerDecl(DK, DC, Id, nameLoc, atStartLoc),
2437 ClassInterface(classInterface) {}
2438
2439 public:
2440 const ObjCInterfaceDecl *getClassInterface() const { return ClassInterface; }
2441 ObjCInterfaceDecl *getClassInterface() { return ClassInterface; }
2442 void setClassInterface(ObjCInterfaceDecl *IFace);
2443
2444 void addInstanceMethod(ObjCMethodDecl *method) {
2445 // FIXME: Context should be set correctly before we get here.
2446 method->setLexicalDeclContext(this);
2447 addDecl(method);
2448 }
2449
2450 void addClassMethod(ObjCMethodDecl *method) {
2451 // FIXME: Context should be set correctly before we get here.
2452 method->setLexicalDeclContext(this);
2453 addDecl(method);
2454 }
2455
2456 void addPropertyImplementation(ObjCPropertyImplDecl *property);
2457
2458 ObjCPropertyImplDecl *FindPropertyImplDecl(IdentifierInfo *propertyId,
2459 ObjCPropertyQueryKind queryKind) const;
2460 ObjCPropertyImplDecl *FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const;
2461
2462 // Iterator access to properties.
2463 using propimpl_iterator = specific_decl_iterator<ObjCPropertyImplDecl>;
2464 using propimpl_range =
2465 llvm::iterator_range<specific_decl_iterator<ObjCPropertyImplDecl>>;
2466
2467 propimpl_range property_impls() const {
2468 return propimpl_range(propimpl_begin(), propimpl_end());
2469 }
2470
2471 propimpl_iterator propimpl_begin() const {
2472 return propimpl_iterator(decls_begin());
2473 }
2474
2475 propimpl_iterator propimpl_end() const {
2476 return propimpl_iterator(decls_end());
2477 }
2478
2479 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2480
2481 static bool classofKind(Kind K) {
2482 return K >= firstObjCImpl && K <= lastObjCImpl;
2483 }
2484 };
2485
2486 /// ObjCCategoryImplDecl - An object of this class encapsulates a category
2487 /// \@implementation declaration. If a category class has declaration of a
2488 /// property, its implementation must be specified in the category's
2489 /// \@implementation declaration. Example:
2490 /// \@interface I \@end
2491 /// \@interface I(CATEGORY)
2492 /// \@property int p1, d1;
2493 /// \@end
2494 /// \@implementation I(CATEGORY)
2495 /// \@dynamic p1,d1;
2496 /// \@end
2497 ///
2498 /// ObjCCategoryImplDecl
2499 class ObjCCategoryImplDecl : public ObjCImplDecl {
2500 // Category name location
2501 SourceLocation CategoryNameLoc;
2502
2503 ObjCCategoryImplDecl(DeclContext *DC, IdentifierInfo *Id,
2504 ObjCInterfaceDecl *classInterface,
2505 SourceLocation nameLoc, SourceLocation atStartLoc,
2506 SourceLocation CategoryNameLoc)
2507 : ObjCImplDecl(ObjCCategoryImpl, DC, classInterface, Id,
2508 nameLoc, atStartLoc),
2509 CategoryNameLoc(CategoryNameLoc) {}
2510
2511 void anchor() override;
2512
2513 public:
2514 friend class ASTDeclReader;
2515 friend class ASTDeclWriter;
2516
2517 static ObjCCategoryImplDecl *Create(ASTContext &C, DeclContext *DC,
2518 IdentifierInfo *Id,
2519 ObjCInterfaceDecl *classInterface,
2520 SourceLocation nameLoc,
2521 SourceLocation atStartLoc,
2522 SourceLocation CategoryNameLoc);
2523 static ObjCCategoryImplDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2524
2525 ObjCCategoryDecl *getCategoryDecl() const;
2526
2527 SourceLocation getCategoryNameLoc() const { return CategoryNameLoc; }
2528
2529 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2530 static bool classofKind(Kind K) { return K == ObjCCategoryImpl;}
2531 };
2532
2533 raw_ostream &operator<<(raw_ostream &OS, const ObjCCategoryImplDecl &CID);
2534
2535 /// ObjCImplementationDecl - Represents a class definition - this is where
2536 /// method definitions are specified. For example:
2537 ///
2538 /// @code
2539 /// \@implementation MyClass
2540 /// - (void)myMethod { /* do something */ }
2541 /// \@end
2542 /// @endcode
2543 ///
2544 /// In a non-fragile runtime, instance variables can appear in the class
2545 /// interface, class extensions (nameless categories), and in the implementation
2546 /// itself, as well as being synthesized as backing storage for properties.
2547 ///
2548 /// In a fragile runtime, instance variables are specified in the class
2549 /// interface, \em not in the implementation. Nevertheless (for legacy reasons),
2550 /// we allow instance variables to be specified in the implementation. When
2551 /// specified, they need to be \em identical to the interface.
2552 class ObjCImplementationDecl : public ObjCImplDecl {
2553 /// Implementation Class's super class.
2554 ObjCInterfaceDecl *SuperClass;
2555 SourceLocation SuperLoc;
2556
2557 /// \@implementation may have private ivars.
2558 SourceLocation IvarLBraceLoc;
2559 SourceLocation IvarRBraceLoc;
2560
2561 /// Support for ivar initialization.
2562 /// The arguments used to initialize the ivars
2563 LazyCXXCtorInitializersPtr IvarInitializers;
2564 unsigned NumIvarInitializers = 0;
2565
2566 /// Do the ivars of this class require initialization other than
2567 /// zero-initialization?
2568 bool HasNonZeroConstructors : 1;
2569
2570 /// Do the ivars of this class require non-trivial destruction?
2571 bool HasDestructors : 1;
2572
2573 ObjCImplementationDecl(DeclContext *DC,
2574 ObjCInterfaceDecl *classInterface,
2575 ObjCInterfaceDecl *superDecl,
2576 SourceLocation nameLoc, SourceLocation atStartLoc,
2577 SourceLocation superLoc = SourceLocation(),
2578 SourceLocation IvarLBraceLoc=SourceLocation(),
2579 SourceLocation IvarRBraceLoc=SourceLocation())
2580 : ObjCImplDecl(ObjCImplementation, DC, classInterface,
2581 classInterface ? classInterface->getIdentifier()
2582 : nullptr,
2583 nameLoc, atStartLoc),
2584 SuperClass(superDecl), SuperLoc(superLoc),
2585 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc),
2586 HasNonZeroConstructors(false), HasDestructors(false) {}
2587
2588 void anchor() override;
2589
2590 public:
2591 friend class ASTDeclReader;
2592 friend class ASTDeclWriter;
2593
2594 static ObjCImplementationDecl *Create(ASTContext &C, DeclContext *DC,
2595 ObjCInterfaceDecl *classInterface,
2596 ObjCInterfaceDecl *superDecl,
2597 SourceLocation nameLoc,
2598 SourceLocation atStartLoc,
2599 SourceLocation superLoc = SourceLocation(),
2600 SourceLocation IvarLBraceLoc=SourceLocation(),
2601 SourceLocation IvarRBraceLoc=SourceLocation());
2602
2603 static ObjCImplementationDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2604
2605 /// init_iterator - Iterates through the ivar initializer list.
2606 using init_iterator = CXXCtorInitializer **;
2607
2608 /// init_const_iterator - Iterates through the ivar initializer list.
2609 using init_const_iterator = CXXCtorInitializer * const *;
2610
2611 using init_range = llvm::iterator_range<init_iterator>;
2612 using init_const_range = llvm::iterator_range<init_const_iterator>;
2613
2614 init_range inits() { return init_range(init_begin(), init_end()); }
2615
2616 init_const_range inits() const {
2617 return init_const_range(init_begin(), init_end());
2618 }
2619
2620 /// init_begin() - Retrieve an iterator to the first initializer.
2621 init_iterator init_begin() {
2622 const auto *ConstThis = this;
2623 return const_cast<init_iterator>(ConstThis->init_begin());
2624 }
2625
2626 /// begin() - Retrieve an iterator to the first initializer.
2627 init_const_iterator init_begin() const;
2628
2629 /// init_end() - Retrieve an iterator past the last initializer.
2630 init_iterator init_end() {
2631 return init_begin() + NumIvarInitializers;
2632 }
2633
2634 /// end() - Retrieve an iterator past the last initializer.
2635 init_const_iterator init_end() const {
2636 return init_begin() + NumIvarInitializers;
2637 }
2638
2639 /// getNumArgs - Number of ivars which must be initialized.
2640 unsigned getNumIvarInitializers() const {
2641 return NumIvarInitializers;
2642 }
2643
2644 void setNumIvarInitializers(unsigned numNumIvarInitializers) {
2645 NumIvarInitializers = numNumIvarInitializers;
2646 }
2647
2648 void setIvarInitializers(ASTContext &C,
2649 CXXCtorInitializer ** initializers,
2650 unsigned numInitializers);
2651
2652 /// Do any of the ivars of this class (not counting its base classes)
2653 /// require construction other than zero-initialization?
2654 bool hasNonZeroConstructors() const { return HasNonZeroConstructors; }
2655 void setHasNonZeroConstructors(bool val) { HasNonZeroConstructors = val; }
2656
2657 /// Do any of the ivars of this class (not counting its base classes)
2658 /// require non-trivial destruction?
2659 bool hasDestructors() const { return HasDestructors; }
2660 void setHasDestructors(bool val) { HasDestructors = val; }
2661
2662 /// getIdentifier - Get the identifier that names the class
2663 /// interface associated with this implementation.
2664 IdentifierInfo *getIdentifier() const {
2665 return getClassInterface()->getIdentifier();
2666 }
2667
2668 /// getName - Get the name of identifier for the class interface associated
2669 /// with this implementation as a StringRef.
2670 //
2671 // FIXME: This is a bad API, we are hiding NamedDecl::getName with a different
2672 // meaning.
2673 StringRef getName() const {
2674 assert(getIdentifier() && "Name is not a simple identifier");
2675 return getIdentifier()->getName();
2676 }
2677
2678 /// Get the name of the class associated with this interface.
2679 //
2680 // FIXME: Move to StringRef API.
2681 std::string getNameAsString() const {
2682 return getName();
2683 }
2684
2685 /// Produce a name to be used for class's metadata. It comes either via
2686 /// class's objc_runtime_name attribute or class name.
2687 StringRef getObjCRuntimeNameAsString() const;
2688
2689 const ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }
2690 ObjCInterfaceDecl *getSuperClass() { return SuperClass; }
2691 SourceLocation getSuperClassLoc() const { return SuperLoc; }
2692
2693 void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; }
2694
2695 void setIvarLBraceLoc(SourceLocation Loc) { IvarLBraceLoc = Loc; }
2696 SourceLocation getIvarLBraceLoc() const { return IvarLBraceLoc; }
2697 void setIvarRBraceLoc(SourceLocation Loc) { IvarRBraceLoc = Loc; }
2698 SourceLocation getIvarRBraceLoc() const { return IvarRBraceLoc; }
2699
2700 using ivar_iterator = specific_decl_iterator<ObjCIvarDecl>;
2701 using ivar_range = llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>>;
2702
2703 ivar_range ivars() const { return ivar_range(ivar_begin(), ivar_end()); }
2704
2705 ivar_iterator ivar_begin() const {
2706 return ivar_iterator(decls_begin());
2707 }
2708
2709 ivar_iterator ivar_end() const {
2710 return ivar_iterator(decls_end());
2711 }
2712
2713 unsigned ivar_size() const {
2714 return std::distance(ivar_begin(), ivar_end());
2715 }
2716
2717 bool ivar_empty() const {
2718 return ivar_begin() == ivar_end();
2719 }
2720
2721 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2722 static bool classofKind(Kind K) { return K == ObjCImplementation; }
2723 };
2724
2725 raw_ostream &operator<<(raw_ostream &OS, const ObjCImplementationDecl &ID);
2726
2727 /// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is
2728 /// declared as \@compatibility_alias alias class.
2729 class ObjCCompatibleAliasDecl : public NamedDecl {
2730 /// Class that this is an alias of.
2731 ObjCInterfaceDecl *AliasedClass;
2732
2733 ObjCCompatibleAliasDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
2734 ObjCInterfaceDecl* aliasedClass)
2735 : NamedDecl(ObjCCompatibleAlias, DC, L, Id), AliasedClass(aliasedClass) {}
2736
2737 void anchor() override;
2738
2739 public:
2740 static ObjCCompatibleAliasDecl *Create(ASTContext &C, DeclContext *DC,
2741 SourceLocation L, IdentifierInfo *Id,
2742 ObjCInterfaceDecl* aliasedClass);
2743
2744 static ObjCCompatibleAliasDecl *CreateDeserialized(ASTContext &C,
2745 unsigned ID);
2746
2747 const ObjCInterfaceDecl *getClassInterface() const { return AliasedClass; }
2748 ObjCInterfaceDecl *getClassInterface() { return AliasedClass; }
2749 void setClassInterface(ObjCInterfaceDecl *D) { AliasedClass = D; }
2750
2751 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2752 static bool classofKind(Kind K) { return K == ObjCCompatibleAlias; }
2753 };
2754
2755 /// ObjCPropertyImplDecl - Represents implementation declaration of a property
2756 /// in a class or category implementation block. For example:
2757 /// \@synthesize prop1 = ivar1;
2758 ///
2759 class ObjCPropertyImplDecl : public Decl {
2760 public:
2761 enum Kind {
2762 Synthesize,
2763 Dynamic
2764 };
2765
2766 private:
2767 SourceLocation AtLoc; // location of \@synthesize or \@dynamic
2768
2769 /// For \@synthesize, the location of the ivar, if it was written in
2770 /// the source code.
2771 ///
2772 /// \code
2773 /// \@synthesize int a = b
2774 /// \endcode
2775 SourceLocation IvarLoc;
2776
2777 /// Property declaration being implemented
2778 ObjCPropertyDecl *PropertyDecl;
2779
2780 /// Null for \@dynamic. Required for \@synthesize.
2781 ObjCIvarDecl *PropertyIvarDecl;
2782
2783 /// Null for \@dynamic. Non-null if property must be copy-constructed in
2784 /// getter.
2785 Expr *GetterCXXConstructor = nullptr;
2786
2787 /// Null for \@dynamic. Non-null if property has assignment operator to call
2788 /// in Setter synthesis.
2789 Expr *SetterCXXAssignment = nullptr;
2790
2791 ObjCPropertyImplDecl(DeclContext *DC, SourceLocation atLoc, SourceLocation L,
2792 ObjCPropertyDecl *property,
2793 Kind PK,
2794 ObjCIvarDecl *ivarDecl,
2795 SourceLocation ivarLoc)
2796 : Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc),
2797 IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl) {
2798 assert(PK == Dynamic || PropertyIvarDecl);
2799 }
2800
2801 public:
2802 friend class ASTDeclReader;
2803
2804 static ObjCPropertyImplDecl *Create(ASTContext &C, DeclContext *DC,
2805 SourceLocation atLoc, SourceLocation L,
2806 ObjCPropertyDecl *property,
2807 Kind PK,
2808 ObjCIvarDecl *ivarDecl,
2809 SourceLocation ivarLoc);
2810
2811 static ObjCPropertyImplDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2812
2813 SourceRange getSourceRange() const override LLVM_READONLY;
2814
2815 SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
2816 void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }
2817
2818 ObjCPropertyDecl *getPropertyDecl() const {
2819 return PropertyDecl;
2820 }
2821 void setPropertyDecl(ObjCPropertyDecl *Prop) { PropertyDecl = Prop; }
2822
2823 Kind getPropertyImplementation() const {
2824 return PropertyIvarDecl ? Synthesize : Dynamic;
2825 }
2826
2827 ObjCIvarDecl *getPropertyIvarDecl() const {
2828 return PropertyIvarDecl;
2829 }
2830 SourceLocation getPropertyIvarDeclLoc() const { return IvarLoc; }
2831
2832 void setPropertyIvarDecl(ObjCIvarDecl *Ivar,
2833 SourceLocation IvarLoc) {
2834 PropertyIvarDecl = Ivar;
2835 this->IvarLoc = IvarLoc;
2836 }
2837
2838 /// For \@synthesize, returns true if an ivar name was explicitly
2839 /// specified.
2840 ///
2841 /// \code
2842 /// \@synthesize int a = b; // true
2843 /// \@synthesize int a; // false
2844 /// \endcode
2845 bool isIvarNameSpecified() const {
2846 return IvarLoc.isValid() && IvarLoc != getLocation();
2847 }
2848
2849 Expr *getGetterCXXConstructor() const {
2850 return GetterCXXConstructor;
2851 }
2852
2853 void setGetterCXXConstructor(Expr *getterCXXConstructor) {
2854 GetterCXXConstructor = getterCXXConstructor;
2855 }
2856
2857 Expr *getSetterCXXAssignment() const {
2858 return SetterCXXAssignment;
2859 }
2860
2861 void setSetterCXXAssignment(Expr *setterCXXAssignment) {
2862 SetterCXXAssignment = setterCXXAssignment;
2863 }
2864
2865 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2866 static bool classofKind(Decl::Kind K) { return K == ObjCPropertyImpl; }
2867 };
2868
2869 template<bool (*Filter)(ObjCCategoryDecl *)>
2870 void
2871 ObjCInterfaceDecl::filtered_category_iterator<Filter>::
2872 findAcceptableCategory() {
2873 while (Current && !Filter(Current))
2874 Current = Current->getNextClassCategoryRaw();
2875 }
2876
2877 template<bool (*Filter)(ObjCCategoryDecl *)>
2878 inline ObjCInterfaceDecl::filtered_category_iterator<Filter> &
2879 ObjCInterfaceDecl::filtered_category_iterator<Filter>::operator++() {
2880 Current = Current->getNextClassCategoryRaw();
2881 findAcceptableCategory();
2882 return *this;
2883 }
2884
2885 inline bool ObjCInterfaceDecl::isVisibleCategory(ObjCCategoryDecl *Cat) {
2886 return !Cat->isHidden();
2887 }
2888
2889 inline bool ObjCInterfaceDecl::isVisibleExtension(ObjCCategoryDecl *Cat) {
2890 return Cat->IsClassExtension() && !Cat->isHidden();
2891 }
2892
2893 inline bool ObjCInterfaceDecl::isKnownExtension(ObjCCategoryDecl *Cat) {
2894 return Cat->IsClassExtension();
2895 }
2896
2897 } // namespace clang
2898
2899 #endif // LLVM_CLANG_AST_DECLOBJC_H
clang::ObjCMethodDecl::param_const_range
llvm::iterator_range< param_const_iterator > param_const_range
Definition: DeclObjC.h:346
clang::ObjCInterfaceDecl::known_extensions_begin
known_extensions_iterator known_extensions_begin() const
Retrieve an iterator to the beginning of the known-extensions list.
Definition: DeclObjC.h:1768
clang::ObjCPropertyDecl::getGetterNameLoc
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:907
clang::ObjCCategoryDecl::setCategoryNameLoc
void setCategoryNameLoc(SourceLocation Loc)
Definition: DeclObjC.h:2414
clang::Builtin::ID
ID
Definition: Builtins.h:49
clang::SelLoc_StandardWithSpace
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or with a spac...
Definition: SelectorLocationsKind.h:42
clang::ObjCInterfaceDecl::lookupPrivateClassMethod
ObjCMethodDecl * lookupPrivateClassMethod(const Selector &Sel)
Definition: DeclObjC.h:1862
clang::ObjCInterfaceDecl::hasDefinition
bool hasDefinition() const
Determine whether this class has been defined.
Definition: DeclObjC.h:1535
clang::ObjCPropertyDecl::getQueryKind
ObjCPropertyQueryKind getQueryKind() const
Definition: DeclObjC.h:881
clang::ObjCInterfaceDecl::visible_categories_range
llvm::iterator_range< visible_categories_iterator > visible_categories_range
Definition: DeclObjC.h:1651
clang::ObjCInterfaceDecl::getTypeForDecl
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1919
clang::ObjCMethodDecl::isClassMethod
bool isClassMethod() const
Definition: DeclObjC.h:430
getCanonicalDecl
static const Decl * getCanonicalDecl(const Decl *D)
Definition: IndexingContext.cpp:282
clang::ObjCCategoryDecl::ivar_size
unsigned ivar_size() const
Definition: DeclObjC.h:2405
clang::ObjCMethodDecl::param_type_end
param_type_iterator param_type_end() const
Definition: DeclObjC.h:399
clang::ObjCInterfaceDecl::setEndOfDefinitionLoc
void setEndOfDefinitionLoc(SourceLocation LE)
Definition: DeclObjC.h:1885
clang::ObjCMethodDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Definition: DeclObjC.h:515
clang::ObjCImplDecl::propimpl_end
propimpl_iterator propimpl_end() const
Definition: DeclObjC.h:2475
clang::Decl::redecl_range
llvm::iterator_range< redecl_iterator > redecl_range
Definition: DeclBase.h:937
clang::ObjCInterfaceDecl::protocols
protocol_range protocols() const
Definition: DeclObjC.h:1366
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:673
clang::ObjCInterfaceDecl::getDefinition
const ObjCInterfaceDecl * getDefinition() const
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
Definition: DeclObjC.h:1556
clang::ObjCListBase::operator=
ObjCListBase & operator=(const ObjCListBase &)=delete
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:638
clang::ObjCInterfaceDecl::visible_extensions_begin
visible_extensions_iterator visible_extensions_begin() const
Retrieve an iterator to the beginning of the visible-extensions list.
Definition: DeclObjC.h:1730
clang::ObjCMethodDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:521
clang::ObjCMethodDecl::param_size
unsigned param_size() const
Definition: DeclObjC.h:341
clang::ObjCCategoryDecl::getClassInterface
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2325
clang::ObjCInterfaceDecl::all_referenced_protocols
all_protocol_range all_referenced_protocols() const
Definition: DeclObjC.h:1424
clang::ObjCCategoryDecl::ivar_empty
bool ivar_empty() const
Definition: DeclObjC.h:2409
clang::ObjCImplementationDecl::init_const_range
llvm::iterator_range< init_const_iterator > init_const_range
Definition: DeclObjC.h:2612
clang::ObjCList::begin
iterator begin() const
Definition: DeclObjC.h:91
getDefinition
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
Definition: ASTImporter.cpp:4910
clang::ObjCPropertyDecl::setLParenLoc
void setLParenLoc(SourceLocation L)
Definition: DeclObjC.h:825
clang::ObjCPropertyDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:961
clang::ObjCInterfaceDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1530
clang::ObjCProtocolDecl::lookupInstanceMethod
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Definition: DeclObjC.h:2189
clang::ObjCPropertyImplDecl::getPropertyIvarDecl
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2827
clang::ObjCMethodDecl::getParamDecl
const ParmVarDecl * getParamDecl(unsigned Idx) const
Definition: DeclObjC.h:376
clang::ObjCImplementationDecl::inits
init_const_range inits() const
Definition: DeclObjC.h:2616
clang::ObjCInterfaceDecl::getCategoryMethod
ObjCMethodDecl * getCategoryMethod(Selector Sel, bool isInstance) const
Definition: DeclObjC.h:1358
clang::ObjCContainerDecl::instmeth_range
llvm::iterator_range< instmeth_iterator > instmeth_range
Definition: DeclObjC.h:1052
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
clang::ObjCCategoryDecl::getReferencedProtocols
const ObjCProtocolList & getReferencedProtocols() const
Definition: DeclObjC.h:2349
clang::ObjCContainerDecl::meth_end
method_iterator meth_end() const
Definition: DeclObjC.h:1045
Type.h
C Language Family Type Representation.
clang::SelLoc_NonStandard
Non-standard.
Definition: SelectorLocationsKind.h:30
clang::ObjCInterfaceDecl::filtered_category_iterator::iterator_category
std::input_iterator_tag iterator_category
Definition: DeclObjC.h:1608
clang::ObjCMethodDecl::param_type_iterator
llvm::mapped_iterator< param_const_iterator, GetTypeFn > param_type_iterator
Definition: DeclObjC.h:393
clang::ObjCCategoryDecl::protocol_range
llvm::iterator_range< protocol_iterator > protocol_range
Definition: DeclObjC.h:2354
clang::ObjCProtocolDecl::redecl_iterator
redeclarable_base::redecl_iterator redecl_iterator
Definition: DeclObjC.h:2240
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
clang::ObjCContainerDecl::classprop_end
classprop_iterator classprop_end() const
Definition: DeclObjC.h:1028
clang::ObjCIvarDecl::getCanonicalAccessControl
AccessControl getCanonicalAccessControl() const
Definition: DeclObjC.h:1986
P
StringRef P
Definition: ASTMatchersInternal.cpp:439
clang::ObjCInterfaceDecl::ivars
ivar_range ivars() const
Definition: DeclObjC.h:1458
clang::ObjCContainerDecl::classmeth_range
llvm::iterator_range< classmeth_iterator > classmeth_range
Definition: DeclObjC.h:1069
clang::ObjCInterfaceDecl::all_referenced_protocol_begin
all_protocol_iterator all_referenced_protocol_begin() const
Definition: DeclObjC.h:1429
clang::ObjCContainerDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:1133
clang::ObjCInterfaceDecl::known_categories
known_categories_range known_categories() const
Definition: DeclObjC.h:1687
clang::ObjCCompatibleAliasDecl::getClassInterface
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2748
clang::ObjCPropertyImplDecl::getSetterCXXAssignment
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2857
clang::ObjCImplementationDecl::setNumIvarInitializers
void setNumIvarInitializers(unsigned numNumIvarInitializers)
Definition: DeclObjC.h:2644
clang::ObjCListBase::List
void ** List
List is an array of pointers to objects that are not owned by this object.
Definition: DeclObjC.h:63
clang::operator<<
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:336
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1407
clang::ObjCMethodDecl::getNumSelectorLocs
unsigned getNumSelectorLocs() const
Definition: DeclObjC.h:307
clang::ObjCTypeParamVariance::Covariant
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
clang::ObjCInterfaceDecl::visible_extensions_end
visible_extensions_iterator visible_extensions_end() const
Retrieve an iterator to the end of the visible-extensions list.
Definition: DeclObjC.h:1735
clang::ObjCContainerDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclObjC.h:1126
clang::ObjCImplementationDecl::hasDestructors
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction...
Definition: DeclObjC.h:2659
clang::ObjCPropertyDecl::setPropertyImplementation
void setPropertyImplementation(PropertyControl pc)
Definition: DeclObjC.h:929
clang::ObjCMethodDecl::hasRedeclaration
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition: DeclObjC.h:272
clang::ObjCInterfaceDecl::protocol_begin
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:1370
clang::ObjCPropertyImplDecl::setPropertyIvarDecl
void setPropertyIvarDecl(ObjCIvarDecl *Ivar, SourceLocation IvarLoc)
Definition: DeclObjC.h:2832
clang::ObjCCompatibleAliasDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2752
clang::ObjCCategoryDecl::getNextClassCategoryRaw
ObjCCategoryDecl * getNextClassCategoryRaw() const
Retrieve the pointer to the next stored category (or extension), which may be hidden.
Definition: DeclObjC.h:2386
clang::ObjCInterfaceDecl::getCanonicalDecl
const ObjCInterfaceDecl * getCanonicalDecl() const
Definition: DeclObjC.h:1916
clang::TypeSourceInfo
A container of type source information.
Definition: Decl.h:87
clang::ObjCMethodDecl::castFromDeclContext
static ObjCMethodDecl * castFromDeclContext(const DeclContext *DC)
Definition: DeclObjC.h:528
clang::ObjCPropertyDecl::isOptional
bool isOptional() const
Definition: DeclObjC.h:937
clang::ObjCContainerDecl::instmeth_end
instmeth_iterator instmeth_end() const
Definition: DeclObjC.h:1062
clang::ObjCMethodDecl::setPropertyAccessor
void setPropertyAccessor(bool isAccessor)
Definition: DeclObjC.h:436
clang::ObjCTypeParamDecl::getColonLoc
SourceLocation getColonLoc() const
Retrieve the location of the &#39;:&#39; separating the type parameter name from the explicitly-specified bou...
Definition: DeclObjC.h:623
clang::DeclContext::filtered_decl_iterator
Iterates over a filtered subrange of declarations stored in a DeclContext.
Definition: DeclBase.h:2093
clang::ObjCImplementationDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2721
clang::ObjCMethodDecl::param_end
param_const_iterator param_end() const
Definition: DeclObjC.h:352
distance
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
clang::ObjCMethodDecl::isOverriding
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition: DeclObjC.h:450
clang::ObjCPropertyImplDecl::classofKind
static bool classofKind(Decl::Kind K)
Definition: DeclObjC.h:2866
clang::ObjCTypeParamDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:627
clang::ObjCImplementationDecl::init_const_iterator
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
Definition: DeclObjC.h:2609
clang::ObjCMethodDecl::param_range
llvm::iterator_range< param_iterator > param_range
Definition: DeclObjC.h:345
clang::ObjCContainerDecl::classprop_range
llvm::iterator_range< classprop_iterator > classprop_range
Definition: DeclObjC.h:1018
clang::ObjCPropertyDecl::PropertyAttributeKind
PropertyAttributeKind
Definition: DeclObjC.h:733
clang::ObjCContainerDecl::meth_begin
method_iterator meth_begin() const
Definition: DeclObjC.h:1041
clang::ObjCIvarDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:1998
clang::ObjCMethodDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:522
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
clang::ObjCMethodDecl::Required
Definition: DeclObjC.h:144
clang::ObjCMethodDecl::setSelfDecl
void setSelfDecl(ImplicitParamDecl *SD)
Definition: DeclObjC.h:415
clang::ObjCContainerDecl::class_methods
classmeth_range class_methods() const
Definition: DeclObjC.h:1071
clang::ObjCProtocolDecl::protocols
protocol_range protocols() const
Definition: DeclObjC.h:2129
clang::ObjCInterfaceDecl::filtered_category_iterator::operator->
pointer operator->() const
Definition: DeclObjC.h:1617
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1550
clang::CodeGen::getName
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
clang::ObjCList::end
iterator end() const
Definition: DeclObjC.h:92
clang::ObjCImplementationDecl::getSuperClass
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2689
clang::ObjCMethodDecl::castToDeclContext
static DeclContext * castToDeclContext(const ObjCMethodDecl *D)
Definition: DeclObjC.h:524
clang::ObjCMethodDecl::getDeclaratorEndLoc
SourceLocation getDeclaratorEndLoc() const
Returns the location where the declarator ends.
Definition: DeclObjC.h:280
clang::NamedDecl::getIdentifier
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:270
clang::ObjCTypeParamDecl::getVarianceLoc
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
Definition: DeclObjC.h:612
clang::Redeclarable
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:85
clang::ObjCProtocolDecl::getCanonicalDecl
ObjCProtocolDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C protocol.
Definition: DeclObjC.h:2250
clang::ObjCContainerDecl::instance_properties
instprop_range instance_properties() const
Definition: DeclObjC.h:1003
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:58
clang::ObjCImplementationDecl::init_range
llvm::iterator_range< init_iterator > init_range
Definition: DeclObjC.h:2611
clang::ObjCInterfaceDecl::declaresOrInheritsDesignatedInitializers
bool declaresOrInheritsDesignatedInitializers() const
Returns true if this interface decl declares a designated initializer or it inherites one from its su...
Definition: DeclObjC.h:1337
clang::ObjCProtocolDecl::getCanonicalDecl
const ObjCProtocolDecl * getCanonicalDecl() const
Definition: DeclObjC.h:2251
clang::ObjCProtocolDecl::getReferencedProtocols
const ObjCProtocolList & getReferencedProtocols() const
Definition: DeclObjC.h:2121
clang::ObjCImplementationDecl::getIvarLBraceLoc
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2696
clang::ObjCCategoryDecl::ivar_range
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
Definition: DeclObjC.h:2393
clang::ObjCPropertyImplDecl::getGetterCXXConstructor
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2849
clang::ObjCObjectType
Represents a class type in Objective C.
Definition: Type.h:5538
clang::ObjCInterfaceDecl::lookupInstanceMethod
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
Definition: DeclObjC.h:1847
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
llvm::Optional
Definition: LLVM.h:38
clang::ObjCTypeParamList::end
iterator end()
Definition: DeclObjC.h:674
clang::ObjCContainerDecl::getClassMethod
ObjCMethodDecl * getClassMethod(Selector Sel, bool AllowHidden=false) const
Definition: DeclObjC.h:1092
clang::ObjCMethodDecl::param_const_iterator
const ParmVarDecl *const * param_const_iterator
Definition: DeclObjC.h:343
clang::ObjCPropertyDecl::Required
Definition: DeclObjC.h:761
clang::ObjCMethodFamily
ObjCMethodFamily
A family of Objective-C methods.
Definition: IdentifierTable.h:611
clang::ObjCTypeParamVariance::Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
clang::ObjCMethodDecl::GetTypeFn::operator()
QualType operator()(const ParmVarDecl *PD) const
Definition: DeclObjC.h:389
clang::SourceLocation::getFromRawEncoding
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
Definition: SourceLocation.h:152
clang::ObjCImplDecl::ObjCImplDecl
ObjCImplDecl(Kind DK, DeclContext *DC, ObjCInterfaceDecl *classInterface, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
Definition: DeclObjC.h:2432
clang::ObjCPropertyDecl::getSetterKind
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
Definition: DeclObjC.h:894
clang::ObjCMethodDecl::getClassInterface
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:317
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2579
clang::ObjCTypeParamList::end
const_iterator end() const
Definition: DeclObjC.h:686
clang::ObjCProtocolDecl::protocol_begin
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:2133
clang::ObjCProtocolDecl::protocol_range
llvm::iterator_range< protocol_iterator > protocol_range
Definition: DeclObjC.h:2127
clang::ObjCContainerDecl::instance_methods
instmeth_range instance_methods() const
Definition: DeclObjC.h:1054
clang::ObjCMethodDecl::isDefined
bool isDefined() const
Definition: DeclObjC.h:440
clang::ObjCImplementationDecl::getIdentifier
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names the class interface associated with this implementation...
Definition: DeclObjC.h:2664
clang::ObjCInterfaceDecl::setSuperClass
void setSuperClass(TypeSourceInfo *superClass)
Definition: DeclObjC.h:1588
clang::ObjCContainerDecl::methods
method_range methods() const
Definition: DeclObjC.h:1037
clang::ObjCImplementationDecl::getNameAsString
std::string getNameAsString() const
Get the name of the class associated with this interface.
Definition: DeclObjC.h:2681
clang::ObjCPropertyDecl::getSetterMethodDecl
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:925
clang::ObjCImplementationDecl::ivar_range
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
Definition: DeclObjC.h:2701
clang::ObjCTypeParamList::getSourceRange
SourceRange getSourceRange() const
Definition: DeclObjC.h:708
clang::ObjCInterfaceDecl::getTypeParamListAsWritten
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
Definition: DeclObjC.h:1311
clang::ObjCProtocolList::loc_begin
loc_iterator loc_begin() const
Definition: DeclObjC.h:112
clang::ObjCContainerDecl::properties
prop_range properties() const
Definition: DeclObjC.h:988
clang::ObjCInterfaceDecl::protocol_end
protocol_iterator protocol_end() const
Definition: DeclObjC.h:1381
clang::ObjCPropertyDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:962
clang::ObjCMethodDecl::setReturnType
void setReturnType(QualType T)
Definition: DeclObjC.h:324
clang::ObjCInterfaceDecl::visible_categories
visible_categories_range visible_categories() const
Definition: DeclObjC.h:1653
clang::ObjCPropertyImplDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2865
clang::ObjCTypeParamDecl::getIndex
unsigned getIndex() const
Retrieve the index into its type parameter list.
Definition: DeclObjC.h:615
clang::ObjCAtDefsFieldDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2031
clang::ObjCMethodDecl::setDeclImplementation
void setDeclImplementation(ImplementationControl ic)
Definition: DeclObjC.h:478
clang::ObjCContainerDecl::castFromDeclContext
static ObjCContainerDecl * castFromDeclContext(const DeclContext *DC)
Definition: DeclObjC.h:1142
llvm::SmallVectorImpl
Definition: LLVM.h:37
clang::ObjCIvarDecl::AccessControl
AccessControl
Definition: DeclObjC.h:1949
clang::ObjCProtocolList::set
void set(ObjCProtocolDecl *const *InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx)
Definition: DeclObjC.cpp:54
clang::ObjCInterfaceDecl::filtered_category_iterator::difference_type
std::ptrdiff_t difference_type
Definition: DeclObjC.h:1607
clang::Selector::isUnarySelector
bool isUnarySelector() const
Definition: IdentifierTable.h:750
clang::ObjCPropertyDecl::isClassProperty
bool isClassProperty() const
Definition: DeclObjC.h:879
clang::ObjCList::operator[]
T * operator[](unsigned Idx) const
Definition: DeclObjC.h:94
clang::ObjCImplementationDecl::getIvarRBraceLoc
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2698
clang::ObjCProtocolDecl::protocol_loc_range
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
Definition: DeclObjC.h:2148
clang::ObjCImplementationDecl::hasNonZeroConstructors
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2654
clang::SelectorLocationsKind
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
Definition: SelectorLocationsKind.h:28
clang::ObjCTypeParamList::AlignmentHack
ObjCTypeParamDecl * AlignmentHack
Definition: DeclObjC.h:650
clang::ObjCListBase::set
void set(void *const *InList, unsigned Elts, ASTContext &Ctx)
Definition: DeclObjC.cpp:45
clang::ObjCContainerDecl
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:969
clang::ObjCIvarDecl::setAccessControl
void setAccessControl(AccessControl ac)
Definition: DeclObjC.h:1982
clang::ObjCPropertyDecl::setAtLoc
void setAtLoc(SourceLocation L)
Definition: DeclObjC.h:822
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::ObjCImplementationDecl::ivar_size
unsigned ivar_size() const
Definition: DeclObjC.h:2713
clang::ObjCProtocolDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclObjC.h:2232
clang::ObjCPropertyDecl::getPropertyAttributes
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:840
clang::ObjCCategoryDecl::protocol_loc_end
protocol_loc_iterator protocol_loc_end() const
Definition: DeclObjC.h:2378
clang::ObjCImplementationDecl::setSuperClass
void setSuperClass(ObjCInterfaceDecl *superCls)
Definition: DeclObjC.h:2693
clang::ObjCMethodDecl::setLazyBody
void setLazyBody(uint64_t Offset)
Definition: DeclObjC.h:509
clang::ObjCPropertyDecl::isReadOnly
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
Definition: DeclObjC.h:863
clang::ObjCCompatibleAliasDecl::setClassInterface
void setClassInterface(ObjCInterfaceDecl *D)
Definition: DeclObjC.h:2749
clang::ObjCInterfaceDecl::getCategoryListRaw
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1784
clang::ObjCProtocolDecl::getDefinition
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
Definition: DeclObjC.h:2210
clang::declaresSameEntity
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
Definition: DeclBase.h:1158
clang::ObjCInterfaceDecl::lookupClassMethod
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Lookup a class method for a given selector.
Definition: DeclObjC.h:1852
clang::ObjCPropertyImplDecl::getPropertyIvarDeclLoc
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2830
clang::ObjCMethodDecl::getCompoundBody
CompoundStmt * getCompoundBody()
Definition: DeclObjC.h:511
clang::ObjCProtocolDecl
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2064
clang::ObjCCategoryDecl::ivars
ivar_range ivars() const
Definition: DeclObjC.h:2395
clang::ObjCInterfaceDecl::filtered_category_iterator::operator++
filtered_category_iterator operator++(int)
Definition: DeclObjC.h:1621
clang::ObjCImplementationDecl::getSuperClass
ObjCInterfaceDecl * getSuperClass()
Definition: DeclObjC.h:2690
clang::ObjCProtocolDecl::setProtocolList
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
Definition: DeclObjC.h:2177
clang::ObjCImplDecl::addInstanceMethod
void addInstanceMethod(ObjCMethodDecl *method)
Definition: DeclObjC.h:2444
clang::ObjCPropertyDecl::getPropertyImplementation
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:933
clang::ObjCTypeParamDecl::hasExplicitBound
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Definition: DeclObjC.h:619
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1172
clang::ObjCMethodDecl::getReturnType
QualType getReturnType() const
Definition: DeclObjC.h:323
llvm::ArrayRef
Definition: LLVM.h:32
clang::ObjCInterfaceDecl::all_referenced_protocol_end
all_protocol_iterator all_referenced_protocol_end() const
Definition: DeclObjC.h:1442
clang::ObjCImplDecl::getClassInterface
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2441
clang::ObjCPropertyDecl::isAtomic
bool isAtomic() const
isAtomic - Return true if the property is atomic.
Definition: DeclObjC.h:868
clang::ObjCContainerDecl::getAtStartLoc
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1115
clang::ObjCPropertyDecl::isInstanceProperty
bool isInstanceProperty() const
Definition: DeclObjC.h:878
clang::ObjCMethodDecl::GetTypeFn
Definition: DeclObjC.h:388
clang::ObjCPropertyImplDecl::setGetterCXXConstructor
void setGetterCXXConstructor(Expr *getterCXXConstructor)
Definition: DeclObjC.h:2853
clang::ObjCInterfaceDecl::filtered_category_iterator
Iterator that walks over the list of categories, filtering out those that do not meet specific criter...
Definition: DeclObjC.h:1598
ExternalASTSource.h
clang::ObjCPropertyImplDecl
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2759
clang::ObjCInterfaceDecl::visible_categories_end
visible_categories_iterator visible_categories_end() const
Retrieve an iterator to the end of the visible-categories list.
Definition: DeclObjC.h:1665
clang::ObjCMethodDecl::setVariadic
void setVariadic(bool isVar)
Definition: DeclObjC.h:428
clang::ObjCContainerDecl::classprop_begin
classprop_iterator classprop_begin() const
Definition: DeclObjC.h:1024
clang::ObjCInterfaceDecl::protocol_locs
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1395
clang::CompoundStmt
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1241
clang::ObjCInterfaceDecl::visible_extensions
visible_extensions_range visible_extensions() const
Definition: DeclObjC.h:1723
clang::ObjCInterfaceDecl::getSuperClassType
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
Definition: DeclObjC.h:1565
clang::ObjCImplementationDecl::setHasDestructors
void setHasDestructors(bool val)
Definition: DeclObjC.h:2660
clang::ObjCPropertyQueryKind::OBJC_PR_query_unknown
clang::ObjCListBase::empty
bool empty() const
Definition: DeclObjC.h:72
clang::ObjCImplementationDecl::setIvarRBraceLoc
void setIvarRBraceLoc(SourceLocation Loc)
Definition: DeclObjC.h:2697
clang::ObjCInterfaceDecl::ivar_size
unsigned ivar_size() const
Definition: DeclObjC.h:1476
clang::ObjCIvarDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:1999
clang::ObjCIvarDecl::setNextIvar
void setNextIvar(ObjCIvarDecl *ivar)
Definition: DeclObjC.h:1980
clang::ObjCProtocolDecl::hasDefinition
bool hasDefinition() const
Determine whether this protocol has a definition.
Definition: DeclObjC.h:2198
clang::ObjCIvarDecl::setSynthesize
void setSynthesize(bool synth)
Definition: DeclObjC.h:1990
Offset
unsigned Offset
Definition: Format.cpp:1631
clang::ObjCPropertyDecl::setType
void setType(QualType T, TypeSourceInfo *TSI)
Definition: DeclObjC.h:831
clang::ObjCContainerDecl::class_properties
classprop_range class_properties() const
Definition: DeclObjC.h:1020
clang::ObjCPropertyDecl::setGetterMethodDecl
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
Definition: DeclObjC.h:923
clang::ObjCTypeParamList::const_iterator
ObjCTypeParamDecl *const * const_iterator
Definition: DeclObjC.h:680
clang::Expr
This represents one expression.
Definition: Expr.h:106
clang::ObjCImplementationDecl::ivar_end
ivar_iterator ivar_end() const
Definition: DeclObjC.h:2709
Redeclarable.h
End
SourceLocation End
Definition: USRLocFinder.cpp:167
clang::ObjCInterfaceDecl::known_extensions
known_extensions_range known_extensions() const
Definition: DeclObjC.h:1761
clang::ObjCPropertyDecl::getSetterName
Selector getSetterName() const
Definition: DeclObjC.h:914
clang::ObjCCompatibleAliasDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2751
clang::ObjCInterfaceDecl::ivar_begin
ivar_iterator ivar_begin() const
Definition: DeclObjC.h:1460
Id
int Id
Definition: ASTDiff.cpp:191
clang::ObjCInterfaceDecl::getSuperClassTInfo
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1573
clang::ObjCPropertyDecl::setSetterMethodDecl
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
Definition: DeclObjC.h:926
clang::ObjCImplDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2479
clang::ObjCPropertyDecl::getTypeSourceInfo
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:827
clang::Type::castAs
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:6811
clang::ObjCMethodDecl::param_end
param_iterator param_end()
Definition: DeclObjC.h:357
clang::ObjCMethodDecl::hasRelatedResultType
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver&#39;s type...
Definition: DeclObjC.h:257
clang::ObjCListBase
Definition: DeclObjC.h:60
clang::getStandardSelectorLoc
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 ...
Definition: SelectorLocationsKind.cpp:104
clang::ObjCProtocolDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2221
DeclBase.h
clang::ObjCMethodDecl::getSelectorStartLoc
SourceLocation getSelectorStartLoc() const
Definition: DeclObjC.h:289
clang::ObjCContainerDecl::setAtEndRange
void setAtEndRange(SourceRange atEnd)
Definition: DeclObjC.h:1124
clang::ObjCImplDecl::propimpl_begin
propimpl_iterator propimpl_begin() const
Definition: DeclObjC.h:2471
clang::ObjCInterfaceDecl::known_categories_empty
bool known_categories_empty() const
Determine whether the known-categories list is empty.
Definition: DeclObjC.h:1704
clang::ObjCInterfaceDecl::ivar_empty
bool ivar_empty() const
Definition: DeclObjC.h:1480
clang::ObjCMethodDecl::setRelatedResultType
void setRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
Definition: DeclObjC.h:262
clang::ObjCInterfaceDecl::redecl_iterator
redeclarable_base::redecl_iterator redecl_iterator
Definition: DeclObjC.h:1905
clang::ObjCProtocolList::loc_end
loc_iterator loc_end() const
Definition: DeclObjC.h:113
clang::ObjCImplDecl::addClassMethod
void addClassMethod(ObjCMethodDecl *method)
Definition: DeclObjC.h:2450
clang::ObjCInterfaceDecl::getSuperClass
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:338
Begin
SourceLocation Begin
Definition: USRLocFinder.cpp:165
clang::ObjCMethodDecl::setDefined
void setDefined(bool isDefined)
Definition: DeclObjC.h:441
clang::ObjCMethodDecl::param_iterator
ParmVarDecl *const * param_iterator
Definition: DeclObjC.h:344
clang::ObjCInterfaceDecl::protocol_loc_begin
protocol_loc_iterator protocol_loc_begin() const
Definition: DeclObjC.h:1399
IdentifierTable.h
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
clang::ObjCIvarDecl::Public
Definition: DeclObjC.h:1950
clang::ObjCInterfaceDecl::protocol_loc_end
protocol_loc_iterator protocol_loc_end() const
Definition: DeclObjC.h:1410
clang::ObjCImplDecl::property_impls
propimpl_range property_impls() const
Definition: DeclObjC.h:2467
clang::ObjCTypeParamList::begin
const_iterator begin() const
Definition: DeclObjC.h:682
clang::ObjCImplementationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2722
clang::ObjCContainerDecl::ProtocolPropertySet
llvm::SmallDenseSet< const ObjCProtocolDecl *, 8 > ProtocolPropertySet
Definition: DeclObjC.h:1106
clang::ObjCInterfaceDecl::filtered_category_iterator::operator*
reference operator*() const
Definition: DeclObjC.h:1616
clang::ObjCCategoryImplDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2529
hasDefinition
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
Definition: DynamicTypeChecker.cpp:149
clang::ObjCMethodDecl::isInstanceMethod
bool isInstanceMethod() const
Definition: DeclObjC.h:422
clang::ObjCContainerDecl::castToDeclContext
static DeclContext * castToDeclContext(const ObjCContainerDecl *D)
Definition: DeclObjC.h:1138
clang::ObjCProtocolDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2260
clang::Selector::getNumArgs
unsigned getNumArgs() const
Definition: IdentifierTable.cpp:414
clang::ObjCCategoryDecl::setIvarRBraceLoc
void setIvarRBraceLoc(SourceLocation Loc)
Definition: DeclObjC.h:2418
clang::ObjCMethodDecl::setIsRedeclaration
void setIsRedeclaration(bool RD)
Definition: DeclObjC.h:268
clang::ObjCMethodDecl::getSelector
Selector getSelector() const
Definition: DeclObjC.h:321
clang::ObjCCategoryDecl::protocol_loc_range
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
Definition: DeclObjC.h:2368
clang::ObjCMethodDecl::getSelfDecl
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:414
clang::ObjCPropertyQueryKind::OBJC_PR_query_instance
clang::ObjCInterfaceDecl::known_extensions_range
llvm::iterator_range< known_extensions_iterator > known_extensions_range
Definition: DeclObjC.h:1759
clang::ObjCTypeParamVariance
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition: DeclObjC.h:534
clang::ObjCMethodDecl::setHasSkippedBody
void setHasSkippedBody(bool Skipped=true)
Definition: DeclObjC.h:466
clang::ObjCPropertyDecl::getType
QualType getType() const
Definition: DeclObjC.h:829
getIdentifier
static StringRef getIdentifier(const Token &Tok)
Definition: ParsePragma.cpp:1160
clang::ObjCMethodDecl::hasSkippedBody
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
Definition: DeclObjC.h:465
clang::ObjCImplementationDecl::init_begin
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2621
clang::ObjCInterfaceDecl::protocol_iterator
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:1363
clang::ObjCInterfaceDecl::filtered_category_iterator::filtered_category_iterator
filtered_category_iterator(ObjCCategoryDecl *Current)
Definition: DeclObjC.h:1611
clang::ObjCMethodDecl::setBody
void setBody(Stmt *B)
Definition: DeclObjC.h:512
clang::ObjCContainerDecl::instprop_range
llvm::iterator_range< instprop_iterator > instprop_range
Definition: DeclObjC.h:1001
clang::ObjCCategoryDecl::protocol_locs
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2370
clang::ObjCMethodDecl::getReturnTypeSourceInfo
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:337
clang::ObjCTypeParamList::Brackets
PODSourceRange Brackets
Location of the left and right angle brackets.
Definition: DeclObjC.h:647
clang::ObjCProtocolDecl::protocol_size
unsigned protocol_size() const
Definition: DeclObjC.h:2168
clang::ObjCInterfaceDecl::all_declared_ivar_begin
const ObjCIvarDecl * all_declared_ivar_begin() const
Definition: DeclObjC.h:1483
clang::ObjCPropertyDecl::PropertyControl
PropertyControl
Definition: DeclObjC.h:761
clang::tooling::Filter
llvm::cl::opt< std::string > Filter
clang::ObjCCategoryDecl::ivar_end
ivar_iterator ivar_end() const
Definition: DeclObjC.h:2401
false
#define false
Definition: stdbool.h:33
Kind
Kind
Definition: ChrootChecker.cpp:29
clang::ObjCImplementationDecl::ivar_begin
ivar_iterator ivar_begin() const
Definition: DeclObjC.h:2705
clang::ObjCContainerDecl::classmeth_end
classmeth_iterator classmeth_end() const
Definition: DeclObjC.h:1079
clang::ObjCCategoryDecl::getClassInterface
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2326
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::ObjCIvarDecl::getSynthesize
bool getSynthesize() const
Definition: DeclObjC.h:1991
clang::ObjCInterfaceDecl::ivar_end
ivar_iterator ivar_end() const
Definition: DeclObjC.h:1468
clang::ObjCCategoryDecl::protocol_iterator
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:2353
clang::ObjCPropertyQueryKind
ObjCPropertyQueryKind
Definition: DeclObjC.h:717
clang::ObjCList< clang::ObjCProtocolDecl >::iterator
clang::ObjCProtocolDecl *const * iterator
Definition: DeclObjC.h:89
clang::ObjCImplementationDecl::getSuperClassLoc
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2691
clang::ObjCCategoryDecl::setIvarLBraceLoc
void setIvarLBraceLoc(SourceLocation Loc)
Definition: DeclObjC.h:2416
clang::ObjCMethodDecl::isOptional
bool isOptional() const
Definition: DeclObjC.h:486
clang::ObjCContainerDecl::setAtStartLoc
void setAtStartLoc(SourceLocation Loc)
Definition: DeclObjC.h:1117
clang::ObjCCategoryDecl::getTypeParamList
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Definition: DeclObjC.h:2330
clang::ObjCContainerDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:1131
clang::ObjCMethodDecl::setObjCDeclQualifier
void setObjCDeclQualifier(ObjCDeclQualifier QV)
Definition: DeclObjC.h:251
clang::ObjCCategoryImplDecl::getCategoryNameLoc
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2527
clang::ObjCList
ObjCList - This is a simple template class used to hold various lists of decls etc, which is heavily used by the ObjC front-end.
Definition: DeclObjC.h:83
clang::ObjCPropertyDecl::setPropertyAttributesAsWritten
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
Definition: DeclObjC.h:856
clang::ObjCInterfaceDecl::setProtocolList
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
Definition: DeclObjC.h:1492
clang::ObjCTypeParamList::front
ObjCTypeParamDecl * front() const
Definition: DeclObjC.h:690
clang::ObjCTypeParamList::TrailingObjects
friend TrailingObjects
Definition: DeclObjC.h:661
clang::ObjCCategoryDecl
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2280
clang::ObjCImplDecl::propimpl_range
llvm::iterator_range< specific_decl_iterator< ObjCPropertyImplDecl > > propimpl_range
Definition: DeclObjC.h:2465
clang::ObjCMethodDecl::setOverriding
void setOverriding(bool IsOver)
Definition: DeclObjC.h:451
llvm::SmallVector
Definition: LLVM.h:36
clang::ObjCImplementationDecl::init_end
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2630
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
clang::ObjCCategoryDecl::setProtocolList
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
Definition: DeclObjC.h:2344
clang::ObjCInterfaceDecl::lookupPropertyAccessor
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...
Definition: DeclObjC.h:1869
clang::ObjCPropertyImplDecl::isIvarNameSpecified
bool isIvarNameSpecified() const
For @synthesize, returns true if an ivar name was explicitly specified.
Definition: DeclObjC.h:2845
clang::ObjCMethodDecl::param_type_begin
param_type_iterator param_type_begin() const
Definition: DeclObjC.h:395
clang::ObjCInterfaceDecl::isSuperClassOf
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
Definition: DeclObjC.h:1810
clang::ObjCMethodDecl::getObjCDeclQualifier
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclObjC.h:247
clang::ObjCInterfaceDecl::isImplicitInterfaceDecl
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
Definition: DeclObjC.h:1893
clang::ObjCContainerDecl::prop_end
prop_iterator prop_end() const
Definition: DeclObjC.h:994
clang::ObjCContainerDecl::classmeth_begin
classmeth_iterator classmeth_begin() const
Definition: DeclObjC.h:1075
clang::ObjCMethodDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclObjC.h:285
ptrdiff_t
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
Definition: opencl-c.h:76
clang::LazyOffsetPtr::isValid
bool isValid() const
Whether this pointer is non-NULL.
Definition: ExternalASTSource.h:391
clang::ObjCIvarDecl::getNextIvar
const ObjCIvarDecl * getNextIvar() const
Definition: DeclObjC.h:1979
clang::MultiVersionKind::None
clang::ObjCCategoryDecl::getIvarLBraceLoc
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2417
clang::ObjCProtocolList::loc_iterator
const SourceLocation * loc_iterator
Definition: DeclObjC.h:110
clang::ObjCCategoryDecl::protocols
protocol_range protocols() const
Definition: DeclObjC.h:2356
clang::ObjCTypeParamList::back
ObjCTypeParamDecl * back() const
Definition: DeclObjC.h:695
clang::ObjCInterfaceDecl::visible_categories_begin
visible_categories_iterator visible_categories_begin() const
Retrieve an iterator to the beginning of the visible-categories list.
Definition: DeclObjC.h:1660
clang::ObjCContainerDecl::collectPropertiesToImplement
virtual void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const
This routine collects list of properties to be implemented in the class.
Definition: DeclObjC.h:1112
Specifiers.h
Defines various enumerations that describe declaration and type specifiers.
clang::ImplicitParamDecl
Definition: Decl.h:1486
clang::ObjCPropertyImplDecl::setSetterCXXAssignment
void setSetterCXXAssignment(Expr *setterCXXAssignment)
Definition: DeclObjC.h:2861
clang::ObjCIvarDecl::getNextIvar
ObjCIvarDecl * getNextIvar()
Definition: DeclObjC.h:1978
clang::TypedefNameDecl
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2916
clang::ObjCPropertyImplDecl::setPropertyDecl
void setPropertyDecl(ObjCPropertyDecl *Prop)
Definition: DeclObjC.h:2821
clang::ObjCProtocolDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2261
clang::ObjCSubstitutionContext::Property
The type of a property.
clang::ObjCProtocolDecl::protocol_end
protocol_iterator protocol_end() const
Definition: DeclObjC.h:2140
clang::ObjCMethodDecl::param_begin
param_iterator param_begin()
Definition: DeclObjC.h:356
clang::ObjCImplDecl::getClassInterface
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2440
clang::ObjCInterfaceDecl::known_extensions_empty
bool known_extensions_empty() const
Determine whether the known-extensions list is empty.
Definition: DeclObjC.h:1778
clang::ObjCImplDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2481
Decl.h
clang::ObjCCategoryDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:2421
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::ObjCInterfaceDecl::ivar_range
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
Definition: DeclObjC.h:1456
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:108
clang::ObjCImplementationDecl::ivars
ivar_range ivars() const
Definition: DeclObjC.h:2703
clang::ObjCPropertyDecl::setGetterName
void setGetterName(Selector Sel, SourceLocation Loc=SourceLocation())
Definition: DeclObjC.h:909
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1262
clang::ObjCPropertyDecl::getPropertyAttributesAsWritten
PropertyAttributeKind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:852
clang::ObjCContainerDecl::instprop_end
instprop_iterator instprop_end() const
Definition: DeclObjC.h:1011
clang::ObjCImplDecl
Definition: DeclObjC.h:2425
clang::ObjCInterfaceDecl::visible_extensions_range
llvm::iterator_range< visible_extensions_iterator > visible_extensions_range
Definition: DeclObjC.h:1721
clang::ObjCMethodDecl::getCanonicalDecl
const ObjCMethodDecl * getCanonicalDecl() const
Definition: DeclObjC.h:243
clang::ObjCPropertyImplDecl::getPropertyImplementation
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2823
clang::ObjCInterfaceDecl::protocol_range
llvm::iterator_range< protocol_iterator > protocol_range
Definition: DeclObjC.h:1364
clang::ObjCPropertyDecl::getAtLoc
SourceLocation getAtLoc() const
Definition: DeclObjC.h:821
clang::ObjCPropertyDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclObjC.h:949
clang::tooling::fixit::internal::getSourceRange
SourceRange getSourceRange(const SourceRange &Range)
Returns the SourceRange of a SourceRange.
Definition: FixIt.h:34
clang::ObjCInterfaceDecl::all_protocol_iterator
ObjCList< ObjCProtocolDecl >::iterator all_protocol_iterator
Definition: DeclObjC.h:1421
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:355
clang::ObjCContainerDecl::method_range
llvm::iterator_range< specific_decl_iterator< ObjCMethodDecl > > method_range
Definition: DeclObjC.h:1035
clang::ObjCInterfaceDecl::getReferencedProtocols
const ObjCProtocolList & getReferencedProtocols() const
Definition: DeclObjC.h:1341
clang::ObjCListBase::ObjCListBase
ObjCListBase()=default
clang::ObjCInterfaceDecl::getDefinition
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
Definition: DeclObjC.h:1549
clang::ObjCInterfaceDecl::setIvarList
void setIvarList(ObjCIvarDecl *ivar)
Definition: DeclObjC.h:1488
clang::serialized_diags::create
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Definition: SerializedDiagnosticPrinter.cpp:297
clang::ObjCInterfaceDecl::filtered_category_iterator::operator++
filtered_category_iterator & operator++()
Definition: DeclObjC.h:2879
clang::LazyOffsetPtr< Stmt, uint64_t, &ExternalASTSource::GetExternalDeclStmt >
clang::ObjCTypeParamDecl
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:559
clang::Decl::getKind
Kind getKind() const
Definition: DeclBase.h:421
clang::ObjCListBase::size
unsigned size() const
Definition: DeclObjC.h:71
clang::ObjCListBase::NumElts
unsigned NumElts
Definition: DeclObjC.h:64
clang::ObjCInterfaceDecl::filtered_category_iterator::operator!=
friend bool operator!=(filtered_category_iterator X, filtered_category_iterator Y)
Definition: DeclObjC.h:1632
clang::ObjCCategoryDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2422
clang::ObjCInterfaceDecl::all_protocol_range
llvm::iterator_range< all_protocol_iterator > all_protocol_range
Definition: DeclObjC.h:1422
clang::Redeclarable< ObjCInterfaceDecl >::redecl_range
llvm::iterator_range< redecl_iterator > redecl_range
Definition: Redeclarable.h:291
clang::ObjCContainerDecl::PropertyMap
llvm::DenseMap< std::pair< IdentifierInfo *, unsigned >, ObjCPropertyDecl * > PropertyMap
Definition: DeclObjC.h:1105
clang::ObjCImplementationDecl::init_end
init_const_iterator init_end() const
end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2635
clang::ObjCPropertyDecl::getSetterNameLoc
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:915
clang::ObjCCompatibleAliasDecl::getClassInterface
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2747
clang::Decl::isHidden
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
Definition: DeclBase.h:767
clang::DeclContext::specific_decl_iterator
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).
Definition: DeclBase.h:2017
clang::ObjCImplementationDecl
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2552
clang::ObjCPropertyDecl::SetterKind
SetterKind
Definition: DeclObjC.h:760
clang::ASTDeclReader
Definition: ASTReaderDecl.cpp:81
clang::ObjCImplementationDecl::setHasNonZeroConstructors
void setHasNonZeroConstructors(bool val)
Definition: DeclObjC.h:2655
clang::ObjCPropertyDecl::overwritePropertyAttributes
void overwritePropertyAttributes(unsigned PRVal)
Definition: DeclObjC.h:848
clang::ObjCProtocolDecl::protocol_locs
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2150
clang::CXXCtorInitializer
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2256
clang::ObjCMethodDecl::getSelectorLoc
SourceLocation getSelectorLoc(unsigned Index) const
Definition: DeclObjC.h:295
TrailingObjects
friend TrailingObjects
Definition: OpenMPClause.h:99
clang::ObjCInterfaceDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclObjC.h:1315
clang::ObjCPropertyDecl::isRetaining
bool isRetaining() const
isRetaining - Return true if the property retains its value.
Definition: DeclObjC.h:873
clang::ObjCCategoryDecl::protocol_begin
protocol_iterator protocol_begin() const
Definition: DeclObjC.h:2360
clang::ObjCProtocolDecl::getDefinition
const ObjCProtocolDecl * getDefinition() const
Retrieve the definition of this protocol, if any.
Definition: DeclObjC.h:2215
clang::ObjCInterfaceDecl::filtered_category_iterator::operator==
friend bool operator==(filtered_category_iterator X, filtered_category_iterator Y)
Definition: DeclObjC.h:1627
clang::ObjCMethodDecl::hasBody
bool hasBody() const override
Determine whether this method has a body.
Definition: DeclObjC.h:504
clang::ObjCMethodDecl::param_begin
param_const_iterator param_begin() const
Definition: DeclObjC.h:348
clang::ObjCInterfaceDecl::getCanonicalDecl
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
Definition: DeclObjC.h:1915
clang::ObjCProtocolList
A list of Objective-C protocols, along with the source locations at which they were referenced...
Definition: DeclObjC.h:102
clang::ObjCInterfaceDecl::setCategoryListRaw
void setCategoryListRaw(ObjCCategoryDecl *category)
Set the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1797
clang::ObjCProtocolDecl::lookupClassMethod
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Definition: DeclObjC.h:2193
clang::ObjCPropertyDecl::setSetterName
void setSetterName(Selector Sel, SourceLocation Loc=SourceLocation())
Definition: DeclObjC.h:917
clang::ObjCInterfaceDecl::known_categories_range
llvm::iterator_range< known_categories_iterator > known_categories_range
Definition: DeclObjC.h:1685
clang::ObjCCategoryDecl::IsClassExtension
bool IsClassExtension() const
Definition: DeclObjC.h:2390
clang::ObjCMethodDecl::getImplementationControl
ImplementationControl getImplementationControl() const
Definition: DeclObjC.h:482
clang::ObjCContainerDecl::getAtEndRange
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1122
clang::ObjCPropertyImplDecl::Synthesize
Definition: DeclObjC.h:2762
clang::ObjCContainerDecl::prop_begin
prop_iterator prop_begin() const
Definition: DeclObjC.h:990
X
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Definition: SemaDecl.cpp:13954
clang::ObjCInterfaceDecl::known_categories_end
known_categories_iterator known_categories_end() const
Retrieve an iterator to the end of the known-categories list.
Definition: DeclObjC.h:1699
clang::ObjCAtDefsFieldDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2032
clang::ObjCAtDefsFieldDecl
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2012
SourceLocation.h
Defines the clang::SourceLocation class and associated facilities.
clang::ObjCImplementationDecl::ivar_empty
bool ivar_empty() const
Definition: DeclObjC.h:2717
clang::ObjCCategoryDecl::getCategoryNameLoc
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2413
isInstanceMethod
static bool isInstanceMethod(const Decl *D)
Definition: SemaDeclAttr.cpp:144
clang::ObjCContainerDecl::instprop_begin
instprop_iterator instprop_begin() const
Definition: DeclObjC.h:1007
clang::ObjCInterfaceDecl::lookupInstanceVariable
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName)
Definition: DeclObjC.h:1832
clang::Decl::ObjCDeclQualifier
ObjCDeclQualifier
ObjCDeclQualifier - &#39;Qualifiers&#39; written next to the return and parameter types in method declaration...
Definition: DeclBase.h:196
clang::ObjCMethodDecl::setInstanceMethod
void setInstanceMethod(bool isInst)
Definition: DeclObjC.h:423
clang::ObjCMethodDecl::setHasRedeclaration
void setHasRedeclaration(bool HRD) const
Definition: DeclObjC.h:273
clang::ObjCIvarDecl
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1945
clang::ObjCPropertyDecl::getPropertyIvarDecl
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:945
clang::AttrSyntax::C
clang::ObjCMethodDecl::setReturnTypeSourceInfo
void setReturnTypeSourceInfo(TypeSourceInfo *TInfo)
Definition: DeclObjC.h:338
clang::ObjCCategoryDecl::getNextClassCategory
ObjCCategoryDecl * getNextClassCategory() const
Definition: DeclObjC.h:2382
clang::ObjCImplementationDecl::setIvarLBraceLoc
void setIvarLBraceLoc(SourceLocation Loc)
Definition: DeclObjC.h:2695
clang::ObjCTypeParamList
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:637
clang::ObjCMethodDecl::getCmdDecl
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:416
clang::ObjCMethodDecl::isVariadic
bool isVariadic() const
Definition: DeclObjC.h:427
clang::ObjCPropertyDecl::setPropertyAttributes
void setPropertyAttributes(PropertyAttributeKind PRVal)
Definition: DeclObjC.h:844
clang::ObjCCategoryDecl::protocol_end
protocol_iterator protocol_end() const
Definition: DeclObjC.h:2364
clang::ObjCMethodDecl::sel_param_end
param_const_iterator sel_param_end() const
Definition: DeclObjC.h:361
clang::ASTDeclWriter
Definition: ASTWriterDecl.cpp:35
clang::ObjCMethodDecl::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:283
clang::ObjCCategoryImplDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:2530
clang::ObjCCategoryDecl::protocol_size
unsigned protocol_size() const
Definition: DeclObjC.h:2365
clang::Decl::Kind
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:90
clang::ObjCImplementationDecl::getName
StringRef getName() const
getName - Get the name of identifier for the class interface associated with this implementation as a...
Definition: DeclObjC.h:2673
clang::ObjCPropertyDecl::getQueryKind
static ObjCPropertyQueryKind getQueryKind(bool isClassProperty)
Definition: DeclObjC.h:886
clang::ObjCInterfaceDecl::known_extensions_end
known_extensions_iterator known_extensions_end() const
Retrieve an iterator to the end of the known-extensions list.
Definition: DeclObjC.h:1773
clang::ObjCPropertyImplDecl::getPropertyDecl
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2818
clang::ObjCInterfaceDecl::visible_categories_empty
bool visible_categories_empty() const
Determine whether the visible-categories list is empty.
Definition: DeclObjC.h:1670
clang::ObjCTypeParamList::getRAngleLoc
SourceLocation getRAngleLoc() const
Definition: DeclObjC.h:704
clang::ObjCPropertyImplDecl::setAtLoc
void setAtLoc(SourceLocation Loc)
Definition: DeclObjC.h:2816
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:648
true
#define true
Definition: stdbool.h:32
SelectorLocationsKind.h
clang::ObjCContainerDecl::prop_range
llvm::iterator_range< specific_decl_iterator< ObjCPropertyDecl > > prop_range
Definition: DeclObjC.h:986
clang::ObjCProtocolDecl::protocol_loc_begin
protocol_loc_iterator protocol_loc_begin() const
Definition: DeclObjC.h:2154
clang::ObjCInterfaceDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:1922
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:198
clang::ObjCContainerDecl::instmeth_begin
instmeth_iterator instmeth_begin() const
Definition: DeclObjC.h:1058
clang::Decl::setLexicalDeclContext
void setLexicalDeclContext(DeclContext *DC)
Definition: DeclBase.cpp:299
clang::ObjCPropertyDecl::getGetterMethodDecl
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:922
clang::ObjCInterfaceDecl::known_categories_begin
known_categories_iterator known_categories_begin() const
Retrieve an iterator to the beginning of the known-categories list.
Definition: DeclObjC.h:1694
clang::ObjCMethodDecl::isRedeclaration
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition: DeclObjC.h:267
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::ObjCTypeParamDecl::classof
static bool classof(const Decl *D)
Definition: DeclObjC.h:626
clang::ObjCTypeParamDecl::setVariance
void setVariance(ObjCTypeParamVariance variance)
Set the variance of this type parameter.
Definition: DeclObjC.h:607
clang::ObjCCategoryDecl::protocol_loc_begin
protocol_loc_iterator protocol_loc_begin() const
Definition: DeclObjC.h:2374
clang::ObjCTypeParamList::begin
iterator begin()
Definition: DeclObjC.h:672
clang::ObjCContainerDecl::getInstanceMethod
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
Definition: DeclObjC.h:1087
clang::ObjCIvarDecl::getAccessControl
AccessControl getAccessControl() const
Definition: DeclObjC.h:1984
clang::ObjCCategoryDecl::getIvarRBraceLoc
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2419
clang::ObjCInterfaceDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclObjC.h:1923
clang::ObjCCategoryDecl::ivar_begin
ivar_iterator ivar_begin() const
Definition: DeclObjC.h:2397
clang::ObjCMethodDecl::isPropertyAccessor
bool isPropertyAccessor() const
Definition: DeclObjC.h:432
clang::ObjCPropertyDecl::getGetterName
Selector getGetterName() const
Definition: DeclObjC.h:906
clang::ObjCPropertyDecl::getLParenLoc
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:824
clang::ObjCInterfaceDecl::getEndOfDefinitionLoc
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1878
clang::ObjCInterfaceDecl::visible_extensions_empty
bool visible_extensions_empty() const
Determine whether the visible-extensions list is empty.
Definition: DeclObjC.h:1740
clang::ObjCProtocolDecl::protocol_loc_end
protocol_loc_iterator protocol_loc_end() const
Definition: DeclObjC.h:2161
clang::ObjCInterfaceDecl::setTypeForDecl
void setTypeForDecl(const Type *TD) const
Definition: DeclObjC.h:1920
clang::ObjCTypeParamList::getLAngleLoc
SourceLocation getLAngleLoc() const
Definition: DeclObjC.h:700
clang::ObjCProtocolDecl::protocol_iterator
ObjCProtocolList::iterator protocol_iterator
Definition: DeclObjC.h:2126
ColonLoc
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:108
clang::ObjCMethodDecl::getParamDecl
ParmVarDecl * getParamDecl(unsigned Idx)
Definition: DeclObjC.h:372
clang::ObjCImplementationDecl::getNumIvarInitializers
unsigned getNumIvarInitializers() const
getNumArgs - Number of ivars which must be initialized.
Definition: DeclObjC.h:2640
clang::ObjCTypeParamList::size
unsigned size() const
Determine the number of type parameters in this list.
Definition: DeclObjC.h:677
clang::ObjCMethodDecl::setCmdDecl
void setCmdDecl(ImplicitParamDecl *CD)
Definition: DeclObjC.h:417
clang::ObjCCategoryImplDecl
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2499
clang::ICIS_NoInit
No in-class initializer.
Definition: Specifiers.h:230
clang::ObjCTypeParamVariance::Invariant
The parameter is invariant: must match exactly.
clang::ObjCInterfaceDecl::protocol_loc_range
llvm::iterator_range< protocol_loc_iterator > protocol_loc_range
Definition: DeclObjC.h:1393
clang::ObjCPropertyDecl::setPropertyIvarDecl
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
Definition: DeclObjC.h:941
clang::ObjCPropertyQueryKind::OBJC_PR_query_class
clang::ObjCMethodDecl::parameters
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:367
clang::ObjCCompatibleAliasDecl
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2729
clang::ObjCImplementationDecl::inits
init_range inits()
Definition: DeclObjC.h:2614
clang::Create
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.
clang::ObjCMethodDecl::ImplementationControl
ImplementationControl
Definition: DeclObjC.h:144