[llvm-commits] CVS: llvm/include/llvm/AbstractTypeUser.h DerivedTypes.h Value.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Jun 18 14:23:12 PDT 2003
Changes in directory llvm/include/llvm:
AbstractTypeUser.h updated: 1.6 -> 1.7
DerivedTypes.h updated: 1.29 -> 1.30
Value.h updated: 1.40 -> 1.41
---
Log message:
Detemplatize the PATypeHandle class, which was only really instantiated on 'Type'.
---
Diffs of the changes:
Index: llvm/include/llvm/AbstractTypeUser.h
diff -u llvm/include/llvm/AbstractTypeUser.h:1.6 llvm/include/llvm/AbstractTypeUser.h:1.7
--- llvm/include/llvm/AbstractTypeUser.h:1.6 Tue Jan 14 15:29:52 2003
+++ llvm/include/llvm/AbstractTypeUser.h Wed Jun 18 14:22:33 2003
@@ -58,9 +58,8 @@
// example. This class is a simple class used to keep the use list of abstract
// types up-to-date.
//
-template <class TypeSubClass>
class PATypeHandle {
- const TypeSubClass *Ty;
+ const Type *Ty;
AbstractTypeUser * const User;
// These functions are defined at the bottom of Type.h. See the comment there
@@ -69,7 +68,7 @@
inline void removeUser();
public:
// ctor - Add use to type if abstract. Note that Ty must not be null
- inline PATypeHandle(const TypeSubClass *ty, AbstractTypeUser *user)
+ inline PATypeHandle(const Type *ty, AbstractTypeUser *user)
: Ty(ty), User(user) {
addUser();
}
@@ -83,11 +82,11 @@
inline ~PATypeHandle() { removeUser(); }
// Automatic casting operator so that the handle may be used naturally
- inline operator const TypeSubClass *() const { return Ty; }
- inline const TypeSubClass *get() const { return Ty; }
+ inline operator const Type *() const { return Ty; }
+ inline const Type *get() const { return Ty; }
// operator= - Allow assignment to handle
- inline const TypeSubClass *operator=(const TypeSubClass *ty) {
+ inline const Type *operator=(const Type *ty) {
if (Ty != ty) { // Ensure we don't accidentally drop last ref to Ty
removeUser();
Ty = ty;
@@ -97,16 +96,16 @@
}
// operator= - Allow assignment to handle
- inline const TypeSubClass *operator=(const PATypeHandle &T) {
+ inline const Type *operator=(const PATypeHandle &T) {
return operator=(T.Ty);
}
- inline bool operator==(const TypeSubClass *ty) {
+ inline bool operator==(const Type *ty) {
return Ty == ty;
}
// operator-> - Allow user to dereference handle naturally...
- inline const TypeSubClass *operator->() const { return Ty; }
+ inline const Type *operator->() const { return Ty; }
// removeUserFromConcrete - This function should be called when the User is
// notified that our type is refined... and the type is being refined to
@@ -122,10 +121,10 @@
// as both a handle (as above) and an AbstractTypeUser. It uses the callback to
// keep its pointer member updated to the current version of the type.
//
-struct PATypeHolder : public AbstractTypeUser, public PATypeHandle<Type> {
- inline PATypeHolder(const Type *ty) : PATypeHandle<Type>(ty, this) {}
+struct PATypeHolder : public AbstractTypeUser, public PATypeHandle {
+ inline PATypeHolder(const Type *ty) : PATypeHandle(ty, this) {}
inline PATypeHolder(const PATypeHolder &T)
- : AbstractTypeUser(T), PATypeHandle<Type>(T, this) {}
+ : AbstractTypeUser(T), PATypeHandle(T, this) {}
// refineAbstractType - All we do is update our PATypeHandle member to point
// to the new type.
@@ -138,20 +137,20 @@
removeUserFromConcrete();
if ((const Type*)OldTy != NewTy)
- PATypeHandle<Type>::operator=(NewTy);
+ PATypeHandle::operator=(NewTy);
}
// operator= - Allow assignment to handle
inline const Type *operator=(const Type *ty) {
- return PATypeHandle<Type>::operator=(ty);
+ return PATypeHandle::operator=(ty);
}
// operator= - Allow assignment to handle
- inline const Type *operator=(const PATypeHandle<Type> &T) {
- return PATypeHandle<Type>::operator=(T);
+ inline const Type *operator=(const PATypeHandle &T) {
+ return PATypeHandle::operator=(T);
}
inline const Type *operator=(const PATypeHolder &H) {
- return PATypeHandle<Type>::operator=(H);
+ return PATypeHandle::operator=(H);
}
void dump() const;
Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.29 llvm/include/llvm/DerivedTypes.h:1.30
--- llvm/include/llvm/DerivedTypes.h:1.29 Wed Jun 11 09:01:26 2003
+++ llvm/include/llvm/DerivedTypes.h Wed Jun 18 14:22:36 2003
@@ -86,9 +86,9 @@
class FunctionType : public DerivedType {
public:
- typedef std::vector<PATypeHandle<Type> > ParamTypes;
+ typedef std::vector<PATypeHandle> ParamTypes;
private:
- PATypeHandle<Type> ResultType;
+ PATypeHandle ResultType;
ParamTypes ParamTys;
bool isVarArgs;
@@ -181,7 +181,7 @@
class StructType : public CompositeType {
public:
- typedef std::vector<PATypeHandle<Type> > ElementTypes;
+ typedef std::vector<PATypeHandle> ElementTypes;
private:
ElementTypes ETypes; // Element types of struct
@@ -245,10 +245,10 @@
SequentialType(const SequentialType &); // Do not implement!
const SequentialType &operator=(const SequentialType &); // Do not implement!
protected:
- PATypeHandle<Type> ElementType;
+ PATypeHandle ElementType;
SequentialType(PrimitiveID TID, const Type *ElType)
- : CompositeType(TID), ElementType(PATypeHandle<Type>(ElType, this)) {
+ : CompositeType(TID), ElementType(PATypeHandle(ElType, this)) {
}
public:
@@ -390,18 +390,17 @@
// contains an AbstractTypeUser instance, so there is no good way to factor out
// the code. Hence this bit of uglyness.
//
-template <class TypeSubClass> void PATypeHandle<TypeSubClass>::addUser() {
+inline void PATypeHandle::addUser() {
assert(Ty && "Type Handle has a null type!");
if (Ty->isAbstract())
cast<DerivedType>(Ty)->addAbstractTypeUser(User);
}
-template <class TypeSubClass> void PATypeHandle<TypeSubClass>::removeUser() {
+inline void PATypeHandle::removeUser() {
if (Ty->isAbstract())
cast<DerivedType>(Ty)->removeAbstractTypeUser(User);
}
-template <class TypeSubClass>
-void PATypeHandle<TypeSubClass>::removeUserFromConcrete() {
+inline void PATypeHandle::removeUserFromConcrete() {
if (!Ty->isAbstract())
cast<DerivedType>(Ty)->removeAbstractTypeUser(User);
}
Index: llvm/include/llvm/Value.h
diff -u llvm/include/llvm/Value.h:1.40 llvm/include/llvm/Value.h:1.41
--- llvm/include/llvm/Value.h:1.40 Tue Jan 14 15:29:58 2003
+++ llvm/include/llvm/Value.h Wed Jun 18 14:22:36 2003
@@ -50,7 +50,7 @@
private:
std::vector<User *> Uses;
std::string Name;
- PATypeHandle<Type> Ty;
+ PATypeHandle Ty;
ValueTy VTy;
void operator=(const Value &); // Do not implement
More information about the llvm-commits
mailing list