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/ASTFwd.h"
17#include "clang/AST/DeclObjC.h"
18#include "clang/AST/NSAPI.h"
20#include "clang/AST/Type.h"
22#include "clang/Basic/LLVM.h"
26#include "clang/Sema/DeclSpec.h"
30#include "clang/Sema/Sema.h"
31#include "clang/Sema/SemaBase.h"
32#include "llvm/ADT/DenseMap.h"
33#include "llvm/ADT/MapVector.h"
34#include "llvm/ADT/SmallPtrSet.h"
35#include <memory>
36#include <optional>
37#include <utility>
38
39namespace clang {
40
41class AttributeCommonInfo;
42class AvailabilitySpec;
43enum class CheckedConversionKind;
44class DeclGroupRef;
45class LookupResult;
46struct ObjCDictionaryElement;
47class ParsedAttr;
48class ParsedAttributesView;
49class Scope;
50struct SkipBodyInfo;
51
52class SemaObjC : public SemaBase {
53public:
54 SemaObjC(Sema &S);
55
57 Expr *collection);
59 Expr *collection,
60 SourceLocation RParenLoc);
61 /// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach
62 /// statement.
63 StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
64
66 Decl *Parm, Stmt *Body);
67
69
71 MultiStmtArg Catch, Stmt *Finally);
72
75 Scope *CurScope);
77 Expr *operand);
79 Stmt *SynchBody);
80
82
83 /// Build a an Objective-C protocol-qualified 'id' type where no
84 /// base type was specified.
86 SourceLocation lAngleLoc, ArrayRef<Decl *> protocols,
87 ArrayRef<SourceLocation> protocolLocs, SourceLocation rAngleLoc);
88
89 /// Build a specialized and/or protocol-qualified Objective-C type.
91 Scope *S, SourceLocation Loc, ParsedType BaseType,
92 SourceLocation TypeArgsLAngleLoc, ArrayRef<ParsedType> TypeArgs,
93 SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc,
94 ArrayRef<Decl *> Protocols, ArrayRef<SourceLocation> ProtocolLocs,
95 SourceLocation ProtocolRAngleLoc);
96
97 /// Build an Objective-C type parameter type.
99 SourceLocation ProtocolLAngleLoc,
101 ArrayRef<SourceLocation> ProtocolLocs,
102 SourceLocation ProtocolRAngleLoc,
103 bool FailOnError = false);
104
105 /// Build an Objective-C object pointer type.
107 QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc,
108 ArrayRef<TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc,
109 SourceLocation ProtocolLAngleLoc, ArrayRef<ObjCProtocolDecl *> Protocols,
110 ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
111 bool FailOnError, bool Rebuilding);
112
113 /// The parser has parsed the context-sensitive type 'instancetype'
114 /// in an Objective-C message declaration. Return the appropriate type.
116
117 /// checkRetainCycles - Check whether an Objective-C message send
118 /// might create an obvious retain cycle.
120 void checkRetainCycles(Expr *receiver, Expr *argument);
121 void checkRetainCycles(VarDecl *Var, Expr *Init);
122
123 bool CheckObjCString(Expr *Arg);
126 /// Check whether receiver is mutable ObjC container which
127 /// attempts to add itself into the container
129
132
133 /// Invoked when we must temporarily exit the objective-c container
134 /// scope for parsing/looking-up C constructs.
135 ///
136 /// Must be followed by a call to \see ActOnObjCReenterContainerContext
139
141
144 RedeclarationKind Redecl = RedeclarationKind::NotForRedeclaration);
145
146 bool isObjCWritebackConversion(QualType FromType, QualType ToType,
147 QualType &ConvertedType);
148
151
152 /// AddCFAuditedAttribute - Check whether we're currently within
153 /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
154 /// the appropriate attribute.
156
157 /// The struct behind the CFErrorRef pointer.
158 RecordDecl *CFError = nullptr;
159 bool isCFError(RecordDecl *D);
160
162
163 bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
164
165 /// Diagnose use of %s directive in an NSString which is being passed
166 /// as formatting string to formatting method.
168 Expr **Args, unsigned NumArgs);
169
170 bool isSignedCharBool(QualType Ty);
171
173 Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder);
174
175 /// Check an Objective-C dictionary literal being converted to the given
176 /// target type.
177 void checkDictionaryLiteral(QualType TargetType,
178 ObjCDictionaryLiteral *DictionaryLiteral);
179
180 /// Check an Objective-C array literal being converted to the given
181 /// target type.
182 void checkArrayLiteral(QualType TargetType, ObjCArrayLiteral *ArrayLiteral);
183
184private:
185 IdentifierInfo *Ident_NSError = nullptr;
186
187 //
188 //
189 // -------------------------------------------------------------------------
190 //
191 //
192
193 /// \name ObjC Declarations
194 /// Implementations are in SemaDeclObjC.cpp
195 ///@{
196
197public:
205 };
206
207 /// Method selectors used in a \@selector expression. Used for implementation
208 /// of -Wselector.
209 llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
210
212 llvm::DenseMap<Selector, std::pair<ObjCMethodList, ObjCMethodList>>;
213
214 /// Method Pool - allows efficient lookup when typechecking messages to "id".
215 /// We need to maintain a list, since selectors can have differing signatures
216 /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
217 /// of selectors are "overloaded").
218 /// At the head of the list it is recorded whether there were 0, 1, or >= 2
219 /// methods inside categories with a particular selector.
221
223
225
234 };
236
238 SourceLocation varianceLoc, unsigned index,
239 IdentifierInfo *paramName,
240 SourceLocation paramLoc,
241 SourceLocation colonLoc, ParsedType typeBound);
242
244 ArrayRef<Decl *> typeParams,
245 SourceLocation rAngleLoc);
246 void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
247
249 Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
250 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
251 IdentifierInfo *SuperName, SourceLocation SuperLoc,
252 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
253 Decl *const *ProtoRefs, unsigned NumProtoRefs,
254 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
255 const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody);
256
258 Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl,
259 IdentifierInfo *ClassName, SourceLocation ClassLoc,
260 IdentifierInfo *SuperName, SourceLocation SuperLoc,
261 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange);
262
265 IdentifierInfo *SuperName,
266 SourceLocation SuperLoc);
267
268 Decl *ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc,
269 IdentifierInfo *AliasName,
270 SourceLocation AliasLocation,
271 IdentifierInfo *ClassName,
272 SourceLocation ClassLocation);
273
275 IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc,
276 const ObjCList<ObjCProtocolDecl> &PList);
277
279 SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
280 SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
281 unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
282 SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList,
283 SkipBodyInfo *SkipBody);
284
286 SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName,
287 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
288 const IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
289 Decl *const *ProtoRefs, unsigned NumProtoRefs,
290 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
291 const ParsedAttributesView &AttrList);
292
294 SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName,
295 SourceLocation ClassLoc, const IdentifierInfo *SuperClassname,
296 SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
297
299 SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName,
300 SourceLocation ClassLoc, const IdentifierInfo *CatName,
301 SourceLocation CatLoc, const ParsedAttributesView &AttrList);
302
304
306 ArrayRef<Decl *> Decls);
307
311 const ParsedAttributesView &attrList);
312
313 void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
315 SmallVectorImpl<Decl *> &Protocols);
316
318 SourceLocation ProtocolLoc,
319 IdentifierInfo *TypeArgId,
320 SourceLocation TypeArgLoc,
321 bool SelectProtocolFirst = false);
322
323 /// Given a list of identifiers (and their locations), resolve the
324 /// names to either Objective-C protocol qualifiers or type
325 /// arguments, as appropriate.
327 Scope *S, ParsedType baseType, SourceLocation lAngleLoc,
328 ArrayRef<IdentifierInfo *> identifiers,
329 ArrayRef<SourceLocation> identifierLocs, SourceLocation rAngleLoc,
330 SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs,
331 SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc,
332 SmallVectorImpl<Decl *> &protocols, SourceLocation &protocolRAngleLoc,
333 bool warnOnIncompleteProtocols);
334
337
338 Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
339 ArrayRef<Decl *> allMethods = {},
340 ArrayRef<DeclGroupPtrTy> allTUVars = {});
341
342 struct ObjCArgInfo {
345 // The Type is null if no type was specified, and the DeclSpec is invalid
346 // in this case.
349
350 /// ArgAttrs - Attribute list for this argument.
352 };
353
355 int ParamIndex,
356 bool MethodDefinition);
357
359 Scope *S,
360 SourceLocation BeginLoc, // location of the + or -.
361 SourceLocation EndLoc, // location of the ; or {.
362 tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
363 ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
364 // optional arguments. The number of types/arguments is obtained
365 // from the Sel.getNumArgs().
366 ParmVarDecl **ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
367 unsigned CNumArgs, // c-style args
368 const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
369 bool isVariadic, bool MethodDefinition);
370
372
373 bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
374
375 /// Check whether the given new method is a valid override of the
376 /// given overridden method, and set any properties that should be inherited.
378 const ObjCMethodDecl *Overridden);
379
380 /// Describes the compatibility of a result type with its method.
385 };
386
388 ObjCMethodDecl *overridden);
389
391 ObjCInterfaceDecl *CurrentClass,
393
394 /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
395 /// pool.
397
399 bool isObjCMethodDecl(Decl *D) { return isa_and_nonnull<ObjCMethodDecl>(D); }
400
401 /// CheckImplementationIvars - This routine checks if the instance variables
402 /// listed in the implelementation match those listed in the interface.
404 ObjCIvarDecl **Fields, unsigned nIvars,
406
408 ObjCMethodDecl *MethodDecl,
409 bool IsProtocolMethodDecl);
410
412 ObjCMethodDecl *Overridden,
413 bool IsProtocolMethodDecl);
414
415 /// WarnExactTypedMethods - This routine issues a warning if method
416 /// implementation declaration matches exactly that of its declaration.
417 void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl,
418 bool IsProtocolMethodDecl);
419
420 /// MatchAllMethodDeclarations - Check methods declaraed in interface or
421 /// or protocol against those declared in their implementations.
423 const SelectorSet &InsMap, const SelectorSet &ClsMap,
424 SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl,
425 ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass,
426 bool WarnCategoryMethodImpl = false);
427
428 /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
429 /// category matches with those implemented in its primary class and
430 /// warns each time an exact match is found.
432
433 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
434 /// remains unimplemented in the class or category \@implementation.
436 ObjCContainerDecl *IDecl,
437 bool IncompleteImpl = false);
438
440 SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs,
441 ArrayRef<ObjCTypeParamList *> TypeParamLists, unsigned NumElts);
442
443 /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
444 /// true, or false, accordingly.
446 const ObjCMethodDecl *PrevMethod,
448
449 /// Add the given method to the list of globally-known methods.
451
452 void ReadMethodPool(Selector Sel);
454
455 /// - Returns instance or factory methods in global method pool for
456 /// given selector. It checks the desired kind first, if none is found, and
457 /// parameter checkTheOther is set, it then checks the other kind. If no such
458 /// method or only one method is found, function returns false; otherwise, it
459 /// returns true.
460 bool
463 bool InstanceFirst, bool CheckTheOther,
464 const ObjCObjectType *TypeBound = nullptr);
465
466 bool
468 SourceRange R, bool receiverIdOrClass,
470
471 void
473 Selector Sel, SourceRange R,
474 bool receiverIdOrClass);
475
476 const ObjCMethodDecl *
478 /// LookupImplementedMethodInGlobalPool - Returns the method which has an
479 /// implementation.
481
483
484 /// Checks that the Objective-C declaration is declared in the global scope.
485 /// Emits an error and marks the declaration as invalid if it's not declared
486 /// in the global scope.
488
489 void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
490 const IdentifierInfo *ClassName,
492
494 SourceLocation StartLoc, SourceLocation IdLoc,
495 const IdentifierInfo *Id,
496 bool Invalid = false);
497
499
500 /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
501 /// initialization.
502 void
505
507
508 /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar
509 /// which backs the property is not used in the property's accessor.
511 const ObjCImplementationDecl *ImplD);
512
513 /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
514 /// it property has a backing ivar, returns this ivar; otherwise, returns
515 /// NULL. It also returns ivar's property on success.
518 const ObjCPropertyDecl *&PDecl) const;
519
520 /// AddInstanceMethodToGlobalPool - All instance methods in a translation
521 /// unit are added to a global pool. This allows us to efficiently associate
522 /// a selector with a method declaraation for purposes of typechecking
523 /// messages sent to "id" (where the class of the object is unknown).
525 bool impl = false) {
526 AddMethodToGlobalPool(Method, impl, /*instance*/ true);
527 }
528
529 /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
530 void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl = false) {
531 AddMethodToGlobalPool(Method, impl, /*instance*/ false);
532 }
533
535 SourceLocation NameLoc,
536 TypeSourceInfo *TSInfo);
537
538 /// Look for an Objective-C class in the translation unit.
539 ///
540 /// \param Id The name of the Objective-C class we're looking for. If
541 /// typo-correction fixes this name, the Id will be updated
542 /// to the fixed name.
543 ///
544 /// \param IdLoc The location of the name in the translation unit.
545 ///
546 /// \param DoTypoCorrection If true, this routine will attempt typo correction
547 /// if there is no class with the given name.
548 ///
549 /// \returns The declaration of the named Objective-C class, or NULL if the
550 /// class could not be found.
552 SourceLocation IdLoc,
553 bool TypoCorrection = false);
554
556
557 /// SetIvarInitializers - This routine builds initialization ASTs for the
558 /// Objective-C implementation whose ivars need be initialized.
559 void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
560
562 Expr *BitWidth, tok::ObjCKeywordKind visibility);
563
565
566private:
567 /// AddMethodToGlobalPool - Add an instance or factory method to the global
568 /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
569 void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
570
571 /// LookupMethodInGlobalPool - Returns the instance or factory method and
572 /// optionally warns if there are multiple signatures.
573 ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
574 bool receiverIdOrClass,
575 bool instance);
576
577 ///@}
578
579 //
580 //
581 // -------------------------------------------------------------------------
582 //
583 //
584
585 /// \name ObjC Expressions
586 /// Implementations are in SemaExprObjC.cpp
587 ///@{
588
589public:
590 /// Caches identifiers/selectors for NSFoundation APIs.
591 std::unique_ptr<NSAPI> NSAPIObj;
592
593 /// The declaration of the Objective-C NSNumber class.
595
596 /// The declaration of the Objective-C NSValue class.
598
599 /// Pointer to NSNumber type (NSNumber *).
601
602 /// Pointer to NSValue type (NSValue *).
604
605 /// The Objective-C NSNumber methods used to create NSNumber literals.
607
608 /// The declaration of the Objective-C NSString class.
610
611 /// Pointer to NSString type (NSString *).
613
614 /// The declaration of the stringWithUTF8String: method.
616
617 /// The declaration of the valueWithBytes:objCType: method.
619
620 /// The declaration of the Objective-C NSArray class.
622
623 /// The declaration of the arrayWithObjects:count: method.
625
626 /// The declaration of the Objective-C NSDictionary class.
628
629 /// The declaration of the dictionaryWithObjects:forKeys:count: method.
631
632 /// id<NSCopying> type.
634
635 /// will hold 'respondsToSelector:'
637
639 Expr *BaseExpr, SourceLocation OpLoc,
640 DeclarationName MemberName,
641 SourceLocation MemberLoc,
642 SourceLocation SuperLoc,
643 QualType SuperType, bool Super);
644
646 const IdentifierInfo &propertyName,
647 SourceLocation receiverNameLoc,
648 SourceLocation propertyNameLoc);
649
650 // ParseObjCStringLiteral - Parse Objective-C string literals.
652 ArrayRef<Expr *> Strings);
653
655
656 /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
657 /// numeric literal expression. Type of the expression will be "NSNumber *"
658 /// or "id" if NSNumber is unavailable.
661 bool Value);
663
664 /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
665 /// '@' prefixed parenthesized expression. The type of the expression will
666 /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
667 /// of ValueType, which is allowed to be a built-in numeric type, "char *",
668 /// "const char *" or C structure with attribute 'objc_boxable'.
670
672 Expr *IndexExpr,
673 ObjCMethodDecl *getterMethod,
674 ObjCMethodDecl *setterMethod);
675
679
681 TypeSourceInfo *EncodedTypeInfo,
682 SourceLocation RParenLoc);
683
685 SourceLocation EncodeLoc,
686 SourceLocation LParenLoc, ParsedType Ty,
687 SourceLocation RParenLoc);
688
689 /// ParseObjCSelectorExpression - Build selector expression for \@selector
691 SourceLocation SelLoc,
692 SourceLocation LParenLoc,
693 SourceLocation RParenLoc,
694 bool WarnMultipleSelectors);
695
696 /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
698 SourceLocation AtLoc,
699 SourceLocation ProtoLoc,
700 SourceLocation LParenLoc,
701 SourceLocation ProtoIdLoc,
702 SourceLocation RParenLoc);
703
705
706 /// Describes the kind of message expression indicated by a message
707 /// send that starts with an identifier.
709 /// The message is sent to 'super'.
711 /// The message is an instance message.
713 /// The message is a class message, and the identifier is a type
714 /// name.
716 };
717
719 SourceLocation NameLoc, bool IsSuper,
720 bool HasTrailingDot,
721 ParsedType &ReceiverType);
722
724 SourceLocation LBracLoc,
725 ArrayRef<SourceLocation> SelectorLocs,
726 SourceLocation RBracLoc, MultiExprArg Args);
727
729 QualType ReceiverType, SourceLocation SuperLoc,
730 Selector Sel, ObjCMethodDecl *Method,
731 SourceLocation LBracLoc,
732 ArrayRef<SourceLocation> SelectorLocs,
733 SourceLocation RBracLoc, MultiExprArg Args,
734 bool isImplicit = false);
735
737 bool isSuperReceiver, SourceLocation Loc,
738 Selector Sel, ObjCMethodDecl *Method,
739 MultiExprArg Args);
740
742 SourceLocation LBracLoc,
743 ArrayRef<SourceLocation> SelectorLocs,
744 SourceLocation RBracLoc, MultiExprArg Args);
745
746 ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType,
747 SourceLocation SuperLoc, Selector Sel,
748 ObjCMethodDecl *Method,
749 SourceLocation LBracLoc,
750 ArrayRef<SourceLocation> SelectorLocs,
751 SourceLocation RBracLoc, MultiExprArg Args,
752 bool isImplicit = false);
753
756 ObjCMethodDecl *Method,
757 MultiExprArg Args);
758
760 SourceLocation LBracLoc,
761 ArrayRef<SourceLocation> SelectorLocs,
762 SourceLocation RBracLoc, MultiExprArg Args);
763
766 SourceLocation BridgeKeywordLoc,
767 TypeSourceInfo *TSInfo, Expr *SubExpr);
768
771 SourceLocation BridgeKeywordLoc,
772 ParsedType Type, SourceLocation RParenLoc,
773 Expr *SubExpr);
774
776
778
780 CastKind &Kind);
781
783 QualType SrcType,
784 ObjCInterfaceDecl *&RelatedClass,
785 ObjCMethodDecl *&ClassMethod,
786 ObjCMethodDecl *&InstanceMethod,
787 TypedefNameDecl *&TDNDecl, bool CfToNs,
788 bool Diagnose = true);
789
791 QualType SrcType, Expr *&SrcExpr,
792 bool Diagnose = true);
793
794 /// Private Helper predicate to check for 'self'.
795 bool isSelfExpr(Expr *RExpr);
796 bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
797
799 const ObjCObjectPointerType *OPT,
800 bool IsInstance);
802 bool IsInstance);
803
804 bool isKnownName(StringRef name);
805
807
808 /// Checks for invalid conversions and casts between
809 /// retainable pointers and other pointer kinds for ARC and Weak.
811 QualType castType, Expr *&op,
813 bool Diagnose = true,
814 bool DiagnoseCFAudited = false,
815 BinaryOperatorKind Opc = BO_PtrMemD);
816
819
821 QualType ExprType);
822
823 /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
824 /// \param Method - May be null.
825 /// \param [out] ReturnType - The return type of the send.
826 /// \return true iff there were any incompatible types.
827 bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
828 MultiExprArg Args, Selector Sel,
829 ArrayRef<SourceLocation> SelectorLocs,
830 ObjCMethodDecl *Method, bool isClassMessage,
831 bool isSuperMessage, SourceLocation lbrac,
832 SourceLocation rbrac, SourceRange RecRange,
833 QualType &ReturnType, ExprValueKind &VK);
834
835 /// Determine the result of a message send expression based on
836 /// the type of the receiver, the method expected to receive the message,
837 /// and the form of the message send.
838 QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
839 ObjCMethodDecl *Method, bool isClassMessage,
840 bool isSuperMessage);
841
842 /// If the given expression involves a message send to a method
843 /// with a related result type, emit a note describing what happened.
844 void EmitRelatedResultTypeNote(const Expr *E);
845
846 /// Given that we had incompatible pointer types in a return
847 /// statement, check whether we're in a method with a related result
848 /// type, and if so, emit a note describing what happened.
850
851 /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
852 /// there are multiple signatures.
855 bool receiverIdOrClass = false) {
856 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
857 /*instance*/ true);
858 }
859
860 /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
861 /// there are multiple signatures.
864 bool receiverIdOrClass = false) {
865 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
866 /*instance*/ false);
867 }
868
869 /// The parser has read a name in, and Sema has detected that we're currently
870 /// inside an ObjC method. Perform some additional checks and determine if we
871 /// should form a reference to an ivar.
872 ///
873 /// Ideally, most of this would be done by lookup, but there's
874 /// actually quite a lot of extra work involved.
876 IdentifierInfo *II);
877
878 /// The parser has read a name in, and Sema has detected that we're currently
879 /// inside an ObjC method. Perform some additional checks and determine if we
880 /// should form a reference to an ivar. If so, build an expression referencing
881 /// that ivar.
883 IdentifierInfo *II,
884 bool AllowBuiltinCreation = false);
885
887
888 /// FindCompositeObjCPointerType - Helper method to find composite type of
889 /// two objective-c pointer types of the two input expressions.
891 SourceLocation QuestionLoc);
892
893 bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
894 bool Diagnose = true);
895
896 /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
898
901 SourceLocation AtLoc, SourceLocation RParen);
902
903 /// Prepare a conversion of the given expression to an ObjC object
904 /// pointer type.
906
907 // Note that LK_String is intentionally after the other literals, as
908 // this is used for diagnostics logic.
916 LK_None
917 };
919
920 ///@}
921
922 //
923 //
924 // -------------------------------------------------------------------------
925 //
926 //
927
928 /// \name ObjC @property and @synthesize
929 /// Implementations are in SemaObjCProperty.cpp
930 ///@{
931
932public:
933 /// Ensure attributes are consistent with type.
934 /// \param [in, out] Attributes The attributes to check; they will
935 /// be modified to be consistent with \p PropertyTy.
937 unsigned &Attributes,
938 bool propertyInPrimaryClass);
939
940 /// Process the specified property declaration and create decls for the
941 /// setters and getters as needed.
942 /// \param property The property declaration being processed
944
947 Selector GetterSel, Selector SetterSel,
948 tok::ObjCKeywordKind MethodImplKind,
949 DeclContext *lexicalDC = nullptr);
950
952 SourceLocation PropertyLoc, bool ImplKind,
953 IdentifierInfo *PropertyId,
954 IdentifierInfo *PropertyIvar,
955 SourceLocation PropertyIvarLoc,
956 ObjCPropertyQueryKind QueryKind);
957
958 /// Called by ActOnProperty to handle \@property declarations in
959 /// class extensions.
961 Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
962 FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc,
963 Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite,
964 unsigned &Attributes, const unsigned AttributesAsWritten, QualType T,
965 TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind);
966
967 /// Called by ActOnProperty and HandlePropertyInClassExtension to
968 /// handle creating the ObjcPropertyDecl for a category or \@interface.
971 SourceLocation LParenLoc, FieldDeclarator &FD,
972 Selector GetterSel, SourceLocation GetterNameLoc,
973 Selector SetterSel, SourceLocation SetterNameLoc,
974 const bool isReadWrite, const unsigned Attributes,
975 const unsigned AttributesAsWritten, QualType T,
976 TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind,
977 DeclContext *lexicalDC = nullptr);
978
980 ObjCPropertyDecl *SuperProperty,
981 const IdentifierInfo *Name,
982 bool OverridingProtocolProperty);
983
985 ObjCMethodDecl *Getter,
987
988 /// DiagnoseUnimplementedProperties - This routine warns on those properties
989 /// which must be implemented by this implementation.
991 ObjCContainerDecl *CDecl,
992 bool SynthesizeProperties);
993
994 /// Diagnose any null-resettable synthesized setters.
996
997 /// DefaultSynthesizeProperties - This routine default synthesizes all
998 /// properties which must be synthesized in the class's \@implementation.
1000 ObjCInterfaceDecl *IDecl,
1001 SourceLocation AtEnd);
1003
1004 /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
1005 /// an ivar synthesized for 'Method' and 'Method' is a property accessor
1006 /// declared in class 'IFace'.
1008 ObjCMethodDecl *Method, ObjCIvarDecl *IV);
1009
1011
1012 void
1014 const ObjCInterfaceDecl *IFD);
1015
1016 /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
1017 /// warning) when atomic property has one but not the other user-declared
1018 /// setter or getter.
1020 ObjCInterfaceDecl *IDecl);
1021
1022 ///@}
1023
1024 //
1025 //
1026 // -------------------------------------------------------------------------
1027 //
1028 //
1029
1030 /// \name ObjC Attributes
1031 /// Implementations are in SemaObjC.cpp
1032 ///@{
1033
1034 bool isNSStringType(QualType T, bool AllowNSAttributedString = false);
1036
1037 void handleIBOutlet(Decl *D, const ParsedAttr &AL);
1038 void handleIBOutletCollection(Decl *D, const ParsedAttr &AL);
1039
1040 void handleSuppresProtocolAttr(Decl *D, const ParsedAttr &AL);
1041 void handleDirectAttr(Decl *D, const ParsedAttr &AL);
1042 void handleDirectMembersAttr(Decl *D, const ParsedAttr &AL);
1043 void handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL);
1044 void handleNSObject(Decl *D, const ParsedAttr &AL);
1045 void handleIndependentClass(Decl *D, const ParsedAttr &AL);
1046 void handleBlocksAttr(Decl *D, const ParsedAttr &AL);
1047 void handleReturnsInnerPointerAttr(Decl *D, const ParsedAttr &Attrs);
1048 void handleXReturnsXRetainedAttr(Decl *D, const ParsedAttr &AL);
1049 void handleRequiresSuperAttr(Decl *D, const ParsedAttr &Attrs);
1050 void handleNSErrorDomain(Decl *D, const ParsedAttr &Attr);
1051 void handleBridgeAttr(Decl *D, const ParsedAttr &AL);
1052 void handleBridgeMutableAttr(Decl *D, const ParsedAttr &AL);
1053 void handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL);
1054 void handleDesignatedInitializer(Decl *D, const ParsedAttr &AL);
1055 void handleRuntimeName(Decl *D, const ParsedAttr &AL);
1056 void handleBoxable(Decl *D, const ParsedAttr &AL);
1057 void handleOwnershipAttr(Decl *D, const ParsedAttr &AL);
1058 void handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL);
1060
1061 void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
1063 bool IsTemplateInstantiation);
1064
1065 /// \return whether the parameter is a pointer to OSObject pointer.
1066 bool isValidOSObjectOutParameter(const Decl *D);
1068
1071
1072 ///@}
1073};
1074
1075} // namespace clang
1076
1077#endif // LLVM_CLANG_SEMA_SEMAOBJC_H
Forward declaration of all AST node types.
static char ID
Definition: Arena.cpp:183
const Decl * D
Expr * E
enum clang::sema::@1718::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:1134
SourceLocation Loc
Definition: SemaObjC.cpp:759
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:43
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1435
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:1903
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:253
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Definition: ExprObjC.h:191
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2328
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2544
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:947
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:900
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:2596
Represents an ObjC class declaration.
Definition: DeclObjC.h:1153
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1951
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:941
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:140
Represents a pointer to an Objective C object.
Definition: Type.h:7580
Represents a class type in Objective C.
Definition: Type.h:7326
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:730
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2083
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
Represents a parameter to a function.
Definition: Decl.h:1725
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
A (possibly-)qualified type.
Definition: Type.h:929
Represents a struct/union/class.
Definition: Decl.h:4148
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
bool isCFError(RecordDecl *D)
Definition: SemaObjC.cpp:1465
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
Definition: SemaObjC.cpp:1295
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaObjC.cpp:1288
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:2106
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:1662
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:1809
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:618
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:36
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
Definition: SemaObjC.cpp:198
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:1993
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:1818
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:485
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:378
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:2357
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:2223
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:1379
void updateOutOfDateSelector(Selector Sel)
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: SemaObjC.h:222
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaObjC.cpp:1269
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:854
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:325
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:745
void handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1635
llvm::DenseMap< Selector, std::pair< ObjCMethodList, ObjCMethodList > > GlobalMethodPool
Definition: SemaObjC.h:212
void handleIndependentClass(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1687
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:621
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:158
ExprResult ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void handleIBOutlet(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1549
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:1947
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:1318
void CheckObjCCircularContainer(ObjCMessageExpr *Message)
Check whether receiver is mutable ObjC container which attempts to add itself into the container.
Definition: SemaObjC.cpp:1095
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...
ParmVarDecl * ActOnMethodParmDeclaration(Scope *S, ObjCArgInfo &ArgInfo, int ParamIndex, bool MethodDefinition)
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:1602
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: SemaObjC.h:594
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:223
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
void handleOwnershipAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2140
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: SemaObjC.h:597
bool isSignedCharBool(QualType Ty)
Definition: SemaObjC.cpp:2308
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: SemaObjC.h:636
void handleBlocksAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1702
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
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:609
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaObjC.cpp:218
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:209
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:863
void ActOnObjCContainerFinishDefinition()
Definition: SemaObjC.cpp:1283
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition: SemaObjC.h:615
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:341
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:243
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:2053
Sema::RetainOwnershipKind parsedAttrToRetainOwnershipKind(const ParsedAttr &AL)
Definition: SemaObjC.cpp:1774
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:1973
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:627
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition: SemaObjC.h:624
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:633
bool CheckObjCString(Expr *Arg)
CheckObjCString - Checks that the argument to the builtin CFString constructor is correct Note: It mi...
Definition: SemaObjC.cpp:1218
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:712
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:287
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:1740
void adornBoolConversionDiagWithTernaryFixit(Expr *SourceExpr, const Sema::SemaDiagnosticBuilder &Builder)
Definition: SemaObjC.cpp:2313
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:1260
void handleDesignatedInitializer(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2080
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ParmVarDecl **ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
void handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2065
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:1556
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: SemaObjC.h:630
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:612
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:1301
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:2271
bool isCFStringType(QualType T)
Definition: SemaObjC.cpp:1509
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: SemaObjC.h:600
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:606
void handleDirectAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:1613
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: SemaObjC.h:220
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaObjC.cpp:270
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: SemaObjC.h:381
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:204
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:1161
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Definition: SemaObjC.cpp:207
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition: SemaObjC.h:708
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition: SemaObjC.h:715
@ ObjCInstanceMessage
The message is an instance message.
Definition: SemaObjC.h:712
@ ObjCSuperMessage
The message is sent to 'super'.
Definition: SemaObjC.h:710
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:603
bool isNSStringType(QualType T, bool AllowNSAttributedString=false)
Definition: SemaObjC.cpp:1490
bool isObjCMethodDecl(Decl *D)
Definition: SemaObjC.h:399
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:303
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:2259
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:530
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:121
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition: SemaObjC.cpp:1447
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:2382
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:2118
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
Definition: SemaObjC.cpp:1798
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.
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods={}, ArrayRef< DeclGroupPtrTy > allTUVars={})
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:334
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:1627
bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, ArrayRef< const Expr * > Args)
Definition: SemaObjC.cpp:1246
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:524
void handleBridgeAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2026
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
@ OCK_CategoryImplementation
Definition: SemaObjC.h:233
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
void handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaObjC.cpp:2149
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:591
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
Definition: SemaObjC.cpp:1276
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:463
RetainOwnershipKind
Definition: Sema.h:4604
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:7902
The base class of the type hierarchy.
Definition: Type.h:1828
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3413
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:671
Represents a variable declaration or definition.
Definition: Decl.h:882
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:132
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:433
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition: DeclSpec.h:1333
This little struct is used to capture information about structure field declarators,...
Definition: DeclSpec.h:2773
a linked list of methods with the same selector name but different signatures.
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition: SemaObjC.h:351
IdentifierInfo * Name
Definition: SemaObjC.h:343
SourceLocation NameLoc
Definition: SemaObjC.h:344