aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-06-24 17:00:18 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-06-24 17:00:18 +0000
commit3688fc679389d67b6755e62406998f9ea84d886a (patch)
tree25b42e18135a0b86418e14a3b64a3d61b9815e34
parent34d1dc9f0ca8f5b0528a8cd29f1addfe096361b8 (diff)
Fix a clang crash caused by incorrect user code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74080 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseObjc.cpp4
-rw-r--r--test/Parser/check-syntax-1.m7
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index cb7fe58807..013e26b891 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/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/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
index f4aa430cde..af1b7a8b71 100644
--- a/test/Parser/check-syntax-1.m
+++ b/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
+