[PATCH] D15463: [Objective-c] Fix a crash

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 22:28:54 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255754: [Objective-c] Fix a crash that occurs when ObjCTypeParamList::back() is (authored by ahatanak).

Changed prior to commit:
  http://reviews.llvm.org/D15463?vs=42560&id=42962#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15463

Files:
  cfe/trunk/lib/Parse/ParseObjc.cpp
  cfe/trunk/test/SemaObjC/kindof.m

Index: cfe/trunk/test/SemaObjC/kindof.m
===================================================================
--- cfe/trunk/test/SemaObjC/kindof.m
+++ cfe/trunk/test/SemaObjC/kindof.m
@@ -302,3 +302,19 @@
   void processCopyable(__typeof(getSomeCopyable()) string);
   processCopyable(0); // expected-warning{{null passed to a callee that requires a non-null argument}}
 }
+
+// Check that clang doesn't crash when a type parameter is illegal.
+ at interface Array1<T> : NSObject
+ at end
+
+ at interface I1 : NSObject
+ at end
+
+ at interface Array1<__kindof I1*>(extensions1) // expected-error{{expected type parameter name}}
+ at end
+
+ at interface Array2<T1, T2, T3> : NSObject
+ at end
+
+ at interface Array2<T, T, __kindof I1*>(extensions2) // expected-error{{expected type parameter name}} expected-error{{redeclaration of type parameter 'T'}}
+ at end
Index: cfe/trunk/lib/Parse/ParseObjc.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp
+++ cfe/trunk/lib/Parse/ParseObjc.cpp
@@ -603,7 +603,7 @@
   // whether there are any protocol references.
   lAngleLoc = SourceLocation();
   rAngleLoc = SourceLocation();
-  return list;
+  return invalid ? nullptr : list;
 }
 
 /// Parse an objc-type-parameter-list.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15463.42962.patch
Type: text/x-patch
Size: 1250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151216/76e45ebd/attachment.bin>


More information about the cfe-commits mailing list