Simplify and delay extracting DebugLoc elements, scope and InlinedAt, as much as...
[oota-llvm.git] / include / llvm / Support / TypeBuilder.h
index ea63da00edcdb417dcd529a2aa27c26b993d7cc4..18007789736a2b53004c379220a39fdd2f9ddfbd 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/LLVMContext.h"
 #include <limits.h>
+#include <vector>
 
 namespace llvm {
 
@@ -50,7 +51,7 @@ namespace llvm {
 ///   namespace llvm {
 ///   template<bool xcompile> class TypeBuilder<MyType, xcompile> {
 ///   public:
-///     static const StructType *get(LLVMContext &Context) {
+///     static StructType *get(LLVMContext &Context) {
 ///       // If you cache this result, be sure to cache it separately
 ///       // for each LLVMContext.
 ///       return StructType::get(
@@ -103,7 +104,7 @@ template<typename T, bool cross> class TypeBuilder<const volatile T, cross>
 // Pointers
 template<typename T, bool cross> class TypeBuilder<T*, cross> {
 public:
-  static const PointerType *get(LLVMContext &Context) {
+  static PointerType *get(LLVMContext &Context) {
     return PointerType::getUnqual(TypeBuilder<T,cross>::get(Context));
   }
 };
@@ -114,14 +115,14 @@ template<typename T, bool cross> class TypeBuilder<T&, cross> {};
 // Arrays
 template<typename T, size_t N, bool cross> class TypeBuilder<T[N], cross> {
 public:
-  static const ArrayType *get(LLVMContext &Context) {
+  static ArrayType *get(LLVMContext &Context) {
     return ArrayType::get(TypeBuilder<T, cross>::get(Context), N);
   }
 };
 /// LLVM uses an array of length 0 to represent an unknown-length array.
 template<typename T, bool cross> class TypeBuilder<T[], cross> {
 public:
-  static const ArrayType *get(LLVMContext &Context) {
+  static ArrayType *get(LLVMContext &Context) {
     return ArrayType::get(TypeBuilder<T, cross>::get(Context), 0);
   }
 };
@@ -151,7 +152,7 @@ public:
 #define DEFINE_INTEGRAL_TYPEBUILDER(T) \
 template<> class TypeBuilder<T, false> { \
 public: \
-  static const IntegerType *get(LLVMContext &Context) { \
+  static IntegerType *get(LLVMContext &Context) { \
     return IntegerType::get(Context, sizeof(T) * CHAR_BIT); \
   } \
 }; \
@@ -180,14 +181,14 @@ DEFINE_INTEGRAL_TYPEBUILDER(unsigned long long);
 template<uint32_t num_bits, bool cross>
 class TypeBuilder<types::i<num_bits>, cross> {
 public:
-  static const IntegerType *get(LLVMContext &C) {
+  static IntegerType *get(LLVMContext &C) {
     return IntegerType::get(C, num_bits);
   }
 };
 
 template<> class TypeBuilder<float, false> {
 public:
-  static const Type *get(LLVMContext& C) {
+  static Type *get(LLVMContext& C) {
     return Type::getFloatTy(C);
   }
 };
@@ -195,7 +196,7 @@ template<> class TypeBuilder<float, true> {};
 
 template<> class TypeBuilder<double, false> {
 public:
-  static const Type *get(LLVMContext& C) {
+  static Type *get(LLVMContext& C) {
     return Type::getDoubleTy(C);
   }
 };
@@ -203,32 +204,32 @@ template<> class TypeBuilder<double, true> {};
 
 template<bool cross> class TypeBuilder<types::ieee_float, cross> {
 public:
-  static const Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
+  static Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
 };
 template<bool cross> class TypeBuilder<types::ieee_double, cross> {
 public:
-  static const Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
+  static Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
 };
 template<bool cross> class TypeBuilder<types::x86_fp80, cross> {
 public:
-  static const Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
+  static Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
 };
 template<bool cross> class TypeBuilder<types::fp128, cross> {
 public:
-  static const Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
+  static Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
 };
 template<bool cross> class TypeBuilder<types::ppc_fp128, cross> {
 public:
-  static const Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
+  static Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
 };
 template<bool cross> class TypeBuilder<types::x86_mmx, cross> {
 public:
-  static const Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
+  static Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
 };
 
 template<bool cross> class TypeBuilder<void, cross> {
 public:
-  static const Type *get(LLVMContext &C) {
+  static Type *get(LLVMContext &C) {
     return Type::getVoidTy(C);
   }
 };
@@ -246,14 +247,14 @@ template<> class TypeBuilder<const volatile void*, false>
 
 template<typename R, bool cross> class TypeBuilder<R(), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
+  static FunctionType *get(LLVMContext &Context) {
     return FunctionType::get(TypeBuilder<R, cross>::get(Context), false);
   }
 };
 template<typename R, typename A1, bool cross> class TypeBuilder<R(A1), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(1);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     return FunctionType::get(TypeBuilder<R, cross>::get(Context),
@@ -263,8 +264,8 @@ public:
 template<typename R, typename A1, typename A2, bool cross>
 class TypeBuilder<R(A1, A2), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(2);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -275,8 +276,8 @@ public:
 template<typename R, typename A1, typename A2, typename A3, bool cross>
 class TypeBuilder<R(A1, A2, A3), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(3);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -290,8 +291,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
          bool cross>
 class TypeBuilder<R(A1, A2, A3, A4), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(4);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -306,8 +307,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
          typename A5, bool cross>
 class TypeBuilder<R(A1, A2, A3, A4, A5), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(5);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -321,15 +322,15 @@ public:
 
 template<typename R, bool cross> class TypeBuilder<R(...), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
+  static FunctionType *get(LLVMContext &Context) {
     return FunctionType::get(TypeBuilder<R, cross>::get(Context), true);
   }
 };
 template<typename R, typename A1, bool cross>
 class TypeBuilder<R(A1, ...), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(1);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     return FunctionType::get(TypeBuilder<R, cross>::get(Context), params, true);
@@ -338,8 +339,8 @@ public:
 template<typename R, typename A1, typename A2, bool cross>
 class TypeBuilder<R(A1, A2, ...), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(2);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -350,8 +351,8 @@ public:
 template<typename R, typename A1, typename A2, typename A3, bool cross>
 class TypeBuilder<R(A1, A2, A3, ...), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(3);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -365,8 +366,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
          bool cross>
 class TypeBuilder<R(A1, A2, A3, A4, ...), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(4);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -381,8 +382,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
          typename A5, bool cross>
 class TypeBuilder<R(A1, A2, A3, A4, A5, ...), cross> {
 public:
-  static const FunctionType *get(LLVMContext &Context) {
-    std::vector<const Type*> params;
+  static FunctionType *get(LLVMContext &Context) {
+    std::vector<Type*> params;
     params.reserve(5);
     params.push_back(TypeBuilder<A1, cross>::get(Context));
     params.push_back(TypeBuilder<A2, cross>::get(Context));