Remove ugly subclass of Opaque type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-22 06:01:08 +00:00
parent 4a42e909cd
commit 822695901f
2 changed files with 4 additions and 16 deletions

View File

@ -160,13 +160,6 @@ public:
int getLineNum() const { return LineNum; }
};
struct TypePlaceHolderHelper : public OpaqueType {
TypePlaceHolderHelper(const Type *Ty) : OpaqueType() {
assert(Ty == Type::TypeTy);
}
};
struct InstPlaceHolderHelper : public Instruction {
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
@ -184,7 +177,6 @@ struct MethPlaceHolderHelper : public Method {
MethPlaceHolderHelper(const Type *Ty) : Method(cast<const MethodType>(Ty)) {}
};
typedef PlaceholderValue<TypePlaceHolderHelper> TypePlaceHolder;
typedef PlaceholderValue<InstPlaceHolderHelper> ValuePlaceHolder;
typedef PlaceholderValue<BBPlaceHolderHelper> BBPlaceHolder;
@ -195,7 +187,6 @@ static inline ValID &getValIDFromPlaceHolder(const Value *Val) {
Ty = cast<PointerType>(Ty)->getValueType();
switch (Ty->getPrimitiveID()) {
case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getDef();
case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getDef();
default: return ((ValuePlaceHolder*)Val)->getDef();
}
@ -208,7 +199,6 @@ static inline int getLineNumFromPlaceHolder(const Value *Val) {
Ty = cast<PointerType>(Ty)->getValueType();
switch (Ty->getPrimitiveID()) {
case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getLineNum();
case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getLineNum();
default: return ((ValuePlaceHolder*)Val)->getLineNum();
}

View File

@ -237,7 +237,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
return I->second;
}
Type *Typ = new TypePlaceHolder(Type::TypeTy, D);
Type *Typ = OpaqueType::get();
LateResolver.insert(make_pair(D, Typ));
return Typ;
}
@ -473,14 +473,12 @@ static void ResolveTypeTo(char *Name, const Type *ToTy) {
//
static void ResolveTypes(map<ValID, PATypeHolder<Type> > &LateResolveTypes) {
if (!LateResolveTypes.empty()) {
ValID &DID = LateResolveTypes.begin()->first;
const ValID &DID = LateResolveTypes.begin()->first;
if (DID.Type == ValID::NameVal)
ThrowException("Reference to an invalid type: '" +DID.getName() + "'",
getLineNumFromPlaceHolder(Ty));
ThrowException("Reference to an invalid type: '" +DID.getName() + "'");
else
ThrowException("Reference to an invalid type: #" + itostr(DID.Num),
getLineNumFromPlaceHolder(Ty));
ThrowException("Reference to an invalid type: #" + itostr(DID.Num));
}
}