[cfe-commits] r74080 - in /cfe/trunk: lib/Parse/ParseObjc.cpp test/Parser/check-syntax-1.m

Fariborz Jahanian fjahanian at apple.com
Wed Jun 24 10:00:18 PDT 2009


Author: fjahanian
Date: Wed Jun 24 12:00:18 2009
New Revision: 74080

URL: http://llvm.org/viewvc/llvm-project?rev=74080&view=rev
Log:
Fix a clang crash caused by incorrect user code.


Modified:
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/test/Parser/check-syntax-1.m

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=74080&r1=74079&r2=74080&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed Jun 24 12:00:18 2009
@@ -771,10 +771,12 @@
   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);
 }

Modified: cfe/trunk/test/Parser/check-syntax-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/check-syntax-1.m?rev=74080&r1=74079&r2=74080&view=diff

==============================================================================
--- cfe/trunk/test/Parser/check-syntax-1.m (original)
+++ cfe/trunk/test/Parser/check-syntax-1.m Wed Jun 24 12:00:18 2009
@@ -2,3 +2,10 @@
 
 int @interface bla  ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
 @end
+
+typedef float CGFloat;
+ at interface XNSNumber 
++ (XNSNumber *) numberWithCGFloat  : (CGFloat) float; // expected-error {{expected identifier}}  \
+                                                      // expected-error {{ expected ';' after method prototype}}
+ at end
+





More information about the cfe-commits mailing list