if (Ty->isComplexType())
return CGT.ConvertType(Ty);
- const RecordType *RT = Ty->getAsStructureType();
+ const RecordType *RT = Ty->getAs<RecordType>();
- if (!RT)
+ // Unions are passed in integer registers.
+ if (!RT || !RT->isStructureOrClassType())
return 0;
const RecordDecl *RD = RT->getDecl();
llvm::IntegerType *I64 = llvm::IntegerType::get(getVMContext(), 64);
SmallVector<llvm::Type*, 8> ArgList;
+ // Iterate over fields in the struct/class and check if there are any aligned
+ // double fields.
for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
i != e; ++i, ++idx) {
const QualType Ty = (*i)->getType();
LastOffset = Offset + 64;
}
- // This structure doesn't have an aligned double field.
+ // This struct/class doesn't have an aligned double field.
if (!LastOffset)
return 0;
float f;
};
+class D2 : public B0 {
+ double d2;
+};
+
extern D0 gd0;
extern D1 gd1;
+extern D2 gd2;
// CHECK: define { i64, i64 } @_Z4foo1v()
D0 foo1(void) {
return gd1;
}
+// CHECK: define void @_Z4foo32D2(i64 %a0.coerce0, double %a0.coerce1)
+void foo3(D2 a0) {
+ gd2 = a0;
+}
+
+// CHECK: define void @_Z4foo42D0(%class.D0* nocapture byval %a0)
+void foo4(D0 a0) {
+ gd0 = a0;
+}
+