Home | History | Annotate | Download | only in Sema

Lines Matching defs:Method

176   ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(Sel,
178 if (!Method)
179 Method = LookupFactoryMethodInGlobalPool(Sel,
181 if (!Method)
184 if (!Method ||
185 Method->getImplementationControl() != ObjCMethodDecl::Optional) {
249 // If we're not in an ObjC method, error out. Note that, unlike the
250 // C++ case, we don't require an instance method --- class methods
252 ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(DC);
253 if (!method)
256 ImplicitParamDecl *self = method->getSelfDecl();
273 return method;
284 ObjCMethodDecl *Method,
286 assert(Method && "Must have a method");
287 if (!Method->hasRelatedResultType())
288 return Method->getSendResultType();
290 // If a method has a related return type:
291 // - if the method found is an instance method, but the message send
292 // was a class message send, T is the declared return type of the method
294 if (Method->isInstanceMethod() && isClassMessage)
295 return stripObjCInstanceType(Context, Method->getSendResultType());
298 // enclosing method definition
311 // T is the declared return type of the method.
314 return stripObjCInstanceType(Context, Method->getSendResultType());
328 const ObjCMethodDecl *Method = MsgSend->getMethodDecl();
329 if (!Method)
332 if (!Method->hasRelatedResultType())
335 if (Context.hasSameUnqualifiedType(Method->getResultType()
340 if (!Context.hasSameUnqualifiedType(Method->getResultType(),
344 Diag(Method->getLocation(), diag::note_related_result_type_inferred)
345 << Method->isInstanceMethod() << Method->getSelector()
351 Selector Sel, ObjCMethodDecl *Method,
355 if (!Method) {
388 ReturnType = getMessageSendResultType(ReceiverType, Method, isClassMessage,
390 VK = Expr::getValueKindForType(Method->getResultType());
393 // Method might have more arguments than selector indicates. This is due
394 // to addition of c-style arguments in method.
395 if (Method->param_size() > Sel.getNumArgs())
396 NumNamedArgs = Method->param_size();
412 ParmVarDecl *param = Method->param_begin()[i];
437 if (Method->isVariadic()) {
451 << 2 /*method*/ << NumNamedArgs << NumArgs
452 << Method->getSourceRange()
459 i = Method->specific_attr_begin<NonNullAttr>(),
460 e = Method->specific_attr_end<NonNullAttr>(); i != e; ++i) {
464 DiagnoseSentinelCalls(Method, lbrac, Args, NumArgs);
469 // 'self' is objc 'self' in an objc method only.
482 // Helper method for ActOnClassMethod/ActOnInstanceMethod.
483 // Will search "local" class/category implementations for a method decl.
484 // If failed, then we search in class's root for an instance method.
485 // Returns 0 if no method is found.
488 ObjCMethodDecl *Method = 0;
490 while (ClassDecl && !Method) {
492 Method = ImpDecl->getClassMethod(Sel);
495 if (!Method)
496 Method = ClassDecl->getCategoryClassMethod(Sel);
498 // Before we give up, check if the selector is an instance method.
501 if (!Method && !ClassDecl->getSuperClass()) {
502 Method = ClassDecl->lookupInstanceMethod(Sel);
505 if (!Method)
506 Method = LookupPrivateInstanceMethod(Sel, ClassDecl);
511 return Method;
516 ObjCMethodDecl *Method = 0;
517 while (ClassDecl && !Method) {
520 Method = ImpDecl->getInstanceMethod(Sel);
523 if (!Method)
524 Method = ClassDecl->getCategoryInstanceMethod(Sel);
527 return Method;
530 /// LookupMethodInQualifiedType - Lookups up a method in protocol qualifier
757 // If the "receiver" is 'super' in a method, handle it as an expression-like
776 // Otherwise, if this is a class method, try dispatching to our
883 // Objective-C method, look for ivars. If we find one, we're done!
886 if (ObjCMethodDecl *Method = getCurMethodDecl()) {
888 if (Method->getClassInterface()->lookupInstanceVariable(Name,
929 if (ObjCMethodDecl *Method = getCurMethodDecl())
930 if (Method->getClassInterface() &&
931 Method->getClassInterface()->getSuperClass())
974 // Determine whether we are inside a method or not.
975 ObjCMethodDecl *Method = tryCaptureObjCSelf();
976 if (!Method) {
981 ObjCInterfaceDecl *Class = Method->getClassInterface();
984 << Method->getDeclName();
996 // We are in a method whose class has a superclass, so 'super'
998 if (Method->isInstanceMethod()) {
1004 // Since we are in an instance method, this is an instance
1009 Sel, /*Method=*/0,
1013 // Since we are in a class method, this is a class message to
1017 SuperLoc, Sel, /*Method=*/0,
1041 /// \param Method The method that this class message is invoking, if
1053 ObjCMethodDecl *Method,
1074 Sel, SelectorLocs, /*Method=*/0,
1090 // Find the method we are messaging.
1091 if (!Method) {
1100 Method = LookupFactoryMethodInGlobalPool(Sel,
1102 if (Method && !getLangOptions().ObjCAutoRefCount)
1103 Diag(Method->getLocation(), diag::note_method_sent_forward_class)
1104 << Method->getDeclName();
1106 if (!Method)
1107 Method = Class->lookupClassMethod(Sel);
1110 if (!Method)
1111 Method = LookupPrivateClassMethod(Sel, Class);
1113 if (Method && DiagnoseUseOfDecl(Method, Loc))
1123 if (CheckMessageArgumentTypes(ReceiverType, Args, NumArgs, Sel, Method, true,
1128 if (Method && !Method->getResultType()->isVoidType() &&
1129 RequireCompleteType(LBracLoc, Method->getResultType(),
1139 Method, makeArrayRef(Args, NumArgs),
1144 Method, makeArrayRef(Args, NumArgs),
1169 /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
1193 /// \param Method The method that this instance message is invoking, if
1205 ObjCMethodDecl *Method,
1236 SelectorLocs, /*Method=*/0,
1250 if (!Method) {
1255 Method = LookupInstanceMethodInGlobalPool(Sel,
1258 if (!Method)
1259 Method = LookupFactoryMethodInGlobalPool(Sel,
1270 Method = LookupMethodInQualifiedType(Sel, QClassTy, false);
1271 if (!Method) {
1272 Method = LookupMethodInQualifiedType(Sel, QClassTy, true);
1273 // warn if instance method found for a Class message.
1274 if (Method) {
1276 << Method->getSelector() << Sel;
1277 Diag(Method->getLocation(), diag::note_method_declared_at);
1284 Method = ClassDecl->lookupClassMethod(Sel);
1286 if (!Method)
1287 Method = LookupPrivateClassMethod(Sel, ClassDecl);
1289 if (Method && DiagnoseUseOfDecl(Method, Loc))
1292 if (!Method) {
1293 // If not messaging 'self', look for any factory method named 'Sel'.
1295 Method = LookupFactoryMethodInGlobalPool(Sel,
1298 if (!Method) {
1299 // If no class (factory) method was found, check if an _instance_
1300 // method of the same name exists in the root class only.
1301 Method = LookupInstanceMethodInGlobalPool(Sel,
1304 if (Method)
1306 dyn_cast<ObjCInterfaceDecl>(Method->getDeclContext())) {
1323 Method = LookupMethodInQualifiedType(Sel, QIdTy, true);
1324 if (!Method)
1325 Method = LookupMethodInQualifiedType(Sel, QIdTy, false);
1339 // faster than the following method (which can do *many* linear searches).
1341 Method = ClassDecl->lookupInstanceMethod(Sel);
1343 if (!Method)
1345 Method = LookupMethodInQualifiedType(Sel, OCIType, true);
1348 if (!Method) {
1350 Method = LookupPrivateInstanceMethod(Sel, ClassDecl);
1352 if (!Method && getLangOptions().ObjCAutoRefCount) {
1358 if (!Method && (!Receiver || !isSelfExpr(Receiver))) {
1359 // If we still haven't found a method, look in the global pool. This
1363 Method = LookupInstanceMethodInGlobalPool(Sel,
1367 if (Method && !forwardClass)
1373 if (Method && DiagnoseUseOfDecl(Method, Loc, forwardClass))
1405 Method,
1427 if (CheckMessageArgumentTypes(ReceiverType, Args, NumArgs, Sel, Method,
1432 if (Method && !Method->getResultType()->isVoidType() &&
1433 RequireCompleteType(LBracLoc, Method->getResultType(),
1443 (Method ? Method->getMethodFamily() : Sel.getMethodFamily());
1446 if (Method)
1447 checkInitMethod(Method, ReceiverType);
1468 if (Method && NumArgs >= 1) {
1489 // selector names a +1 method
1498 // selector names a +1 method
1521 ReceiverType, Sel, SelectorLocs, Method,
1525 Receiver, Sel, SelectorLocs, Method,
1534 ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(CurContext);
1535 if (method && method->getMethodFamily() == OMF_init) {
1565 /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
1810 ObjCMethodDecl *method;
1812 method = e->getExplicitProperty()->getGetterMethodDecl();
1814 method = e->getImplicitPropertyGetter();
1815 return checkCallToMethod(method);
1818 ACCResult checkCallToMethod(ObjCMethodDecl *method) {
1819 if (!method) return ACC_invalid;
1824 if (!isAnyRetainable(TargetClass) || !isCFType(method->getResultType()))
1827 // If the method is explicitly marked not-retained, it's +0.
1828 if (method->hasAttr<CFReturnsNotRetainedAttr>())
1831 // If the method is explicitly marked as returning retained, or its
1833 if (method->hasAttr<CFReturnsRetainedAttr>())
1836 switch (method->getSelector().getMethodFamily()) {