clang  19.0.0git
SemaObjC.h
Go to the documentation of this file.
1 //===----- SemaObjC.h ------ Semantic Analysis for Objective-C ------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file declares semantic analysis for Objective-C.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_SEMAOBJC_H
14 #define LLVM_CLANG_SEMA_SEMAOBJC_H
15 
16 #include "clang/AST/Decl.h"
17 #include "clang/AST/DeclBase.h"
18 #include "clang/AST/DeclObjC.h"
19 #include "clang/AST/Expr.h"
20 #include "clang/AST/ExprObjC.h"
21 #include "clang/AST/NSAPI.h"
23 #include "clang/AST/Type.h"
25 #include "clang/Basic/LLVM.h"
27 #include "clang/Basic/Specifiers.h"
28 #include "clang/Basic/TokenKinds.h"
29 #include "clang/Sema/DeclSpec.h"
30 #include "clang/Sema/Lookup.h"
32 #include "clang/Sema/Ownership.h"
33 #include "clang/Sema/ParsedAttr.h"
35 #include "clang/Sema/Scope.h"
36 #include "clang/Sema/SemaBase.h"
37 #include "llvm/ADT/DenseMap.h"
38 #include "llvm/ADT/MapVector.h"
39 #include "llvm/ADT/SmallPtrSet.h"
40 #include <memory>
41 #include <optional>
42 #include <type_traits>
43 #include <utility>
44 
45 namespace clang {
46 
47 enum class CheckedConversionKind;
48 struct SkipBodyInfo;
49 
50 class SemaObjC : public SemaBase {
51 public:
52  SemaObjC(Sema &S);
53 
55  Expr *collection);
57  Expr *collection,
58  SourceLocation RParenLoc);
59  /// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach
60  /// statement.
61  StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
62 
64  Decl *Parm, Stmt *Body);
65 
67 
69  MultiStmtArg Catch, Stmt *Finally);
70 
73  Scope *CurScope);
75  Expr *operand);
77  Stmt *SynchBody);
78 
80 
81  /// Build a an Objective-C protocol-qualified 'id' type where no
82  /// base type was specified.
84  SourceLocation lAngleLoc, ArrayRef<Decl *> protocols,
85  ArrayRef<SourceLocation> protocolLocs, SourceLocation rAngleLoc);
86 
87  /// Build a specialized and/or protocol-qualified Objective-C type.
89  Scope *S, SourceLocation Loc, ParsedType BaseType,
90  SourceLocation TypeArgsLAngleLoc, ArrayRef<ParsedType> TypeArgs,
91  SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc,
92  ArrayRef<Decl *> Protocols, ArrayRef<SourceLocation> ProtocolLocs,
93  SourceLocation ProtocolRAngleLoc);
94 
95  /// Build an Objective-C type parameter type.
97  SourceLocation ProtocolLAngleLoc,
99  ArrayRef<SourceLocation> ProtocolLocs,
100  SourceLocation ProtocolRAngleLoc,
101  bool FailOnError = false);
102 
103  /// Build an Objective-C object pointer type.
105  QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc,
106  ArrayRef<TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc,
107  SourceLocation ProtocolLAngleLoc, ArrayRef<ObjCProtocolDecl *> Protocols,
108  ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
109  bool FailOnError, bool Rebuilding);
110 
111  /// The parser has parsed the context-sensitive type 'instancetype'
112  /// in an Objective-C message declaration. Return the appropriate type.
114 
115  /// checkRetainCycles - Check whether an Objective-C message send
116  /// might create an obvious retain cycle.
118  void checkRetainCycles(Expr *receiver, Expr *argument);
119  void checkRetainCycles(VarDecl *Var, Expr *Init);
120 
121  bool CheckObjCString(Expr *Arg);
124  /// Check whether receiver is mutable ObjC container which
125  /// attempts to add itself into the container
127 
130 
131  /// Invoked when we must temporarily exit the objective-c container
132  /// scope for parsing/looking-up C constructs.
133  ///
134  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
137 
138  const DeclContext *getCurObjCLexicalContext() const;
139 
141  IdentifierInfo *II, SourceLocation IdLoc,
143 
144  bool isObjCWritebackConversion(QualType FromType, QualType ToType,
145  QualType &ConvertedType);
146 
149 
150  /// AddCFAuditedAttribute - Check whether we're currently within
151  /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
152  /// the appropriate attribute.
153  void AddCFAuditedAttribute(Decl *D);
154 
155  /// The struct behind the CFErrorRef pointer.
156  RecordDecl *CFError = nullptr;
157  bool isCFError(RecordDecl *D);
158 
160 
161 private:
162  IdentifierInfo *Ident_NSError = nullptr;
163 
164  //
165  //
166  // -------------------------------------------------------------------------
167  //
168  //
169 
170  /// \name ObjC Declarations
171  /// Implementations are in SemaDeclObjC.cpp
172  ///@{
173 
174 public:
182  };
183 
184  /// Method selectors used in a \@selector expression. Used for implementation
185  /// of -Wselector.
186  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
187 
189  public:
190  using Lists = std::pair<ObjCMethodList, ObjCMethodList>;
191  using iterator = llvm::DenseMap<Selector, Lists>::iterator;
192  iterator begin() { return Methods.begin(); }
193  iterator end() { return Methods.end(); }
194  iterator find(Selector Sel) { return Methods.find(Sel); }
195  std::pair<iterator, bool> insert(std::pair<Selector, Lists> &&Val) {
196  return Methods.insert(Val);
197  }
198  int count(Selector Sel) const { return Methods.count(Sel); }
199  bool empty() const { return Methods.empty(); }
200 
201  private:
202  llvm::DenseMap<Selector, Lists> Methods;
203  };
204 
205  /// Method Pool - allows efficient lookup when typechecking messages to "id".
206  /// We need to maintain a list, since selectors can have differing signatures
207  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
208  /// of selectors are "overloaded").
209  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
210  /// methods inside categories with a particular selector.
212 
214 
216 
218  OCK_None = -1,
225  };
227 
229  SourceLocation varianceLoc, unsigned index,
230  IdentifierInfo *paramName,
231  SourceLocation paramLoc,
232  SourceLocation colonLoc, ParsedType typeBound);
233 
235  ArrayRef<Decl *> typeParams,
236  SourceLocation rAngleLoc);
237  void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
238 
240  Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
241  SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
242  IdentifierInfo *SuperName, SourceLocation SuperLoc,
243  ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
244  Decl *const *ProtoRefs, unsigned NumProtoRefs,
245  const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
246  const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody);
247 
249  Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl,
250  IdentifierInfo *ClassName, SourceLocation ClassLoc,
251  IdentifierInfo *SuperName, SourceLocation SuperLoc,
252  ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange);
253 
255  SmallVectorImpl<SourceLocation> &ProtocolLocs,
256  IdentifierInfo *SuperName,
257  SourceLocation SuperLoc);
258 
259  Decl *ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc,
260  IdentifierInfo *AliasName,
261  SourceLocation AliasLocation,
262  IdentifierInfo *ClassName,
263  SourceLocation ClassLocation);
264 
266  IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc,
267  const ObjCList<ObjCProtocolDecl> &PList);
268 
270  SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
271  SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
272  unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
273  SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList,
274  SkipBodyInfo *SkipBody);
275 
277  SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName,
278  SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
279  const IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
280  Decl *const *ProtoRefs, unsigned NumProtoRefs,
281  const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
282  const ParsedAttributesView &AttrList);
283 
285  SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName,
286  SourceLocation ClassLoc, const IdentifierInfo *SuperClassname,
287  SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
288 
290  SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName,
291  SourceLocation ClassLoc, const IdentifierInfo *CatName,
292  SourceLocation CatLoc, const ParsedAttributesView &AttrList);
293 
295 
297  ArrayRef<Decl *> Decls);
298 
301  ArrayRef<IdentifierLocPair> IdentList,
302  const ParsedAttributesView &attrList);
303 
304  void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
305  ArrayRef<IdentifierLocPair> ProtocolId,
306  SmallVectorImpl<Decl *> &Protocols);
307 
309  SourceLocation ProtocolLoc,
310  IdentifierInfo *TypeArgId,
311  SourceLocation TypeArgLoc,
312  bool SelectProtocolFirst = false);
313 
314  /// Given a list of identifiers (and their locations), resolve the
315  /// names to either Objective-C protocol qualifiers or type
316  /// arguments, as appropriate.
318  Scope *S, ParsedType baseType, SourceLocation lAngleLoc,
319  ArrayRef<IdentifierInfo *> identifiers,
320  ArrayRef<SourceLocation> identifierLocs, SourceLocation rAngleLoc,
321  SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs,
322  SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc,
323  SmallVectorImpl<Decl *> &protocols, SourceLocation &protocolRAngleLoc,
324  bool warnOnIncompleteProtocols);
325 
328 
329  Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
330  ArrayRef<Decl *> allMethods = std::nullopt,
331  ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt);
332 
333  struct ObjCArgInfo {
336  // The Type is null if no type was specified, and the DeclSpec is invalid
337  // in this case.
340 
341  /// ArgAttrs - Attribute list for this argument.
343  };
344 
346  Scope *S,
347  SourceLocation BeginLoc, // location of the + or -.
348  SourceLocation EndLoc, // location of the ; or {.
349  tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
350  ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
351  // optional arguments. The number of types/arguments is obtained
352  // from the Sel.getNumArgs().
353  ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
354  unsigned CNumArgs, // c-style args
355  const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
356  bool isVariadic, bool MethodDefinition);
357 
358  bool CheckARCMethodDecl(ObjCMethodDecl *method);
359 
360  bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
361 
362  /// Check whether the given new method is a valid override of the
363  /// given overridden method, and set any properties that should be inherited.
364  void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
365  const ObjCMethodDecl *Overridden);
366 
367  /// Describes the compatibility of a result type with its method.
372  };
373 
375  ObjCMethodDecl *overridden);
376 
377  void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
378  ObjCInterfaceDecl *CurrentClass,
380 
381  /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
382  /// pool.
384 
385  void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
386  bool isObjCMethodDecl(Decl *D) { return D && isa<ObjCMethodDecl>(D); }
387 
388  /// CheckImplementationIvars - This routine checks if the instance variables
389  /// listed in the implelementation match those listed in the interface.
391  ObjCIvarDecl **Fields, unsigned nIvars,
393 
395  ObjCMethodDecl *MethodDecl,
396  bool IsProtocolMethodDecl);
397 
399  ObjCMethodDecl *Overridden,
400  bool IsProtocolMethodDecl);
401 
402  /// WarnExactTypedMethods - This routine issues a warning if method
403  /// implementation declaration matches exactly that of its declaration.
404  void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl,
405  bool IsProtocolMethodDecl);
406 
407  /// MatchAllMethodDeclarations - Check methods declaraed in interface or
408  /// or protocol against those declared in their implementations.
410  const SelectorSet &InsMap, const SelectorSet &ClsMap,
411  SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl,
412  ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass,
413  bool WarnCategoryMethodImpl = false);
414 
415  /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
416  /// category matches with those implemented in its primary class and
417  /// warns each time an exact match is found.
419 
420  /// ImplMethodsVsClassMethods - This is main routine to warn if any method
421  /// remains unimplemented in the class or category \@implementation.
422  void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl,
423  ObjCContainerDecl *IDecl,
424  bool IncompleteImpl = false);
425 
427  SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs,
428  ArrayRef<ObjCTypeParamList *> TypeParamLists, unsigned NumElts);
429 
430  /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
431  /// true, or false, accordingly.
432  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
433  const ObjCMethodDecl *PrevMethod,
434  MethodMatchStrategy strategy = MMS_strict);
435 
436  /// Add the given method to the list of globally-known methods.
438 
439  void ReadMethodPool(Selector Sel);
441 
442  /// - Returns instance or factory methods in global method pool for
443  /// given selector. It checks the desired kind first, if none is found, and
444  /// parameter checkTheOther is set, it then checks the other kind. If no such
445  /// method or only one method is found, function returns false; otherwise, it
446  /// returns true.
447  bool
450  bool InstanceFirst, bool CheckTheOther,
451  const ObjCObjectType *TypeBound = nullptr);
452 
453  bool
455  SourceRange R, bool receiverIdOrClass,
457 
458  void
460  Selector Sel, SourceRange R,
461  bool receiverIdOrClass);
462 
463  const ObjCMethodDecl *
465  /// LookupImplementedMethodInGlobalPool - Returns the method which has an
466  /// implementation.
468 
470 
471  /// Checks that the Objective-C declaration is declared in the global scope.
472  /// Emits an error and marks the declaration as invalid if it's not declared
473  /// in the global scope.
474  bool CheckObjCDeclScope(Decl *D);
475 
476  void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
477  const IdentifierInfo *ClassName,
478  SmallVectorImpl<Decl *> &Decls);
479 
480  VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType,
481  SourceLocation StartLoc, SourceLocation IdLoc,
482  const IdentifierInfo *Id,
483  bool Invalid = false);
484 
486 
487  /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
488  /// initialization.
489  void
492 
494 
495  /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar
496  /// which backs the property is not used in the property's accessor.
498  const ObjCImplementationDecl *ImplD);
499 
500  /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
501  /// it property has a backing ivar, returns this ivar; otherwise, returns
502  /// NULL. It also returns ivar's property on success.
503  ObjCIvarDecl *
505  const ObjCPropertyDecl *&PDecl) const;
506 
507  /// AddInstanceMethodToGlobalPool - All instance methods in a translation
508  /// unit are added to a global pool. This allows us to efficiently associate
509  /// a selector with a method declaraation for purposes of typechecking
510  /// messages sent to "id" (where the class of the object is unknown).
512  bool impl = false) {
513  AddMethodToGlobalPool(Method, impl, /*instance*/ true);
514  }
515 
516  /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
517  void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl = false) {
518  AddMethodToGlobalPool(Method, impl, /*instance*/ false);
519  }
520 
522  SourceLocation NameLoc,
523  TypeSourceInfo *TSInfo);
524 
525  /// Look for an Objective-C class in the translation unit.
526  ///
527  /// \param Id The name of the Objective-C class we're looking for. If
528  /// typo-correction fixes this name, the Id will be updated
529  /// to the fixed name.
530  ///
531  /// \param IdLoc The location of the name in the translation unit.
532  ///
533  /// \param DoTypoCorrection If true, this routine will attempt typo correction
534  /// if there is no class with the given name.
535  ///
536  /// \returns The declaration of the named Objective-C class, or NULL if the
537  /// class could not be found.
539  SourceLocation IdLoc,
540  bool TypoCorrection = false);
541 
543 
544  /// SetIvarInitializers - This routine builds initialization ASTs for the
545  /// Objective-C implementation whose ivars need be initialized.
546  void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
547 
548  Decl *ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D,
549  Expr *BitWidth, tok::ObjCKeywordKind visibility);
550 
552 
553 private:
554  /// AddMethodToGlobalPool - Add an instance or factory method to the global
555  /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
556  void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
557 
558  /// LookupMethodInGlobalPool - Returns the instance or factory method and
559  /// optionally warns if there are multiple signatures.
560  ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
561  bool receiverIdOrClass,
562  bool instance);
563 
564  ///@}
565 
566  //
567  //
568  // -------------------------------------------------------------------------
569  //
570  //
571 
572  /// \name ObjC Expressions
573  /// Implementations are in SemaExprObjC.cpp
574  ///@{
575 
576 public:
577  /// Caches identifiers/selectors for NSFoundation APIs.
578  std::unique_ptr<NSAPI> NSAPIObj;
579 
580  /// The declaration of the Objective-C NSNumber class.
582 
583  /// The declaration of the Objective-C NSValue class.
585 
586  /// Pointer to NSNumber type (NSNumber *).
588 
589  /// Pointer to NSValue type (NSValue *).
591 
592  /// The Objective-C NSNumber methods used to create NSNumber literals.
594 
595  /// The declaration of the Objective-C NSString class.
597 
598  /// Pointer to NSString type (NSString *).
600 
601  /// The declaration of the stringWithUTF8String: method.
603 
604  /// The declaration of the valueWithBytes:objCType: method.
606 
607  /// The declaration of the Objective-C NSArray class.
609 
610  /// The declaration of the arrayWithObjects:count: method.
612 
613  /// The declaration of the Objective-C NSDictionary class.
615 
616  /// The declaration of the dictionaryWithObjects:forKeys:count: method.
618 
619  /// id<NSCopying> type.
621 
622  /// will hold 'respondsToSelector:'
624 
626  Expr *BaseExpr, SourceLocation OpLoc,
627  DeclarationName MemberName,
628  SourceLocation MemberLoc,
629  SourceLocation SuperLoc,
630  QualType SuperType, bool Super);
631 
633  const IdentifierInfo &propertyName,
634  SourceLocation receiverNameLoc,
635  SourceLocation propertyNameLoc);
636 
637  // ParseObjCStringLiteral - Parse Objective-C string literals.
639  ArrayRef<Expr *> Strings);
640 
642 
643  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
644  /// numeric literal expression. Type of the expression will be "NSNumber *"
645  /// or "id" if NSNumber is unavailable.
648  bool Value);
650 
651  /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
652  /// '@' prefixed parenthesized expression. The type of the expression will
653  /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
654  /// of ValueType, which is allowed to be a built-in numeric type, "char *",
655  /// "const char *" or C structure with attribute 'objc_boxable'.
657 
659  Expr *IndexExpr,
660  ObjCMethodDecl *getterMethod,
661  ObjCMethodDecl *setterMethod);
662 
663  ExprResult
666 
668  TypeSourceInfo *EncodedTypeInfo,
669  SourceLocation RParenLoc);
670 
672  SourceLocation EncodeLoc,
673  SourceLocation LParenLoc, ParsedType Ty,
674  SourceLocation RParenLoc);
675 
676  /// ParseObjCSelectorExpression - Build selector expression for \@selector
678  SourceLocation SelLoc,
679  SourceLocation LParenLoc,
680  SourceLocation RParenLoc,
681  bool WarnMultipleSelectors);
682 
683  /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
685  SourceLocation AtLoc,
686  SourceLocation ProtoLoc,
687  SourceLocation LParenLoc,
688  SourceLocation ProtoIdLoc,
689  SourceLocation RParenLoc);
690 
692 
693  /// Describes the kind of message expression indicated by a message
694  /// send that starts with an identifier.
696  /// The message is sent to 'super'.
698  /// The message is an instance message.
700  /// The message is a class message, and the identifier is a type
701  /// name.
703  };
704 
706  SourceLocation NameLoc, bool IsSuper,
707  bool HasTrailingDot,
708  ParsedType &ReceiverType);
709 
711  SourceLocation LBracLoc,
712  ArrayRef<SourceLocation> SelectorLocs,
713  SourceLocation RBracLoc, MultiExprArg Args);
714 
715  ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
716  QualType ReceiverType, SourceLocation SuperLoc,
717  Selector Sel, ObjCMethodDecl *Method,
718  SourceLocation LBracLoc,
719  ArrayRef<SourceLocation> SelectorLocs,
720  SourceLocation RBracLoc, MultiExprArg Args,
721  bool isImplicit = false);
722 
724  bool isSuperReceiver, SourceLocation Loc,
725  Selector Sel, ObjCMethodDecl *Method,
726  MultiExprArg Args);
727 
729  SourceLocation LBracLoc,
730  ArrayRef<SourceLocation> SelectorLocs,
731  SourceLocation RBracLoc, MultiExprArg Args);
732 
733  ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType,
734  SourceLocation SuperLoc, Selector Sel,
735  ObjCMethodDecl *Method,
736  SourceLocation LBracLoc,
737  ArrayRef<SourceLocation> SelectorLocs,
738  SourceLocation RBracLoc, MultiExprArg Args,
739  bool isImplicit = false);
740 
741  ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType,
743  ObjCMethodDecl *Method,
744  MultiExprArg Args);
745 
747  SourceLocation LBracLoc,
748  ArrayRef<SourceLocation> SelectorLocs,
749  SourceLocation RBracLoc, MultiExprArg Args);
750 
753  SourceLocation BridgeKeywordLoc,
754  TypeSourceInfo *TSInfo, Expr *SubExpr);
755 
758  SourceLocation BridgeKeywordLoc,
759  ParsedType Type, SourceLocation RParenLoc,
760  Expr *SubExpr);
761 
763 
765 
767  CastKind &Kind);
768 
770  QualType SrcType,
771  ObjCInterfaceDecl *&RelatedClass,
772  ObjCMethodDecl *&ClassMethod,
773  ObjCMethodDecl *&InstanceMethod,
774  TypedefNameDecl *&TDNDecl, bool CfToNs,
775  bool Diagnose = true);
776 
778  QualType SrcType, Expr *&SrcExpr,
779  bool Diagnose = true);
780 
781  /// Private Helper predicate to check for 'self'.
782  bool isSelfExpr(Expr *RExpr);
783  bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
784 
786  const ObjCObjectPointerType *OPT,
787  bool IsInstance);
789  bool IsInstance);
790 
791  bool isKnownName(StringRef name);
792 
794 
795  /// Checks for invalid conversions and casts between
796  /// retainable pointers and other pointer kinds for ARC and Weak.
798  QualType castType, Expr *&op,
800  bool Diagnose = true,
801  bool DiagnoseCFAudited = false,
802  BinaryOperatorKind Opc = BO_PtrMemD);
803 
806 
808  QualType ExprType);
809 
810  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
811  /// \param Method - May be null.
812  /// \param [out] ReturnType - The return type of the send.
813  /// \return true iff there were any incompatible types.
814  bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
815  MultiExprArg Args, Selector Sel,
816  ArrayRef<SourceLocation> SelectorLocs,
817  ObjCMethodDecl *Method, bool isClassMessage,
818  bool isSuperMessage, SourceLocation lbrac,
819  SourceLocation rbrac, SourceRange RecRange,
820  QualType &ReturnType, ExprValueKind &VK);
821 
822  /// Determine the result of a message send expression based on
823  /// the type of the receiver, the method expected to receive the message,
824  /// and the form of the message send.
825  QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
826  ObjCMethodDecl *Method, bool isClassMessage,
827  bool isSuperMessage);
828 
829  /// If the given expression involves a message send to a method
830  /// with a related result type, emit a note describing what happened.
831  void EmitRelatedResultTypeNote(const Expr *E);
832 
833  /// Given that we had incompatible pointer types in a return
834  /// statement, check whether we're in a method with a related result
835  /// type, and if so, emit a note describing what happened.
837 
838  /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
839  /// there are multiple signatures.
842  bool receiverIdOrClass = false) {
843  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
844  /*instance*/ true);
845  }
846 
847  /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
848  /// there are multiple signatures.
851  bool receiverIdOrClass = false) {
852  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
853  /*instance*/ false);
854  }
855 
856  /// The parser has read a name in, and Sema has detected that we're currently
857  /// inside an ObjC method. Perform some additional checks and determine if we
858  /// should form a reference to an ivar.
859  ///
860  /// Ideally, most of this would be done by lookup, but there's
861  /// actually quite a lot of extra work involved.
863  IdentifierInfo *II);
864 
865  /// The parser has read a name in, and Sema has detected that we're currently
866  /// inside an ObjC method. Perform some additional checks and determine if we
867  /// should form a reference to an ivar. If so, build an expression referencing
868  /// that ivar.
870  IdentifierInfo *II,
871  bool AllowBuiltinCreation = false);
872 
874 
875  /// FindCompositeObjCPointerType - Helper method to find composite type of
876  /// two objective-c pointer types of the two input expressions.
878  SourceLocation QuestionLoc);
879 
880  bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
881  bool Diagnose = true);
882 
883  /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
885 
886  ExprResult
888  SourceLocation AtLoc, SourceLocation RParen);
889 
890  /// Prepare a conversion of the given expression to an ObjC object
891  /// pointer type.
893 
894  // Note that LK_String is intentionally after the other literals, as
895  // this is used for diagnostics logic.
903  LK_None
904  };
906 
907  ///@}
908 
909  //
910  //
911  // -------------------------------------------------------------------------
912  //
913  //
914 
915  /// \name ObjC @property and @synthesize
916  /// Implementations are in SemaObjCProperty.cpp
917  ///@{
918 
919 public:
920  /// Ensure attributes are consistent with type.
921  /// \param [in, out] Attributes The attributes to check; they will
922  /// be modified to be consistent with \p PropertyTy.
923  void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc,
924  unsigned &Attributes,
925  bool propertyInPrimaryClass);
926 
927  /// Process the specified property declaration and create decls for the
928  /// setters and getters as needed.
929  /// \param property The property declaration being processed
930  void ProcessPropertyDecl(ObjCPropertyDecl *property);
931 
932  Decl *ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
933  FieldDeclarator &FD, ObjCDeclSpec &ODS,
934  Selector GetterSel, Selector SetterSel,
935  tok::ObjCKeywordKind MethodImplKind,
936  DeclContext *lexicalDC = nullptr);
937 
939  SourceLocation PropertyLoc, bool ImplKind,
940  IdentifierInfo *PropertyId,
941  IdentifierInfo *PropertyIvar,
942  SourceLocation PropertyIvarLoc,
943  ObjCPropertyQueryKind QueryKind);
944 
945  /// Called by ActOnProperty to handle \@property declarations in
946  /// class extensions.
948  Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
949  FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc,
950  Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite,
951  unsigned &Attributes, const unsigned AttributesAsWritten, QualType T,
952  TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind);
953 
954  /// Called by ActOnProperty and HandlePropertyInClassExtension to
955  /// handle creating the ObjcPropertyDecl for a category or \@interface.
958  SourceLocation LParenLoc, FieldDeclarator &FD,
959  Selector GetterSel, SourceLocation GetterNameLoc,
960  Selector SetterSel, SourceLocation SetterNameLoc,
961  const bool isReadWrite, const unsigned Attributes,
962  const unsigned AttributesAsWritten, QualType T,
963  TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind,
964  DeclContext *lexicalDC = nullptr);
965 
967  ObjCPropertyDecl *SuperProperty,
968  const IdentifierInfo *Name,
969  bool OverridingProtocolProperty);
970 
972  ObjCMethodDecl *Getter,
974 
975  /// DiagnoseUnimplementedProperties - This routine warns on those properties
976  /// which must be implemented by this implementation.
978  ObjCContainerDecl *CDecl,
979  bool SynthesizeProperties);
980 
981  /// Diagnose any null-resettable synthesized setters.
983 
984  /// DefaultSynthesizeProperties - This routine default synthesizes all
985  /// properties which must be synthesized in the class's \@implementation.
987  ObjCInterfaceDecl *IDecl,
988  SourceLocation AtEnd);
990 
991  /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
992  /// an ivar synthesized for 'Method' and 'Method' is a property accessor
993  /// declared in class 'IFace'.
995  ObjCMethodDecl *Method, ObjCIvarDecl *IV);
996 
998 
999  void
1001  const ObjCInterfaceDecl *IFD);
1002 
1003  /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
1004  /// warning) when atomic property has one but not the other user-declared
1005  /// setter or getter.
1007  ObjCInterfaceDecl *IDecl);
1008 
1009  ///@}
1010 };
1011 
1012 } // namespace clang
1013 
1014 #endif // LLVM_CLANG_SEMA_SEMAOBJC_H
int Id
Definition: ASTDiff.cpp:190
static char ID
Definition: Arena.cpp:183
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition: Redeclaration.h:18
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
SourceLocation Loc
Definition: SemaObjC.cpp:755
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TokenKind enum and support functions.
C Language Family Type Representation.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1436
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
The name of a declaration.
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1900
This represents one expression.
Definition: Expr.h:110
One of these records is kept for each identifier that is lexed.
Represents the results of name lookup.
Definition: Lookup.h:46
static const unsigned NumNSNumberLiteralMethods
Definition: NSAPI.h:191
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2326
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2542
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:947
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:897
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2594
Represents an ObjC class declaration.
Definition: DeclObjC.h:1153
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1950
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:945
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:140
Represents a pointer to an Objective C object.
Definition: Type.h:7020
Represents a class type in Objective C.
Definition: Type.h:6766
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:730
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2082
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:578
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:659
A (possibly-)qualified type.
Definition: Type.h:940
Represents a struct/union/class.
Definition: Decl.h:4171
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
Smart pointer class that efficiently represents Objective-C method names.
iterator find(Selector Sel)
Definition: SemaObjC.h:194
llvm::DenseMap< Selector, Lists >::iterator iterator
Definition: SemaObjC.h:191
int count(Selector Sel) const
Definition: SemaObjC.h:198
std::pair< ObjCMethodList, ObjCMethodList > Lists
Definition: SemaObjC.h:190
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
Definition: SemaObjC.h:195
bool isCFError(RecordDecl *D)
Definition: SemaObjC.cpp:1461
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
Definition: SemaObjC.cpp:1291
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaObjC.cpp:1284
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition: SemaObjC.h:605
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
Definition: SemaObjC.cpp:32
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
Definition: SemaObjC.cpp:194
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface.
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
Definition: SemaObjC.cpp:481
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
SemaObjC(Sema &S)
Definition: SemaObjC.cpp:25
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
Definition: SemaObjC.cpp:374
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
ObjCInterfaceDecl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
Definition: SemaObjC.cpp:1375
void updateOutOfDateSelector(Selector Sel)
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: SemaObjC.h:213
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaObjC.cpp:1265
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
ObjCImplementationDecl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, const IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
Definition: SemaObjC.cpp:321
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
Definition: SemaObjC.cpp:741
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition: SemaObjC.h:608
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition: SemaObjC.h:156
ExprResult ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
Definition: SemaObjC.cpp:1314
void CheckObjCCircularContainer(ObjCMessageExpr *Message)
Check whether receiver is mutable ObjC container which attempts to add itself into the container.
Definition: SemaObjC.cpp:1091
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
ObjCContainerKind getObjCContainerKind() const
ObjCInterfaceDecl * getObjCInterfaceDecl(const IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
ObjCContainerDecl * getObjCDeclContext() const
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: SemaObjC.h:581
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: SemaObjC.h:850
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaObjC.cpp:219
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: SemaObjC.h:584
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: SemaObjC.h:623
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition: SemaObjC.h:596
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaObjC.cpp:214
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition: SemaObjC.h:186
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
void ActOnObjCContainerFinishDefinition()
Definition: SemaObjC.cpp:1279
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition: SemaObjC.h:602
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
Definition: SemaObjC.cpp:337
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
Definition: SemaObjC.cpp:239
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition: SemaObjC.h:614
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition: SemaObjC.h:611
ObjCCategoryDecl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, const IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
QualType QIDNSCopying
id<NSCopying> type.
Definition: SemaObjC.h:620
bool CheckObjCString(Expr *Arg)
CheckObjCString - Checks that the argument to the builtin CFString constructor is correct Note: It mi...
Definition: SemaObjC.cpp:1214
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
Definition: SemaObjC.cpp:708
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
Definition: SemaObjC.cpp:283
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
ObjCCategoryImplDecl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, const IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
bool inferObjCARCLifetime(ValueDecl *decl)
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
const DeclContext * getCurObjCLexicalContext() const
Definition: SemaObjC.cpp:1256
ExprResult ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, bool Value)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: SemaObjC.h:617
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition: SemaObjC.h:599
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Find the protocol with the given name, if any.
Definition: SemaObjC.cpp:1297
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: SemaObjC.h:587
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition: SemaObjC.h:593
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: SemaObjC.h:211
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaObjC.cpp:266
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=std::nullopt, ArrayRef< DeclGroupPtrTy > allTUVars=std::nullopt)
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: SemaObjC.h:368
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver,...
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
@ OSMK_NonRetainingInit
Definition: SemaObjC.h:181
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
Definition: SemaObjC.cpp:1157
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Definition: SemaObjC.cpp:203
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition: SemaObjC.h:695
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition: SemaObjC.h:702
@ ObjCInstanceMessage
The message is an instance message.
Definition: SemaObjC.h:699
@ ObjCSuperMessage
The message is sent to 'super'.
Definition: SemaObjC.h:697
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition: SemaObjC.h:590
bool isObjCMethodDecl(Decl *D)
Definition: SemaObjC.h:386
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition: SemaObjC.h:294
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, const IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition: SemaObjC.h:517
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
Definition: SemaObjC.cpp:117
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition: SemaObjC.cpp:1443
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void DiagnoseUseOfUnimplementedSelectors()
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaObjC.cpp:330
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: SemaObjC.h:841
bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, ArrayRef< const Expr * > Args)
Definition: SemaObjC.cpp:1242
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition: SemaObjC.h:511
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
@ OCK_CategoryImplementation
Definition: SemaObjC.h:224
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
bool isKnownName(StringRef name)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition: SemaObjC.h:578
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
Definition: SemaObjC.cpp:1272
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:462
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Definition: Stmt.h:84
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1773
A container of type source information.
Definition: Type.h:7342
The base class of the type hierarchy.
Definition: Type.h:1813
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3435
Simple class containing the result of Sema::CorrectTypo.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:707
Represents a variable declaration or definition.
Definition: Decl.h:919
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition: TokenKinds.h:41
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition: TokenKinds.h:25
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
The JSON file list parser is used to communicate input to InstallAPI.
ObjCPropertyQueryKind
Definition: DeclObjC.h:718
BinaryOperatorKind
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
CastKind
CastKind - The kind of operation required for a conversion.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:129
const FunctionProtoType * T
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition: DeclObjC.h:553
CheckedConversionKind
The kind of conversion being performed.
Definition: Sema.h:440
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition: DeclSpec.h:1330
This little struct is used to capture information about structure field declarators,...
Definition: DeclSpec.h:2770
a linked list of methods with the same selector name but different signatures.
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition: SemaObjC.h:342
IdentifierInfo * Name
Definition: SemaObjC.h:334
SourceLocation NameLoc
Definition: SemaObjC.h:335