]> granicus.if.org Git - clang/commitdiff
Fix a clang crash caused by incorrect user code.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 24 Jun 2009 17:00:18 +0000 (17:00 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 24 Jun 2009 17:00:18 +0000 (17:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74080 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
test/Parser/check-syntax-1.m

index cb7fe58807af124f9d91ac2d3599c97a31bca917..013e26b891e1ba5d083d41bec7080639a000ba3d 100644 (file)
@@ -771,10 +771,12 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
   if (getLang().ObjC2 && Tok.is(tok::kw___attribute)) 
     MethodAttrs = ParseAttributes();
   
+  if (KeyIdents.size() == 0)
+    return DeclPtrTy();
   Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
                                                    &KeyIdents[0]);
   return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(),
-                                        mType, IDecl, DSRet, ReturnType, Sel, 
+                                        mType, IDecl, DSRet, ReturnType, Sel,
                                         &ArgInfos[0], CargNames, MethodAttrs,
                                         MethodImplKind, isVariadic);
 }
index f4aa430cde18fa965748681b11f2ce572e3d04df..af1b7a8b714ac7fabd8b4f3c246e38c05187f3e1 100644 (file)
@@ -2,3 +2,10 @@
 
 int @interface bla  ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
 @end
+
+typedef float CGFloat;
+@interface XNSNumber 
++ (XNSNumber *) numberWithCGFloat  : (CGFloat) float; // expected-error {{expected identifier}}  \
+                                                      // expected-error {{ expected ';' after method prototype}}
+@end
+