Don't attribute in file headers anymore. See llvmdev for the
[oota-llvm.git] / include / llvm / Support / AlignOf.h
index f27ecdd7130ffd929846ed9b28a71e7ac10326f4..26592b9ef6e4d4855eb752451dd78b78e60a7c36 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Ted Kremenek and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -15,8 +15,6 @@
 #ifndef LLVM_SUPPORT_ALIGNOF_H
 #define LLVM_SUPPORT_ALIGNOF_H
 
-#include <cassert>
-
 namespace llvm {
   
 template <typename T>
@@ -38,6 +36,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