Add getTypeAlignInChars() for use in code that works in alignments in character
units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94552 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index c1bc709..e5c4381 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -820,6 +820,15 @@
   return CharUnits::fromQuantity(getTypeSize(T) / getCharWidth());
 }
 
+/// getTypeAlign - Return the ABI-specified alignment of a type, in 
+/// characters. This method does not work on incomplete types.
+CharUnits ASTContext::getTypeAlignInChars(QualType T) {
+  return CharUnits::fromQuantity(getTypeAlign(T) / getCharWidth());
+}
+CharUnits ASTContext::getTypeAlignInChars(const Type *T) {
+  return CharUnits::fromQuantity(getTypeAlign(T) / getCharWidth());
+}
+
 /// getPreferredTypeAlign - Return the "preferred" alignment of the specified
 /// type for the current target in bits.  This can be different than the ABI
 /// alignment in cases where it is beneficial for performance to overalign