diff options
-rw-r--r-- | lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp | 3 | ||||
-rw-r--r-- | test/Analysis/variadic-method-types.m | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp index 60c437c1e6..2790a19c61 100644 --- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp @@ -503,7 +503,8 @@ public: bool VariadicMethodTypeChecker::isVariadicMessage(const ObjCMessage &msg) const { const ObjCMethodDecl *MD = msg.getMethodDecl(); - if (!MD || !MD->isVariadic()) + + if (!MD || !MD->isVariadic() || isa<ObjCProtocolDecl>(MD->getDeclContext())) return false; Selector S = msg.getSelector(); diff --git a/test/Analysis/variadic-method-types.m b/test/Analysis/variadic-method-types.m index 607154d32e..76a05ed9c0 100644 --- a/test/Analysis/variadic-method-types.m +++ b/test/Analysis/variadic-method-types.m @@ -81,3 +81,12 @@ void f(id a, id<P> b, C* c, C<P> *d, FooType fooType, BarType barType) { [[[NSSet alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}} } +// This previously crashed the variadic argument checker. +@protocol RDar9273215 +- (void)rdar9273215:(id)x, ...; +@end + +void test_rdar9273215(id<RDar9273215> y) { + return [y rdar9273215:y, y]; +} + |