summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-10-07 21:25:25 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-10-07 21:25:25 +0000
commite0587be735efed1bf415f3212b8f67826d986dc3 (patch)
treebf7af2808d164d57d8a58dec2d83bacb6c594664
parent5d3e724fc597e6fff4cbf1351fd04f72c03dd804 (diff)
downloadbcm5719-llvm-e0587be735efed1bf415f3212b8f67826d986dc3.tar.gz
bcm5719-llvm-e0587be735efed1bf415f3212b8f67826d986dc3.zip
Fix a crash encoding ivars of vector types and
to match gcc's encoding. Fixes //rdar: // 8519948. llvm-svn: 115980
-rw-r--r--clang/lib/AST/ASTContext.cpp11
-rw-r--r--clang/test/CodeGenObjCXX/encode.mm12
2 files changed, 21 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index cf75474a19f..0e549dddcd7 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -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!");
}
diff --git a/clang/test/CodeGenObjCXX/encode.mm b/clang/test/CodeGenObjCXX/encode.mm
index 83fb31e16d5..5a49feb706c 100644
--- a/clang/test/CodeGenObjCXX/encode.mm
+++ b/clang/test/CodeGenObjCXX/encode.mm
@@ -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
+
OpenPOWER on IntegriCloud