[llvm-commits] [llvm] r44275 - in /llvm/trunk/utils/TableGen: Record.cpp Record.h

Chris Lattner sabre at nondot.org
Thu Nov 22 12:51:34 PST 2007


Author: lattner
Date: Thu Nov 22 14:51:34 2007
New Revision: 44275

URL: http://llvm.org/viewvc/llvm-project?rev=44275&view=rev
Log:
eliminate a bunch of print methods that are duplicate with the getAsString() method.

Modified:
    llvm/trunk/utils/TableGen/Record.cpp
    llvm/trunk/utils/TableGen/Record.h

Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=44275&r1=44274&r2=44275&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Thu Nov 22 14:51:34 2007
@@ -155,10 +155,6 @@
   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 @@
   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))

Modified: llvm/trunk/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=44275&r1=44274&r2=44275&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Thu Nov 22 14:51:34 2007
@@ -63,7 +63,7 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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);





More information about the llvm-commits mailing list