diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 5 | ||||
| -rw-r--r-- | clang/test/PCH/Inputs/chain-selectors2.h | 2 | ||||
| -rw-r--r-- | clang/test/SemaObjC/selector-3.m | 4 | ||||
| -rw-r--r-- | clang/test/SemaObjC/selector-4.m | 28 |
4 files changed, 35 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 037175e6015..d388a4b82e5 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -1049,8 +1049,9 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, } else DiagnoseMismatchedSelectors(*this, AtLoc, Method); - if (!Method || - Method->getImplementationControl() != ObjCMethodDecl::Optional) { + if (Method && + Method->getImplementationControl() != ObjCMethodDecl::Optional && + !getSourceManager().isInSystemHeader(Method->getLocation())) { llvm::DenseMap<Selector, SourceLocation>::iterator Pos = ReferencedSelectors.find(Sel); if (Pos == ReferencedSelectors.end()) diff --git a/clang/test/PCH/Inputs/chain-selectors2.h b/clang/test/PCH/Inputs/chain-selectors2.h index d54244de617..741da9288a0 100644 --- a/clang/test/PCH/Inputs/chain-selectors2.h +++ b/clang/test/PCH/Inputs/chain-selectors2.h @@ -1,6 +1,8 @@ @interface Y -(void)f; -(void)f2; + -(void)x; + -(void)y; -(void)e; @end diff --git a/clang/test/SemaObjC/selector-3.m b/clang/test/SemaObjC/selector-3.m index c934dbcd8df..dfd216a16fa 100644 --- a/clang/test/SemaObjC/selector-3.m +++ b/clang/test/SemaObjC/selector-3.m @@ -14,7 +14,7 @@ - (void) foo { SEL a,b,c; - a = @selector(b1ar); // expected-warning {{no method with selector 'b1ar' is implemented in this translation unit}} + a = @selector(b1ar); b = @selector(bar); } @end @@ -69,7 +69,7 @@ extern SEL MySelector(SEL s); @implementation INTF - (void) Meth { - if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) // expected-warning {{no method with selector '_setQueue:' is implemented in this translation unit}} + if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) { } diff --git a/clang/test/SemaObjC/selector-4.m b/clang/test/SemaObjC/selector-4.m new file mode 100644 index 00000000000..59a8233f6bc --- /dev/null +++ b/clang/test/SemaObjC/selector-4.m @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -Wselector -x objective-c %s -include %s -verify +// expected-no-diagnostics +// rdar://16600230 + +#ifndef INCLUDED +#define INCLUDED + +#pragma clang system_header + +@interface NSObject @end +@interface NSString @end + +@interface NSString (NSStringExtensionMethods) +- (void)compare:(NSString *)string; +@end + +@interface MyObject : NSObject +@end + +#else +int main() { + (void)@selector(compare:); +} + +@implementation MyObject + +@end +#endif |

