Extend getPreferredTypeAlign to handle _Complex double and long long 
correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72401 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index ccbea26..32adf3a 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -563,11 +563,14 @@
 /// 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;
 }