]> granicus.if.org Git - clang/commitdiff
Fix a crash encoding ivars of vector types and
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 7 Oct 2010 21:25:25 +0000 (21:25 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 7 Oct 2010 21:25:25 +0000 (21:25 +0000)
to match gcc's encoding. Fixes //rdar: // 8519948.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115980 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/CodeGenObjCXX/encode.mm

index cf75474a19fbac2aefe395e63321bc9d4a074cc7..0e549dddcd74d5e88f04384b4e0fb1bfa9ac499e 100644 (file)
@@ -3894,7 +3894,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
     S += RDecl->isUnion() ? ')' : '}';
     return;
   }
-
+  
   if (T->isEnumeralType()) {
     if (FD && FD->isBitField())
       EncodeBitField(this, S, T, FD);
@@ -3997,7 +3997,14 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
   // TODO: maybe there should be a mangling for these
   if (T->getAs<MemberPointerType>())
     return;
-
+  
+  if (T->isVectorType()) {
+    // This matches gcc's encoding, even though technically it is
+    // insufficient.
+    // FIXME. We should do a better job than gcc.
+    return;
+  }
+  
   assert(0 && "@encode for type not implemented!");
 }
 
index 83fb31e16d58e8528eb64faf2761fa64cc15e1fb..5a49feb706c9ac0bac7c5bab74d029ba42f633e0 100644 (file)
@@ -50,3 +50,15 @@ class Int3 { int x, y, z; };
 - (void) foo: (int (Int3::*)) member {
 }
 @end
+
+// rdar: // 8519948
+typedef float HGVec4f __attribute__ ((vector_size(16)));
+
+@interface RedBalloonHGXFormWrapper {
+  HGVec4f m_Transform[4];
+}
+@end
+
+@implementation RedBalloonHGXFormWrapper
+@end
+