summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-18 19:22:36 +0000
committerChris Lattner <sabre@nondot.org>2003-06-18 19:22:36 +0000
commit893f025262574d01de5585d64860673e13d77ee5 (patch)
tree314557b23cee4925a65200875670c7966072df0b /include
parentc500cf2fab4ffbac98894168b866f51e34e253f6 (diff)
downloadllvm-893f025262574d01de5585d64860673e13d77ee5.tar.gz
llvm-893f025262574d01de5585d64860673e13d77ee5.tar.bz2
llvm-893f025262574d01de5585d64860673e13d77ee5.tar.xz
Detemplatize the PATypeHandle class, which was only really instantiated on 'Type'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/AbstractTypeUser.h33
-rw-r--r--include/llvm/DerivedTypes.h17
-rw-r--r--include/llvm/Value.h2
3 files changed, 25 insertions, 27 deletions
diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h
index 272560ff28..751c5accdc 100644
--- a/include/llvm/AbstractTypeUser.h
+++ b/include/llvm/AbstractTypeUser.h
@@ -58,9 +58,8 @@ public:
// 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 @@ class PATypeHandle {
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 @@ public:
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 @@ public:
}
// 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 @@ public:
// 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 @@ struct PATypeHolder : public AbstractTypeUser, public PATypeHandle<Type> {
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;
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index ed1856f770..bd44bd2720 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -86,9 +86,9 @@ public:
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 @@ public:
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 @@ class SequentialType : public CompositeType {
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 @@ public:
// 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);
}
diff --git a/include/llvm/Value.h b/include/llvm/Value.h
index f6bd144676..aef3434789 100644
--- a/include/llvm/Value.h
+++ b/include/llvm/Value.h
@@ -50,7 +50,7 @@ public:
private:
std::vector<User *> Uses;
std::string Name;
- PATypeHandle<Type> Ty;
+ PATypeHandle Ty;
ValueTy VTy;
void operator=(const Value &); // Do not implement