Remove ugly subclass of Opaque type
authorChris Lattner <sabre@nondot.org>
Mon, 22 Oct 2001 06:01:08 +0000 (06:01 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 22 Oct 2001 06:01:08 +0000 (06:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@936 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/ParserInternals.h
lib/AsmParser/llvmAsmParser.y

index cc37bd9bf97100443978285b041ba338dabafeff..fe422d07443da4fb181340a21f6177b73f0193f1 100644 (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();
   }
index 60c966e1eb7d2fe9938f04c594c86fcf927f525c..7276acfcdea57c693c71aae9c7673c2b7f6ac395 100644 (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));
   }
 }