clang 20.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"
29#include "clang/Sema/DeclSpec.h"
30#include "clang/Sema/Lookup.h"
34#include "clang/Sema/Scope.h"
35#include "clang/Sema/SemaBase.h"
36#include "llvm/ADT/DenseMap.h"
37#include "llvm/ADT/MapVector.h"
38#include "llvm/ADT/SmallPtrSet.h"
39#include <memory>
40#include <optional>
41#include <type_traits>
42#include <utility>
43
44namespace clang {
45
46enum class CheckedConversionKind;
47class ParsedAttr;
48struct SkipBodyInfo;
49
50class SemaObjC : public SemaBase {
51public:
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
139
142 RedeclarationKind Redecl = RedeclarationKind::NotForRedeclaration);
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.
154
155 /// The struct behind the CFErrorRef pointer.
156 RecordDecl *CFError = nullptr;
157 bool isCFError(RecordDecl *D);
158
160
161 bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
162
163 /// Diagnose use of %s directive in an NSString which is being passed
164 /// as formatting string to formatting method.
166 Expr **Args, unsigned NumArgs);
167
168 bool isSignedCharBool(QualType Ty);
169
171 Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder);
172
173 /// Check an Objective-C dictionary literal being converted to the given
174 /// target type.
175 void checkDictionaryLiteral(QualType TargetType,
176 ObjCDictionaryLiteral *DictionaryLiteral);
177
178 /// Check an Objective-C array literal being converted to the given
179 /// target type.
180 void checkArrayLiteral(QualType TargetType, ObjCArrayLiteral *ArrayLiteral);
181
182private:
183 IdentifierInfo *Ident_NSError = nullptr;
184
185 //
186 //
187 // -------------------------------------------------------------------------
188 //
189 //
190
191 /// \name ObjC Declarations
192 /// Implementations are in SemaDeclObjC.cpp
193 ///@{
194
195public:
203 };
204
205 /// Method selectors used in a \@selector expression. Used for implementation
206 /// of -Wselector.
207 llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
208
210 public:
211 using Lists = std::pair<ObjCMethodList, ObjCMethodList>;
212 using iterator = llvm::DenseMap<Selector, Lists>::iterator;
213 iterator begin() { return Methods.begin(); }
214 iterator end() { return Methods.end(); }
215 iterator find(Selector Sel) { return Methods.find(Sel); }
216 std::pair<iterator, bool> insert(std::pair<Selector, Lists> &&Val) {
217 return Methods.insert(Val);
218 }
219 int count(Selector Sel) const { return Methods.count(Sel); }
220 bool empty() const { return Methods.empty(); }
221
222 private:
223 llvm::DenseMap<Selector, Lists> Methods;
224 };
225
226 /// Method Pool - allows efficient lookup when typechecking messages to "id".
227 /// We need to maintain a list, since selectors can have differing signatures
228 /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
229 /// of selectors are "overloaded").
230 /// At the head of the list it is recorded whether there were 0, 1, or >= 2
231 /// methods inside categories with a particular selector.
233
235
237
246 };
248
250 SourceLocation varianceLoc, unsigned index,
251 IdentifierInfo *paramName,
252 SourceLocation paramLoc,
253 SourceLocation colonLoc, ParsedType typeBound);
254
256 ArrayRef<Decl *> typeParams,
257 SourceLocation rAngleLoc);
258 void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
259
261 Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
262 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
263 IdentifierInfo *SuperName, SourceLocation SuperLoc,
264 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
265 Decl *const *ProtoRefs, unsigned NumProtoRefs,
266 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
267 const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody);
268
270 Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl,
271 IdentifierInfo *ClassName, SourceLocation ClassLoc,
272 IdentifierInfo *SuperName, SourceLocation SuperLoc,
273 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange);
274
277 IdentifierInfo *SuperName,
278 SourceLocation SuperLoc);
279
280 Decl *ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc,
281 IdentifierInfo *AliasName,
282 SourceLocation AliasLocation,
283 IdentifierInfo *ClassName,
284 SourceLocation ClassLocation);
285
287 IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc,
288 const ObjCList<ObjCProtocolDecl> &PList);
289
291 SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
292 SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
293 unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
294 SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList,
295 SkipBodyInfo *SkipBody);
296
298 SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName,
299 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
300 const IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
301 Decl *const *ProtoRefs, unsigned NumProtoRefs,
302 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
303 const ParsedAttributesView &AttrList);
304
306 SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName,
307 SourceLocation ClassLoc, const IdentifierInfo *SuperClassname,
308 SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
309
311 SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName,
312 SourceLocation ClassLoc, const IdentifierInfo *CatName,
313 SourceLocation CatLoc, const ParsedAttributesView &AttrList);
314
316
318 ArrayRef<Decl *> Decls);
319
323 const ParsedAttributesView &attrList);
324
325 void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
327 SmallVectorImpl<Decl *> &Protocols);
328
330 SourceLocation ProtocolLoc,
331 IdentifierInfo *TypeArgId,
332 SourceLocation TypeArgLoc,
333 bool SelectProtocolFirst = false);
334
335 /// Given a list of identifiers (and their locations), resolve the
336 /// names to either Objective-C protocol qualifiers or type
337 /// arguments, as appropriate.
339 Scope *S, ParsedType baseType, SourceLocation lAngleLoc,
340 ArrayRef<IdentifierInfo *> identifiers,
341 ArrayRef<SourceLocation> identifierLocs, SourceLocation rAngleLoc,
342 SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs,
343 SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc,
344 SmallVectorImpl<Decl *> &protocols, SourceLocation &protocolRAngleLoc,
345 bool warnOnIncompleteProtocols);
346
349
350 Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
351 ArrayRef<Decl *> allMethods = std::nullopt,
352 ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt);
353
354 struct ObjCArgInfo {
357 // The Type is null if no type was specified, and the DeclSpec is invalid
358 // in this case.
361
362 /// ArgAttrs - Attribute list for this argument.
364 };
365
367 Scope *S,
368 SourceLocation BeginLoc, // location of the + or -.
369 SourceLocation EndLoc, // location of the ; or {.
370 tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
371 ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
372 // optional arguments. The number of types/arguments is obtained
373 // from the Sel.getNumArgs().
374 ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
375 unsigned CNumArgs, // c-style args
376 const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
377 bool isVariadic, bool MethodDefinition);
378
380
381 bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
382
383 /// Check whether the given new method is a valid override of the
384 /// given overridden method, and set any properties that should be inherited.
386 const ObjCMethodDecl *Overridden);
387
388 /// Describes the compatibility of a result type with its method.
393 };
394
396 ObjCMethodDecl *overridden);
397
399 ObjCInterfaceDecl *CurrentClass,
401
402 /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
403 /// pool.
405
407 bool isObjCMethodDecl(Decl *D) { return isa_and_nonnull<ObjCMethodDecl>(D); }
408
409 /// CheckImplementationIvars - This routine checks if the instance variables
410 /// listed in the implelementation match those listed in the interface.
412 ObjCIvarDecl **Fields, unsigned nIvars,
414
416 ObjCMethodDecl *MethodDecl,
417 bool IsProtocolMethodDecl);
418
420 ObjCMethodDecl *Overridden,
421 bool IsProtocolMethodDecl);
422
423 /// WarnExactTypedMethods - This routine issues a warning if method
424 /// implementation declaration matches exactly that of its declaration.
425 void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl,
426 bool IsProtocolMethodDecl);
427
428 /// MatchAllMethodDeclarations - Check methods declaraed in interface or
429 /// or protocol against those declared in their implementations.
431 const SelectorSet &InsMap, const SelectorSet &ClsMap,
432 SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl,
433 ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass,
434 bool WarnCategoryMethodImpl = false);
435
436 /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
437 /// category matches with those implemented in its primary class and
438 /// warns each time an exact match is found.
440
441 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
442 /// remains unimplemented in the class or category \@implementation.
444 ObjCContainerDecl *IDecl,
445 bool IncompleteImpl = false);
446
448 SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs,
449 ArrayRef<ObjCTypeParamList *> TypeParamLists, unsigned NumElts);
450
451 /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
452 /// true, or false, accordingly.
454 const ObjCMethodDecl *PrevMethod,
456
457 /// Add the given method to the list of globally-known methods.
459
460 void ReadMethodPool(Selector Sel);
462
463 /// - Returns instance or factory methods in global method pool for
464 /// given selector. It checks the desired kind first, if none is found, and
465 /// parameter checkTheOther is set, it then checks the other kind. If no such
466 /// method or only one method is found, function returns false; otherwise, it
467 /// returns true.
468 bool
471 bool InstanceFirst, bool CheckTheOther,
472 const ObjCObjectType *TypeBound = nullptr);
473
474 bool
476 SourceRange R, bool receiverIdOrClass,
478
479 void
481 Selector Sel, SourceRange R,
482 bool receiverIdOrClass);
483
484 const ObjCMethodDecl *
486 /// LookupImplementedMethodInGlobalPool - Returns the method which has an
487 /// implementation.
489
491
492 /// Checks that the Objective-C declaration is declared in the global scope.
493 /// Emits an error and marks the declaration as invalid if it's not declared
494 /// in the global scope.
496
497 void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
498 const IdentifierInfo *ClassName,
500
502 SourceLocation StartLoc, SourceLocation IdLoc,
503 const IdentifierInfo *Id,
504 bool Invalid = false);
505
507
508 /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
509 /// initialization.
510 void
513
515
516 /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar
517 /// which backs the property is not used in the property's accessor.
519 const ObjCImplementationDecl *ImplD);
520
521 /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
522 /// it property has a backing ivar, returns this ivar; otherwise, returns
523 /// NULL. It also returns ivar's property on success.
526 const ObjCPropertyDecl *&PDecl) const;
527
528 /// AddInstanceMethodToGlobalPool - All instance methods in a translation
529 /// unit are added to a global pool. This allows us to efficiently associate
530 /// a selector with a method declaraation for purposes of typechecking
531 /// messages sent to "id" (where the class of the object is unknown).
533 bool impl = false) {
534 AddMethodToGlobalPool(Method, impl, /*instance*/ true);
535 }
536
537 /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
538 void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl = false) {
539 AddMethodToGlobalPool(Method, impl, /*instance*/ false);
540 }
541
543 SourceLocation NameLoc,
544 TypeSourceInfo *TSInfo);
545
546 /// Look for an Objective-C class in the translation unit.
547 ///
548 /// \param Id The name of the Objective-C class we're looking for. If
549 /// typo-correction fixes this name, the Id will be updated
550 /// to the fixed name.
551 ///
552 /// \param IdLoc The location of the name in the translation unit.
553 ///
554 /// \param DoTypoCorrection If true, this routine will attempt typo correction
555 /// if there is no class with the given name.
556 ///
557 /// \returns The declaration of the named Objective-C class, or NULL if the
558 /// class could not be found.
560 SourceLocation IdLoc,
561 bool TypoCorrection = false);
562
564
565 /// SetIvarInitializers - This routine builds initialization ASTs for the
566 /// Objective-C implementation whose ivars need be initialized.
567 void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
568
570 Expr *BitWidth, tok::ObjCKeywordKind visibility);
571
573
574private:
575 /// AddMethodToGlobalPool - Add an instance or factory method to the global
576 /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
577 void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
578
579 /// LookupMethodInGlobalPool - Returns the instance or factory method and
580 /// optionally warns if there are multiple signatures.
581 ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
582 bool receiverIdOrClass,
583 bool instance);
584
585 ///@}
586
587 //
588 //
589 // -------------------------------------------------------------------------
590 //
591 //
592
593 /// \name ObjC Expressions
594 /// Implementations are in SemaExprObjC.cpp
595 ///@{
596
597public:
598 /// Caches identifiers/selectors for NSFoundation APIs.
599 std::unique_ptr<NSAPI> NSAPIObj;
600
601 /// The declaration of the Objective-C NSNumber class.
603
604 /// The declaration of the Objective-C NSValue class.
606
607 /// Pointer to NSNumber type (NSNumber *).
609
610 /// Pointer to NSValue type (NSValue *).
612
613 /// The Objective-C NSNumber methods used to create NSNumber literals.
615
616 /// The declaration of the Objective-C NSString class.
618
619 /// Pointer to NSString type (NSString *).
621
622 /// The declaration of the stringWithUTF8String: method.
624
625 /// The declaration of the valueWithBytes:objCType: method.
627
628 /// The declaration of the Objective-C NSArray class.
630
631 /// The declaration of the arrayWithObjects:count: method.
633
634 /// The declaration of the Objective-C NSDictionary class.
636
637 /// The declaration of the dictionaryWithObjects:forKeys:count: method.
639
640 /// id<NSCopying> type.
642
643 /// will hold 'respondsToSelector:'
645
647 Expr *BaseExpr, SourceLocation OpLoc,
648 DeclarationName MemberName,
649 SourceLocation MemberLoc,
650 SourceLocation SuperLoc,
651 QualType SuperType, bool Super);
652
654 const IdentifierInfo &propertyName,
655 SourceLocation receiverNameLoc,
656 SourceLocation propertyNameLoc);
657
658 // ParseObjCStringLiteral - Parse Objective-C string literals.
660 ArrayRef<Expr *> Strings);
661
663
664 /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
665 /// numeric literal expression. Type of the expression will be "NSNumber *"
666 /// or "id" if NSNumber is unavailable.
669 bool Value);
671
672 /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
673 /// '@' prefixed parenthesized expression. The type of the expression will
674 /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
675 /// of ValueType, which is allowed to be a built-in numeric type, "char *",
676 /// "const char *" or C structure with attribute 'objc_boxable'.
678
680 Expr *IndexExpr,
681 ObjCMethodDecl *getterMethod,
682 ObjCMethodDecl *setterMethod);
683
687
689 TypeSourceInfo *EncodedTypeInfo,
690 SourceLocation RParenLoc);
691
693 SourceLocation EncodeLoc,
694 SourceLocation LParenLoc, ParsedType Ty,
695 SourceLocation RParenLoc);
696
697 /// ParseObjCSelectorExpression - Build selector expression for \@selector
699 SourceLocation SelLoc,
700 SourceLocation LParenLoc,
701 SourceLocation RParenLoc,
702 bool WarnMultipleSelectors);
703
704 /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
706 SourceLocation AtLoc,
707 SourceLocation ProtoLoc,
708 SourceLocation LParenLoc,
709 SourceLocation ProtoIdLoc,
710 SourceLocation RParenLoc);
711
713
714 /// Describes the kind of message expression indicated by a message
715 /// send that starts with an identifier.
717 /// The message is sent to 'super'.
719 /// The message is an instance message.
721 /// The message is a class message, and the identifier is a type
722 /// name.
724 };
725
727 SourceLocation NameLoc, bool IsSuper,
728 bool HasTrailingDot,
729 ParsedType &ReceiverType);
730
732 SourceLocation LBracLoc,
733 ArrayRef<SourceLocation> SelectorLocs,
734 SourceLocation RBracLoc, MultiExprArg Args);
735
737 QualType ReceiverType, SourceLocation SuperLoc,
738 Selector Sel, ObjCMethodDecl *Method,
739 SourceLocation LBracLoc,
740 ArrayRef<SourceLocation> SelectorLocs,
741 SourceLocation RBracLoc, MultiExprArg Args,
742 bool isImplicit = false);
743
745 bool isSuperReceiver, SourceLocation Loc,
746 Selector Sel, ObjCMethodDecl *Method,
747 MultiExprArg Args);
748
750 SourceLocation LBracLoc,
751 ArrayRef<SourceLocation> SelectorLocs,
752 SourceLocation RBracLoc, MultiExprArg Args);
753
754 ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType,
755 SourceLocation SuperLoc, Selector Sel,
756 ObjCMethodDecl *Method,
757 SourceLocation LBracLoc,
758 ArrayRef<SourceLocation> SelectorLocs,
759 SourceLocation RBracLoc, MultiExprArg Args,
760 bool isImplicit = false);
761
764 ObjCMethodDecl *Method,
765 MultiExprArg Args);
766
768 SourceLocation LBracLoc,
769 ArrayRef<SourceLocation> SelectorLocs,
770 SourceLocation RBracLoc, MultiExprArg Args);
771
774 SourceLocation BridgeKeywordLoc,
775 TypeSourceInfo *TSInfo, Expr *SubExpr);
776
779 SourceLocation BridgeKeywordLoc,
780 ParsedType Type, SourceLocation RParenLoc,
781 Expr *SubExpr);
782
784
786
788 CastKind &Kind);
789
791 QualType SrcType,
792 ObjCInterfaceDecl *&RelatedClass,
793 ObjCMethodDecl *&ClassMethod,
794 ObjCMethodDecl *&InstanceMethod,
795 TypedefNameDecl *&TDNDecl, bool CfToNs,
796 bool Diagnose = true);
797
799 QualType SrcType, Expr *&SrcExpr,
800 bool Diagnose = true);
801
802 /// Private Helper predicate to check for 'self'.
803 bool isSelfExpr(Expr *RExpr);
804 bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
805
807 const ObjCObjectPointerType *OPT,
808 bool IsInstance);
810 bool IsInstance);
811
812 bool isKnownName(StringRef name);
813
815
816 /// Checks for invalid conversions and casts between
817 /// retainable pointers and other pointer kinds for ARC and Weak.
819 QualType castType, Expr *&op,
821 bool Diagnose = true,
822 bool DiagnoseCFAudited = false,
823 BinaryOperatorKind Opc = BO_PtrMemD);
824
827
829 QualType ExprType);
830
831 /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
832 /// \param Method - May be null.
833 /// \param [out] ReturnType - The return type of the send.
834 /// \return true iff there were any incompatible types.
835 bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
836 MultiExprArg Args, Selector Sel,
837 ArrayRef<SourceLocation> SelectorLocs,
838 ObjCMethodDecl *Method, bool isClassMessage,
839 bool isSuperMessage, SourceLocation lbrac,
840 SourceLocation rbrac, SourceRange RecRange,
841 QualType &ReturnType, ExprValueKind &VK);
842
843 /// Determine the result of a message send expression based on
844 /// the type of the receiver, the method expected to receive the message,
845 /// and the form of the message send.
846 QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
847 ObjCMethodDecl *Method, bool isClassMessage,
848 bool isSuperMessage);
849
850 /// If the given expression involves a message send to a method
851 /// with a related result type, emit a note describing what happened.
852 void EmitRelatedResultTypeNote(const Expr *E);
853
854 /// Given that we had incompatible pointer types in a return
855 /// statement, check whether we're in a method with a related result
856 /// type, and if so, emit a note describing what happened.
858
859 /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
860 /// there are multiple signatures.
863 bool receiverIdOrClass = false) {
864 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
865 /*instance*/ true);
866 }
867
868 /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
869 /// there are multiple signatures.
872 bool receiverIdOrClass = false) {
873 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
874 /*instance*/ false);
875 }
876
877 /// The parser has read a name in, and Sema has detected that we're currently
878 /// inside an ObjC method. Perform some additional checks and determine if we
879 /// should form a reference to an ivar.
880 ///
881 /// Ideally, most of this would be done by lookup, but there's
882 /// actually quite a lot of extra work involved.
884 IdentifierInfo *II);
885
886 /// The parser has read a name in, and Sema has detected that we're currently
887 /// inside an ObjC method. Perform some additional checks and determine if we
888 /// should form a reference to an ivar. If so, build an expression referencing
889 /// that ivar.
891 IdentifierInfo *II,
892 bool AllowBuiltinCreation = false);
893
895
896 /// FindCompositeObjCPointerType - Helper method to find composite type of
897 /// two objective-c pointer types of the two input expressions.
899 SourceLocation QuestionLoc);
900
901 bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
902 bool Diagnose = true);
903
904 /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
906
909 SourceLocation AtLoc, SourceLocation RParen);
910
911 /// Prepare a conversion of the given expression to an ObjC object
912 /// pointer type.
914
915 // Note that LK_String is intentionally after the other literals, as
916 // this is used for diagnostics logic.
924 LK_None
925 };
927
928 ///@}
929
930 //
931 //
932 // -------------------------------------------------------------------------
933 //
934 //
935
936 /// \name ObjC @property and @synthesize
937 /// Implementations are in SemaObjCProperty.cpp
938 ///@{
939
940public:
941 /// Ensure attributes are consistent with type.
942 /// \param [in, out] Attributes The attributes to check; they will
943 /// be modified to be consistent with \p PropertyTy.
945 unsigned &Attributes,
946 bool propertyInPrimaryClass);
947
948 /// Process the specified property declaration and create decls for the
949 /// setters and getters as needed.
950 /// \param property The property declaration being processed
952
955 Selector GetterSel, Selector SetterSel,
956 tok::ObjCKeywordKind MethodImplKind,
957 DeclContext *lexicalDC = nullptr);
958
960 SourceLocation PropertyLoc, bool ImplKind,
961 IdentifierInfo *PropertyId,
962 IdentifierInfo *PropertyIvar,
963 SourceLocation PropertyIvarLoc,
964 ObjCPropertyQueryKind QueryKind);
965
966 /// Called by ActOnProperty to handle \@property declarations in
967 /// class extensions.
969 Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
970 FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc,
971 Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite,
972 unsigned &Attributes, const unsigned AttributesAsWritten, QualType T,
973 TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind);
974
975 /// Called by ActOnProperty and HandlePropertyInClassExtension to
976 /// handle creating the ObjcPropertyDecl for a category or \@interface.
979 SourceLocation LParenLoc, FieldDeclarator &FD,
980 Selector GetterSel, SourceLocation GetterNameLoc,
981 Selector SetterSel, SourceLocation SetterNameLoc,
982 const bool isReadWrite, const unsigned Attributes,
983 const unsigned AttributesAsWritten, QualType T,
984 TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind,
985 DeclContext *lexicalDC = nullptr);
986
988 ObjCPropertyDecl *SuperProperty,
989 const IdentifierInfo *Name,
990 bool OverridingProtocolProperty);
991
993 ObjCMethodDecl *Getter,
995
996 /// DiagnoseUnimplementedProperties - This routine warns on those properties
997 /// which must be implemented by this implementation.
999 ObjCContainerDecl *CDecl,
1000 bool SynthesizeProperties);
1001
1002 /// Diagnose any null-resettable synthesized setters.
1004
1005 /// DefaultSynthesizeProperties - This routine default synthesizes all
1006 /// properties which must be synthesized in the class's \@implementation.
1008 ObjCInterfaceDecl *IDecl,
1009 SourceLocation AtEnd);
1011
1012 /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
1013 /// an ivar synthesized for 'Method' and 'Method' is a property accessor
1014 /// declared in class 'IFace'.
1016 ObjCMethodDecl *Method, ObjCIvarDecl *IV);
1017
1019
1020 void
1022 const ObjCInterfaceDecl *IFD);
1023
1024 /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
1025 /// warning) when atomic property has one but not the other user-declared
1026 /// setter or getter.
1028 ObjCInterfaceDecl *IDecl);
1029
1030 ///@}
1031
1032 //
1033 //
1034 // -------------------------------------------------------------------------
1035 //
1036 //
1037
1038 /// \name ObjC Attributes
1039 /// Implementations are in SemaObjC.cpp
1040 ///@{
1041
1042 bool isNSStringType(QualType T, bool AllowNSAttributedString = false);
1044
1045 void handleIBOutlet(Decl *D, const ParsedAttr &AL);
1046 void handleIBOutletCollection(Decl *D, const ParsedAttr &AL);
1047
1048 void handleSuppresProtocolAttr(Decl *D, const ParsedAttr &AL);
1049 void handleDirectAttr(Decl *D, const ParsedAttr &AL);
1050 void handleDirectMembersAttr(Decl *D, const ParsedAttr &AL);
1051 void handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL);
1052 void handleNSObject(Decl *D, const ParsedAttr &AL);
1053 void handleIndependentClass(Decl *D, const ParsedAttr &AL);
1054 void handleBlocksAttr(Decl *D, const ParsedAttr &AL);
1055 void handleReturnsInnerPointerAttr(Decl *D, const ParsedAttr &Attrs);
1056 void handleXReturnsXRetainedAttr(Decl *D, const ParsedAttr &AL);
1057 void handleRequiresSuperAttr(Decl *D, const ParsedAttr &Attrs);
1058 void handleNSErrorDomain(Decl *D, const ParsedAttr &Attr);
1059 void handleBridgeAttr(Decl *D, const ParsedAttr &AL);
1060 void handleBridgeMutableAttr(Decl *D, const ParsedAttr &AL);
1061 void handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL);
1062 void handleDesignatedInitializer(Decl *D, const ParsedAttr &AL);
1063 void handleRuntimeName(Decl *D, const ParsedAttr &AL);
1064 void handleBoxable(Decl *D, const ParsedAttr &AL);
1065 void handleOwnershipAttr(Decl *D, const ParsedAttr &AL);
1066 void handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL);
1068
1069 void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
1071 bool IsTemplateInstantiation);
1072
1073 /// \return whether the parameter is a pointer to OSObject pointer.
1074 bool isValidOSObjectOutParameter(const Decl *D);
1076
1079
1080 ///@}
1081};
1082
1083} // namespace clang
1084
1085#endif // LLVM_CLANG_SEMA_SEMAOBJC_H
static char ID
Definition: Arena.cpp:183
const Decl * D
Expr * E
enum clang::sema::@1651::IndirectLocalPathEntry::EntryKind Kind
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
uint32_t Id
Definition: SemaARM.cpp:1143
SourceLocation Loc
Definition: SemaObjC.cpp:758
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.
Attr - This represents one attribute.
Definition: Attr.h:42
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1425
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
This represents a decl that may have a name.
Definition: Decl.h:249
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition: ExprObjC.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
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:309
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
ObjCList - This is a simple template class used to hold various lists of decls etc,...
Definition: DeclObjC.h:82
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:7392
Represents a class type in Objective C.
Definition: Type.h:7138
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
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
A (possibly-)qualified type.
Definition: Type.h:941
Represents a struct/union/class.
Definition: Decl.h:4141
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.
A generic diagnostic builder for errors which may or may not be deferred.
Definition: SemaBase.h:110
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
Definition: SemaObjC.h:216
iterator find(Selector Sel)
Definition: SemaObjC.h:215
llvm::DenseMap< Selector, Lists >::iterator iterator
Definition: SemaObjC.h:212
int count(Selector Sel) const
Definition: SemaObjC.h:219
std::pair< ObjCMethodList, ObjCMethodList > Lists
Definition: SemaObjC.h:211
bool isCFError(RecordDecl *D)
Definition: SemaObjC.cpp:1464
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
Definition: SemaObjC.cpp:1294
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaObjC.cpp:1287
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
void handleRuntimeName(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2105
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 handleNSObject(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1661
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)
bool isValidOSObjectOutParameter(const Decl *D)
Definition: SemaObjC.cpp:1808
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:626
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:35
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
Definition: SemaObjC.cpp:197
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 handleNSErrorDomain(Decl *D, const ParsedAttr &Attr)
Definition: SemaObjC.cpp:1992
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.
void handleXReturnsXRetainedAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1817
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:484
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
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:377
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.
void checkArrayLiteral(QualType TargetType, ObjCArrayLiteral *ArrayLiteral)
Check an Objective-C array literal being converted to the given target type.
Definition: SemaObjC.cpp:2356
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)
void handleExternallyRetainedAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2222
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:1378
void updateOutOfDateSelector(Selector Sel)
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: SemaObjC.h:234
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaObjC.cpp:1268
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)
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: SemaObjC.h:862
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:324
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:744
void handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1634
void handleIndependentClass(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1686
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:629
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)
void handleIBOutlet(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1548
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
void handleReturnsInnerPointerAttr(Decl *D, const ParsedAttr &Attrs)
Definition: SemaObjC.cpp:1946
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:1317
void CheckObjCCircularContainer(ObjCMessageExpr *Message)
Check whether receiver is mutable ObjC container which attempts to add itself into the container.
Definition: SemaObjC.cpp:1094
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
void handleSuppresProtocolAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1601
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: SemaObjC.h:602
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaObjC.cpp:222
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
void handleOwnershipAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2139
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: SemaObjC.h:605
bool isSignedCharBool(QualType Ty)
Definition: SemaObjC.cpp:2307
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: SemaObjC.h:644
void handleBlocksAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1701
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:617
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaObjC.cpp:217
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:207
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: SemaObjC.h:871
void ActOnObjCContainerFinishDefinition()
Definition: SemaObjC.cpp:1282
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition: SemaObjC.h:623
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:340
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:242
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 handleBridgeMutableAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2052
Sema::RetainOwnershipKind parsedAttrToRetainOwnershipKind(const ParsedAttr &AL)
Definition: SemaObjC.cpp:1773
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 ...
void handleRequiresSuperAttr(Decl *D, const ParsedAttr &Attrs)
Definition: SemaObjC.cpp:1972
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:635
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition: SemaObjC.h:632
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:641
bool CheckObjCString(Expr *Arg)
CheckObjCString - Checks that the argument to the builtin CFString constructor is correct Note: It mi...
Definition: SemaObjC.cpp:1217
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:711
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:286
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 AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, Sema::RetainOwnershipKind K, bool IsTemplateInstantiation)
Definition: SemaObjC.cpp:1739
void adornBoolConversionDiagWithTernaryFixit(Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder)
Definition: SemaObjC.cpp:2312
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:1259
void handleDesignatedInitializer(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2079
void handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2064
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 ...
void handleIBOutletCollection(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1555
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: SemaObjC.h:638
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:620
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:1300
void DiagnoseCStringFormatDirectiveInCFAPI(const NamedDecl *FDecl, Expr **Args, unsigned NumArgs)
Diagnose use of s directive in an NSString which is being passed as formatting string to formatting m...
Definition: SemaObjC.cpp:2270
bool isCFStringType(QualType T)
Definition: SemaObjC.cpp:1508
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: SemaObjC.h:608
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:614
void handleDirectAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1612
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: SemaObjC.h:232
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaObjC.cpp:269
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:389
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:202
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:1160
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Definition: SemaObjC.cpp:206
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition: SemaObjC.h:716
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition: SemaObjC.h:723
@ ObjCInstanceMessage
The message is an instance message.
Definition: SemaObjC.h:720
@ ObjCSuperMessage
The message is sent to 'super'.
Definition: SemaObjC.h:718
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:611
bool isNSStringType(QualType T, bool AllowNSAttributedString=false)
Definition: SemaObjC.cpp:1489
bool isObjCMethodDecl(Decl *D)
Definition: SemaObjC.h:407
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:315
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
Definition: SemaObjC.cpp:2258
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:538
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:120
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition: SemaObjC.cpp:1446
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 checkDictionaryLiteral(QualType TargetType, ObjCDictionaryLiteral *DictionaryLiteral)
Check an Objective-C dictionary literal being converted to the given target type.
Definition: SemaObjC.cpp:2381
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 handleBoxable(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2117
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
Definition: SemaObjC.cpp:1797
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:333
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.
void handleDirectMembersAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1626
bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, ArrayRef< const Expr * > Args)
Definition: SemaObjC.cpp:1245
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:532
void handleBridgeAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2025
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
@ OCK_CategoryImplementation
Definition: SemaObjC.h:245
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
void handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2148
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:599
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
Definition: SemaObjC.cpp:1275
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:535
RetainOwnershipKind
Definition: Sema.h:4606
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:1778
A container of type source information.
Definition: Type.h:7714
The base class of the type hierarchy.
Definition: Type.h:1829
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3405
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:667
Represents a variable declaration or definition.
Definition: Decl.h:879
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
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
The JSON file list parser is used to communicate input to InstallAPI.
ObjCPropertyQueryKind
Definition: DeclObjC.h:718
BinaryOperatorKind
@ Property
The type of a property.
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:456
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:363
IdentifierInfo * Name
Definition: SemaObjC.h:355
SourceLocation NameLoc
Definition: SemaObjC.h:356