/// a data type.
unsigned ASTContext::getPreferredTypeAlign(const Type *T) {
unsigned ABIAlign = getTypeAlign(T);
-
- // Doubles should be naturally aligned if possible.
- if (T->isSpecificBuiltinType(BuiltinType::Double))
- return std::max(ABIAlign, 64U);
-
+
+ // Double and long long should be naturally aligned if possible.
+ if (const ComplexType* CT = T->getAsComplexType())
+ T = CT->getElementType().getTypePtr();
+ if (T->isSpecificBuiltinType(BuiltinType::Double) ||
+ T->isSpecificBuiltinType(BuiltinType::LongLong))
+ return std::max(ABIAlign, (unsigned)getTypeSize(T));
+
return ABIAlign;
}
// PR3433
double g1;
short chk1[__alignof__(g1) == 8 ? 1 : -1];
-short chk2[__alignof__(double) == 8 ? 1 : -1];
+short chk2[__alignof__(double) == 8 ? 1 : -1];
+
+long long g2;
+short chk1[__alignof__(g2) == 8 ? 1 : -1];
+short chk2[__alignof__(long long) == 8 ? 1 : -1];
+
+_Complex double g3;
+short chk1[__alignof__(g3) == 8 ? 1 : -1];
+short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];