mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
With -Wselector, don't warn about unimplemented optional method
used in @selector expression because, well, their implementation is optional. // rdar://9545564 llvm-svn: 135057
This commit is contained in:
parent
b7cdd8772c
commit
9a881019a5
@ -178,11 +178,14 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel,
|
||||
SourceRange(LParenLoc, RParenLoc));
|
||||
if (!Method)
|
||||
Diag(SelLoc, diag::warn_undeclared_selector) << Sel;
|
||||
|
||||
llvm::DenseMap<Selector, SourceLocation>::iterator Pos
|
||||
= ReferencedSelectors.find(Sel);
|
||||
if (Pos == ReferencedSelectors.end())
|
||||
ReferencedSelectors.insert(std::make_pair(Sel, SelLoc));
|
||||
|
||||
if (!Method ||
|
||||
Method->getImplementationControl() != ObjCMethodDecl::Optional) {
|
||||
llvm::DenseMap<Selector, SourceLocation>::iterator Pos
|
||||
= ReferencedSelectors.find(Sel);
|
||||
if (Pos == ReferencedSelectors.end())
|
||||
ReferencedSelectors.insert(std::make_pair(Sel, SelLoc));
|
||||
}
|
||||
|
||||
// In ARC, forbid the user from using @selector for
|
||||
// retain/release/autorelease/dealloc/retainCount.
|
||||
|
@ -27,3 +27,28 @@ SEL func()
|
||||
{
|
||||
return @selector(length); // expected-warning {{unimplemented selector 'length'}}
|
||||
}
|
||||
|
||||
// rdar://9545564
|
||||
@class MSPauseManager;
|
||||
|
||||
@protocol MSPauseManagerDelegate
|
||||
@optional
|
||||
- (void)pauseManagerDidPause:(MSPauseManager *)manager;
|
||||
- (int)respondsToSelector:(SEL)aSelector;
|
||||
@end
|
||||
|
||||
@interface MSPauseManager
|
||||
{
|
||||
id<MSPauseManagerDelegate> _delegate;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation MSPauseManager
|
||||
- (id) Meth {
|
||||
if ([_delegate respondsToSelector:@selector(pauseManagerDidPause:)])
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
@end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user