[cfe-commits] r159472 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/encode-test-6.m

Fariborz Jahanian fjahanian at apple.com
Fri Jun 29 15:54:56 PDT 2012


Author: fjahanian
Date: Fri Jun 29 17:54:56 2012
New Revision: 159472

URL: http://llvm.org/viewvc/llvm-project?rev=159472&view=rev
Log:
objective-c IRGen: fixes a crash when method type is being mangled
when an argument type size is 0. // rdar://11777609, PR13229

Added:
    cfe/trunk/test/CodeGenObjC/encode-test-6.m
Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=159472&r1=159471&r2=159472&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jun 29 17:54:56 2012
@@ -4190,8 +4190,8 @@
     QualType PType = (*PI)->getType();
     CharUnits sz = getObjCEncodingTypeSize(PType);
     if (sz.isZero())
-      return true;
-    
+      continue;
+ 
     assert (sz.isPositive() && 
         "getObjCEncodingForFunctionDecl - Incomplete param type");
     ParmOffset += sz;
@@ -4259,8 +4259,8 @@
     QualType PType = (*PI)->getType();
     CharUnits sz = getObjCEncodingTypeSize(PType);
     if (sz.isZero())
-      return true;
-    
+      continue;
+ 
     assert (sz.isPositive() && 
         "getObjCEncodingForMethodDecl - Incomplete param type");
     ParmOffset += sz;

Added: cfe/trunk/test/CodeGenObjC/encode-test-6.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test-6.m?rev=159472&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test-6.m (added)
+++ cfe/trunk/test/CodeGenObjC/encode-test-6.m Fri Jun 29 17:54:56 2012
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t %s
+// RUN: FileCheck < %t %s
+// rdar://11777609
+
+typedef struct {} Z;
+
+ at interface A
+-(void)bar:(Z)a;
+-(void)foo:(Z)a : (char*)b : (Z)c : (double) d;
+ at end
+
+ at implementation A
+-(void)bar:(Z)a {}
+-(void)foo:(Z)a: (char*)b : (Z)c : (double) d {}
+ at end
+
+// CHECK: internal global [14 x i8] c"v16 at 0:8{?=}16
+// CHECK: internal global [26 x i8] c"v32 at 0:8{?=}16*16{?=}24d24
+





More information about the cfe-commits mailing list