mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
When unknown method is sent to a receiver of
'Class' type, disgnostic should refere to a class method. Fixes // rdar://8592156 llvm-svn: 120517
This commit is contained in:
parent
ce81496fab
commit
68500913ec
@ -1075,7 +1075,9 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||
Expr **Args = reinterpret_cast<Expr **>(ArgsIn.release());
|
||||
QualType ReturnType;
|
||||
ExprValueKind VK = VK_RValue;
|
||||
if (CheckMessageArgumentTypes(Args, NumArgs, Sel, Method, false,
|
||||
bool ClassMessage = (ReceiverType->isObjCClassType() ||
|
||||
ReceiverType->isObjCQualifiedClassType());
|
||||
if (CheckMessageArgumentTypes(Args, NumArgs, Sel, Method, ClassMessage,
|
||||
LBracLoc, RBracLoc, ReturnType, VK))
|
||||
return ExprError();
|
||||
|
||||
|
@ -35,7 +35,7 @@ id objc_getClass(const char *s);
|
||||
@implementation Derived
|
||||
+ (int) class_func1
|
||||
{
|
||||
int i = (size_t)[self class_func0]; // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}}
|
||||
int i = (size_t)[self class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
|
||||
return i + (size_t)[super class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
|
||||
}
|
||||
+ (int) class_func2
|
||||
|
@ -20,7 +20,7 @@
|
||||
[self rootInstanceMethod]; /* class is searched for an instance method */
|
||||
[MyIntermediate rootInstanceMethod]; /* with the same name. */
|
||||
|
||||
[self instanceMethod];// expected-warning {{'-instanceMethod' not found (return type defaults to 'id')}}
|
||||
[self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
|
||||
[MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
|
||||
}
|
||||
@end
|
||||
|
10
clang/test/SemaObjC/method-lookup-5.m
Normal file
10
clang/test/SemaObjC/method-lookup-5.m
Normal file
@ -0,0 +1,10 @@
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// rdar://8592156
|
||||
|
||||
typedef struct objc_class *Class;
|
||||
@interface A
|
||||
-(Class) foo;
|
||||
@end
|
||||
|
||||
void f0(A *a) { int x = [[a foo] baz]; } // expected-warning {{method '+baz' not found (return type defaults to 'id')}} \
|
||||
// expected-warning {{ncompatible pointer to integer conversion initializing 'int' with an expression of type 'id'}}
|
@ -22,7 +22,7 @@ typedef int NSInteger;
|
||||
static NSMutableArray * recentCompletions = ((void *)0);
|
||||
+ (float) factorForRecentCompletion:(NSString *) completion
|
||||
{
|
||||
for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '-completionItems' not found (return type defaults to 'id')}}
|
||||
for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '+completionItems' not found (return type defaults to 'id')}}
|
||||
{
|
||||
if ([item respondsToSelector:@selector(setPriority:)])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user