diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/llvm/Support/AlignOf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Support/AlignOf.h b/include/llvm/Support/AlignOf.h index f27ecdd713..0911bb84b3 100644 --- a/include/llvm/Support/AlignOf.h +++ b/include/llvm/Support/AlignOf.h @@ -38,6 +38,13 @@ template <typename T> 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 |
