[llvm-commits] CVS: llvm/include/llvm/Type.h DerivedTypes.h

Chris Lattner lattner at cs.uiuc.edu
Thu Jun 17 13:22:01 PDT 2004


Changes in directory llvm/include/llvm:

Type.h updated: 1.44 -> 1.45
DerivedTypes.h updated: 1.57 -> 1.58

---
Log message:

Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()



---
Diffs of the changes:  (+25 -25)

Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.44 llvm/include/llvm/Type.h:1.45
--- llvm/include/llvm/Type.h:1.44	Wed May 26 16:48:31 2004
+++ llvm/include/llvm/Type.h	Thu Jun 17 13:15:25 2004
@@ -54,7 +54,7 @@
   /// Note: If you add an element to this, you need to add an element to the 
   /// Type::getPrimitiveType function, or else things will break!
   ///
-  enum PrimitiveID {
+  enum TypeID {
     VoidTyID = 0  , BoolTyID,           //  0, 1: Basics...
     UByteTyID     , SByteTyID,          //  2, 3: 8 bit types...
     UShortTyID    , ShortTyID,          //  4, 5: 16 bit types...
@@ -74,14 +74,14 @@
     //PackedTyID  ,                     // SIMD 'packed' format... TODO
     //...
 
-    NumPrimitiveIDs,                    // Must remain as last defined ID
+    NumTypeIDs,                         // Must remain as last defined ID
     FirstDerivedTyID = FunctionTyID,
   };
 
 private:
-  PrimitiveID ID;        // The current base type of this type...
-  unsigned    UID;       // The unique ID number for this class
-  bool        Abstract;  // True if type contains an OpaqueType
+  TypeID   ID;        // The current base type of this type...
+  unsigned UID;       // The unique ID number for this class
+  bool     Abstract;  // True if type contains an OpaqueType
 
   /// RefCount - This counts the number of PATypeHolders that are pointing to
   /// this type.  When this number falls to zero, if the type is abstract and
@@ -93,7 +93,7 @@
   const Type *getForwardedTypeInternal() const;
 protected:
   /// ctor is protected, so only subclasses can create Type objects...
-  Type(const std::string &Name, PrimitiveID id);
+  Type(const std::string &Name, TypeID id);
   virtual ~Type() {}
 
 
@@ -137,10 +137,10 @@
   // are defined in private classes defined in Type.cpp for primitive types.
   //
 
-  /// getPrimitiveID - Return the base type of the type.  This will return one
-  /// of the PrimitiveID enum elements defined above.
+  /// getTypeID - Return the type id for the type.  This will return one
+  /// of the TypeID enum elements defined above.
   ///
-  inline PrimitiveID getPrimitiveID() const { return ID; }
+  inline TypeID getTypeID() const { return ID; }
 
   /// getUniqueID - Returns the UID of the type.  This can be thought of as a
   /// small integer version of the pointer to the type class.  Two types that
@@ -259,7 +259,7 @@
   //
 
   /// getPrimitiveType/getUniqueIDType - Return a type based on an identifier.
-  static const Type *getPrimitiveType(PrimitiveID IDNumber);
+  static const Type *getPrimitiveType(TypeID IDNumber);
   static const Type *getUniqueIDType(unsigned UID);
 
   //===--------------------------------------------------------------------===//
@@ -394,7 +394,7 @@
 };
 
 template <> inline bool isa_impl<PointerType, Type>(const Type &Ty) { 
-  return Ty.getPrimitiveID() == Type::PointerTyID;
+  return Ty.getTypeID() == Type::PointerTyID;
 }
 
 } // End llvm namespace


Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.57 llvm/include/llvm/DerivedTypes.h:1.58
--- llvm/include/llvm/DerivedTypes.h:1.57	Tue May 25 03:45:42 2004
+++ llvm/include/llvm/DerivedTypes.h	Thu Jun 17 13:15:25 2004
@@ -35,7 +35,7 @@
   mutable std::vector<AbstractTypeUser *> AbstractTypeUsers;
 
 protected:
-  DerivedType(PrimitiveID id) : Type("", id) {}
+  DerivedType(TypeID id) : Type("", id) {}
   ~DerivedType() {
     assert(AbstractTypeUsers.empty());
   }
@@ -149,7 +149,7 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const FunctionType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == FunctionTyID;
+    return T->getTypeID() == FunctionTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));
@@ -161,7 +161,7 @@
 ///
 class CompositeType : public DerivedType {
 protected:
-  inline CompositeType(PrimitiveID id) : DerivedType(id) { }
+  inline CompositeType(TypeID id) : DerivedType(id) { }
 public:
 
   /// getTypeAtIndex - Given an index value into the type, return the type of
@@ -173,9 +173,9 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const CompositeType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == ArrayTyID || 
-           T->getPrimitiveID() == StructTyID ||
-           T->getPrimitiveID() == PointerTyID;
+    return T->getTypeID() == ArrayTyID || 
+           T->getTypeID() == StructTyID ||
+           T->getTypeID() == PointerTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));
@@ -230,7 +230,7 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const StructType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == StructTyID;
+    return T->getTypeID() == StructTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));
@@ -248,7 +248,7 @@
   SequentialType(const SequentialType &);                  // Do not implement!
   const SequentialType &operator=(const SequentialType &); // Do not implement!
 protected:
-  SequentialType(PrimitiveID TID, const Type *ElType) : CompositeType(TID) {
+  SequentialType(TypeID TID, const Type *ElType) : CompositeType(TID) {
     ContainedTys.reserve(1);
     ContainedTys.push_back(PATypeHandle(ElType, this));
   }
@@ -264,7 +264,7 @@
   }
   virtual bool indexValid(const Value *V) const {
     const Type *Ty = V->getType();
-    switch (Ty->getPrimitiveID()) {
+    switch (Ty->getTypeID()) {
     case Type::IntTyID:
     case Type::UIntTyID:
     case Type::LongTyID:
@@ -278,8 +278,8 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const SequentialType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == ArrayTyID ||
-           T->getPrimitiveID() == PointerTyID;
+    return T->getTypeID() == ArrayTyID ||
+           T->getTypeID() == PointerTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));
@@ -319,7 +319,7 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ArrayType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == ArrayTyID;
+    return T->getTypeID() == ArrayTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));
@@ -352,7 +352,7 @@
   // Implement support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const PointerType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == PointerTyID;
+    return T->getTypeID() == PointerTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));
@@ -391,7 +391,7 @@
   // Implement support for type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const OpaqueType *T) { return true; }
   static inline bool classof(const Type *T) {
-    return T->getPrimitiveID() == OpaqueTyID;
+    return T->getTypeID() == OpaqueTyID;
   }
   static inline bool classof(const Value *V) {
     return isa<Type>(V) && classof(cast<Type>(V));





More information about the llvm-commits mailing list