diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-24 17:00:18 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-06-24 17:00:18 +0000 |
| commit | 6e9e4f3436244c14fb204e3bdd2d0d69eab1433e (patch) | |
| tree | aa91aacf2e27fd18dc211466399d8b67c8ce09ff | |
| parent | 23061ded5618a6ed2e25d7ae2066f018ea564c77 (diff) | |
| download | bcm5719-llvm-6e9e4f3436244c14fb204e3bdd2d0d69eab1433e.tar.gz bcm5719-llvm-6e9e4f3436244c14fb204e3bdd2d0d69eab1433e.zip | |
Fix a clang crash caused by incorrect user code.
llvm-svn: 74080
| -rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Parser/check-syntax-1.m | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index cb7fe58807a..013e26b891e 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -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); } diff --git a/clang/test/Parser/check-syntax-1.m b/clang/test/Parser/check-syntax-1.m index f4aa430cde1..af1b7a8b714 100644 --- a/clang/test/Parser/check-syntax-1.m +++ b/clang/test/Parser/check-syntax-1.m @@ -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 + |

