From 92f2a6ec9a40b214716f2e6618f20e160d5b5cfd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 22 Oct 2001 06:01:08 +0000 Subject: [PATCH] Remove ugly subclass of Opaque type llvm-svn: 936 --- lib/AsmParser/ParserInternals.h | 10 ---------- lib/AsmParser/llvmAsmParser.y | 10 ++++------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index cc37bd9bf97..fe422d07443 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -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(Ty)) {} }; -typedef PlaceholderValue TypePlaceHolder; typedef PlaceholderValue ValuePlaceHolder; typedef PlaceholderValue BBPlaceHolder; @@ -195,7 +187,6 @@ static inline ValID &getValIDFromPlaceHolder(const Value *Val) { Ty = cast(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(Ty)->getValueType(); switch (Ty->getPrimitiveID()) { - case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getLineNum(); case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getLineNum(); default: return ((ValuePlaceHolder*)Val)->getLineNum(); } diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 60c966e1eb7..7276acfcdea 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -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 > &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)); } }