eliminate a bunch of print methods that are duplicate with the getAsString() method.
authorChris Lattner <sabre@nondot.org>
Thu, 22 Nov 2007 20:51:34 +0000 (20:51 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 22 Nov 2007 20:51:34 +0000 (20:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44275 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/Record.cpp
utils/TableGen/Record.h

index d7eb98a72ec9d216e1d9f1e86488e5c2f5d18ff4..9d14bc051fe577064f8a559cc65a74088b4776c7 100644 (file)
@@ -155,10 +155,6 @@ std::string ListRecTy::getAsString() const {
   return "list<" + Ty->getAsString() + ">";
 }
 
-void ListRecTy::print(std::ostream &OS) const {
-  OS << "list<" << *Ty << ">";
-}
-
 Init *ListRecTy::convertValue(ListInit *LI) {
   std::vector<Init*> Elements;
 
@@ -209,10 +205,6 @@ std::string RecordRecTy::getAsString() const {
   return Rec->getName();
 }
 
-void RecordRecTy::print(std::ostream &OS) const {
-  OS << Rec->getName();
-}
-
 Init *RecordRecTy::convertValue(DefInit *DI) {
   // Ensure that DI is a subclass of Rec.
   if (!DI->getDef()->isSubClassOf(Rec))
index c6005c522160fa8f0ff4a595326472d8c9de899f..e75bb6267f5da8a510de1a003b00e4f034973784 100644 (file)
@@ -63,7 +63,7 @@ struct RecTy {
   virtual ~RecTy() {}
 
   virtual std::string getAsString() const = 0;
-  virtual void print(std::ostream &OS) const = 0;
+  void print(std::ostream &OS) const { OS << getAsString(); }
   void dump() const;
 
   /// typeIsConvertibleTo - Return true if all values of 'this' type can be
@@ -129,7 +129,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const { return "bit"; }
-  void print(std::ostream &OS) const { OS << "bit"; }
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -172,7 +171,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const;
-  void print(std::ostream &OS) const { OS << "bits<" << Size << ">"; }
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -211,7 +209,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const { return "int"; }
-  void print(std::ostream &OS) const { OS << "int"; }
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -248,7 +245,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const { return "string"; }
-  void print(std::ostream &OS) const { OS << "string"; }
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -292,7 +288,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const;
-  void print(std::ostream &OS) const;
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -330,7 +325,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const { return "code"; }
-  void print(std::ostream &OS) const { OS << "code"; }
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -365,7 +359,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const { return "dag"; }
-  void print(std::ostream &OS) const { OS << "dag"; }
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);
@@ -408,7 +401,6 @@ public:
   virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
 
   std::string getAsString() const;
-  void print(std::ostream &OS) const;
 
   bool typeIsConvertibleTo(const RecTy *RHS) const {
     return RHS->baseClassOf(this);