function-based interface to getting the alignment of a type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43096
91177308-0d34-0410-b5e6-
96231b3b80d8
struct AlignOf {
enum { Alignment = sizeof(AlignmentCalcImpl<T>) - sizeof(T) };
};
+
+/// alignof - A templated function that returns the mininum alignment of
+/// of a type. This provides no extra functionality beyond the AlignOf
+/// class besides some cosmetic cleanliness. Example usage:
+/// alignof<int>() returns the alignment of an int.
+template <typename T>
+static inline unsigned alignof() { return AlignOf<T>::Alignment; }
} // end namespace llvm
#endif