mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Remove ugly subclass of Opaque type
llvm-svn: 936
This commit is contained in:
parent
ee608fe298
commit
92f2a6ec9a
@ -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();
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user