From: Douglas Gregor Date: Sat, 7 Aug 2010 12:29:18 +0000 (+0000) Subject: Fix an Objective-C crasher, PR7839. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=59c451ef236ec5af8fecc7291f5cb87a3ea6e799;p=clang Fix an Objective-C crasher, PR7839. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110515 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 06f3642c27..9e0d250536 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1532,7 +1532,8 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( Param->setInvalidDecl(); } Param->setDeclContext(ObjCMethod); - IdResolver.RemoveDecl(Param); + if (Param->getDeclName()) + IdResolver.RemoveDecl(Param); Params.push_back(Param); } diff --git a/test/SemaObjC/protocols.m b/test/SemaObjC/protocols.m index 8447fe2aad..ca38f20fbd 100644 --- a/test/SemaObjC/protocols.m +++ b/test/SemaObjC/protocols.m @@ -61,3 +61,7 @@ @protocol B < A > // expected-error{{protocol has circular dependency}} @end +@protocol P +- (int)test:(int)param, ..; // expected-warning{{type specifier missing}} \ + // expected-error{{expected ';' after method prototype}} +@end