public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gcjx] Make model_element abstract and expand visitor interface
@ 2005-10-11  4:14 Ranjit Mathew
  2005-10-11  4:24 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Ranjit Mathew @ 2005-10-11  4:14 UTC (permalink / raw)
  To: java-patches

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

  Now that the kludgy use of model_element in the parser is gone,
I made model_element::visit() abstract, removed its implementation
from model/element.cc and expanded the visitor interface to cover
the model elements that need it now.

Once again, I have only tried to cover as many model elements as
was needed to cleanly compile stuff and there still might be
model elements that escape the clutches of the visitor interface.
All the implementations are dummy for the moment. I will separately
flesh out the new pretty-printer methods.

There are two patches - one for "gcjx" and another for "gcc/java".

OK?

Thanks,
Ranjit.

- --
Ranjit Mathew       Email: rmathew AT gmail DOT com

Bangalore, INDIA.     Web: http://ranjitmathew.hostingzero.com/




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDSzwPYb1hx2wRS48RAvyuAJ9UTO3tjefS8nknjv6tw+JhOkxZdgCfXbR7
ebKFREBj3PMBJvV5gTZrAEA=
=7KzU
-----END PGP SIGNATURE-----

[-- Attachment #2: p1.txt --]
[-- Type: text/plain, Size: 30214 bytes --]

Index: ChangeLog
from  Ranjit Mathew  <rmathew@gcc.gnu.org>

	* model/element.hh (model_element::visit): Make abstract.
	* model/element.cc: Remove file.
	* visitor.hh (visitor::visit_element): Remove.
	(visitor::visit_annotation_member): New method.
	(visitor::visit_annotation_value): Likewise.
	(visitor::visit_import_single): Likewise.
	(visitor::visit_import_on_demand): Likewise.
	(visitor::visit_static_import_single): Likewise.
	(visitor::visit_static_import_on_demand): Likewise.
	(visitor::visit_unit_source): Likewise.
	(visitor::visit_unit_class): Likewise.
	(visitor::visit_unit_fake): Likewise.
	* model/annovalue.hh (model_annotation_value::visit): New method.
	* model/annovalue.cc: New file.
	* model/annomember.hh (model_annotation_member::visit): New method.
	* model/annomember.cc (model_annotation_member::visit): Implement.
	* model/import.hh (model_import_base::visit): New method.
	(model_import_single::visit): Likewise.
	(model_import_on_demand::visit): Likewise.
	(model_static_import_base::visit): Likewise.
	(model_static_import_single::visit): Likewise.
	(model_static_import_on_demand::visit): Likewise.
	* model/import.cc (model_import_single::visit): Implement.
	(model_import_on_demand::visit): Likewise.
	(model_static_import_single::visit): Likewise.
	(model_static_import_on_demand::visit): Likewise.
	* model/unit.hh (model_unit::visit): New method.
	(model_unit_source::visit): Likewise.
	(model_unit_class::visit): Likewise.
	(model_unit_fake::visit): Likewise.
	* model/unit.cc (model_unit_source::visit): Implement.
	(model_unit_class::visit): Implement.
	(model_unit_fake::visit): Implement.
	* dump.cc (dumper, pretty_printer): Dummy implementations of new
	visitor methods.
	* defassign.cc (definite_assignment_vistor): Likewise.
	* fold.cc (fold_visitor): Likewise.
	* bytecode/generate.hh (bytecode_generator): Likewise.
	* Makefile.am (model_sources): Add model/annovalue.cc and remove
	model/element.cc.
	* Makefile.in: Regenerated.

Index: model/element.hh
===================================================================
--- model/element.hh	2005-10-11 06:52:31.000000000 +0530
+++ model/element.hh	2005-10-11 06:52:52.000000000 +0530
@@ -98,7 +98,7 @@ public:
   /// Call the appropriate method of the visitor with information
   /// about the tree.
   /// @param v  the visitor to call
-  virtual void visit (visitor *v);
+  virtual void visit (visitor *v) = 0;
 };
 
 #endif // GCJX_MODEL_ELEMENT_HH
Index: visitor.hh
===================================================================
--- visitor.hh	2005-10-11 06:50:51.000000000 +0530
+++ visitor.hh	2005-10-11 08:39:44.000000000 +0530
@@ -403,7 +403,42 @@ public:
 
   virtual void visit_identifier (model_identifier *, const std::string &) = 0;
 
-  virtual void visit_element (model_element *) = 0;
+  virtual void visit_annotation_member (model_annotation_member *,
+                                        const ref_forwarding_type &) = 0;
+
+  virtual void visit_annotation_value (model_annotation_value *,
+                                       const std::string &,
+                                       const ref_expression &) = 0;
+
+  virtual void visit_import_single (model_import_single *,
+                                    const std::list<std::string> &,
+                                    model_class *) = 0;
+
+  virtual void visit_import_on_demand (model_import_on_demand *,
+                                       const std::list<std::string> &,
+                                       Iname *, bool) = 0;
+
+  virtual void visit_static_import_single (model_static_import_single *,
+                                           const std::list<std::string> &,
+                                           model_class *,
+                                           const std::string &) = 0;
+
+  virtual void visit_static_import_on_demand (model_static_import_on_demand *,
+                                              const std::list<std::string> &,
+                                              model_class *) = 0;
+  
+  virtual void visit_unit_source (model_unit_source *, model_package *,
+                                  const std::list<ref_class> &,
+                                  const std::string &,
+                                  bool, const std::list<ref_import> &) = 0;
+  
+  virtual void visit_unit_class (model_unit_class *, model_package *,
+                                 const std::list<ref_class> &,
+                                 const std::string &, bool) = 0;
+  
+  virtual void visit_unit_fake (model_unit_fake *, model_package *,
+                                const std::list<ref_class> &,
+                                const std::string &, bool) = 0;
 };
 
 
Index: model/annovalue.hh
===================================================================
--- model/annovalue.hh	2005-10-11 07:17:48.000000000 +0530
+++ model/annovalue.hh	2005-10-11 07:18:29.000000000 +0530
@@ -1,6 +1,6 @@
 // Represent an annotation value.
 
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -73,6 +73,8 @@ public:
   {
     return value;
   }
+
+  void visit (visitor *);
 };
 
 #endif // GCJX_MODEL_ANNOVALUE_HH
Index: model/annovalue.cc
===================================================================
--- model/annovalue.cc	2005-10-11 07:19:12.000000000 +0530
+++ model/annovalue.cc	2005-10-11 07:45:30.000000000 +0530
@@ -0,0 +1,28 @@
+// Represent an annotation value.
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// gcjx is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// gcjx is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with gcjx; see the file COPYING.LIB.  If
+// not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include "typedefs.hh"
+
+void
+model_annotation_value::visit (visitor *v)
+{
+  v->visit_annotation_value (this, name, value);
+}
Index: model/annomember.hh
===================================================================
--- model/annomember.hh	2005-10-11 07:45:45.000000000 +0530
+++ model/annomember.hh	2005-10-11 07:46:56.000000000 +0530
@@ -1,6 +1,6 @@
 // Represent an annotation type member declaration.
 
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -56,6 +56,8 @@ public:
   }
 
   void resolve (resolution_scope *);
+
+  void visit (visitor *);
 };
 
 #endif // GCJX_MODEL_ANNOMEMBER_HH
Index: model/annomember.cc
===================================================================
--- model/annomember.cc	2005-10-11 07:47:11.000000000 +0530
+++ model/annomember.cc	2005-10-11 07:47:56.000000000 +0530
@@ -1,6 +1,6 @@
 // Represent an annotation type member declaration.
 
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -59,3 +59,9 @@ model_annotation_member::resolve (resolu
   if (value && ! annotation_commensurate_p (type->type (), value.get ()))
     throw error ("value is not commensurate with type of annotation member");
 }
+
+void
+model_annotation_member::visit (visitor *v)
+{
+  v->visit_annotation_member (this, type);
+}
Index: model/import.hh
===================================================================
--- model/import.hh	2005-10-11 08:05:03.000000000 +0530
+++ model/import.hh	2005-10-11 08:08:12.000000000 +0530
@@ -88,6 +88,8 @@ public:
 
   /// Check whether we've been referenced and emit a warning if not.
   void check_referenced ();
+
+  void visit (visitor *) = 0;
 };
 
 // "import foo"
@@ -116,6 +118,8 @@ public:
   {
     return true;
   }
+
+  void visit (visitor *);
 };
 
 // "import foo.*"
@@ -147,6 +151,8 @@ public:
   {
     return false;
   }
+
+  void visit (visitor *);
 };
 
 /// Base class for both types of static import.
@@ -176,6 +182,8 @@ public:
 
   void find_method (const std::string &, IContext *,
 		    std::set<model_method *> &);
+
+  void visit (visitor *) = 0;
 };
 
 // "import static foo.bar"
@@ -209,6 +217,8 @@ public:
   {
     return true;
   }
+
+  void visit (visitor *);
 };
 
 // "import static foo.bar.*"
@@ -228,6 +238,8 @@ public:
   {
     return false;
   }
+
+  void visit (visitor *);
 };
 
 #endif // GCJX_MODEL_IMPORT_HH
Index: model/import.cc
===================================================================
--- model/import.cc	2005-10-11 08:08:30.000000000 +0530
+++ model/import.cc	2005-10-11 08:16:19.000000000 +0530
@@ -64,6 +64,12 @@ model_import_single::find_class (const s
   abort ();
 }
 
+void
+model_import_single::visit (visitor *v)
+{
+  v->visit_import_single (this, name, resolved_type);
+}
+
 \f
 
 void
@@ -111,6 +117,12 @@ model_import_on_demand::find_class (cons
   return result;
 }
 
+void
+model_import_on_demand::visit (visitor *v)
+{
+  v->visit_import_on_demand (this, name, resolved_type, implicit);
+}
+
 \f
 
 // FIXME: reuse model_import_single::resolve
@@ -244,6 +256,12 @@ model_static_import_single::find_method 
     model_static_import_base::find_method (name, context, accessible);
 }
 
+void
+model_static_import_single::visit (visitor *v)
+{
+  v->visit_static_import_single (this, name, resolved_type, member_name);
+}
+
 \f
 
 model_class *
@@ -251,3 +269,9 @@ model_static_import_on_demand::find_clas
 {
   return search_for_class (name);
 }
+
+void
+model_static_import_on_demand::visit (visitor *v)
+{
+  v->visit_static_import_on_demand (this, name, resolved_type);
+}
Index: model/unit.hh
===================================================================
--- model/unit.hh	2005-10-11 08:28:10.000000000 +0530
+++ model/unit.hh	2005-10-11 08:29:34.000000000 +0530
@@ -130,6 +130,8 @@ public:
   {
     scope->push_scope (this);
   }
+
+  void visit (visitor *) = 0;
 };
 
 /// This represents a single .java source file.
@@ -188,6 +190,8 @@ public:
 		     std::set<model_method *> &result,
 		     IContext *request,
 		     model_class *qualifier);
+
+  void visit (visitor *);
 };
 
 /// This represents a single '.class' file.
@@ -263,6 +267,8 @@ public:
   {
     return use_15;
   }
+
+  void visit (visitor *);
 };
 
 /// This class represents a "fake" .class-based compilation unit.
@@ -294,6 +300,8 @@ public:
 
   model_class *find_class_from_descriptor (resolution_scope *, model_element *,
 					   const std::string &);
+
+  void visit (visitor *);
 };
 
 #endif // GCJX_MODEL_UNIT_HH
Index: model/unit.cc
===================================================================
--- model/unit.cc	2005-10-11 08:32:25.000000000 +0530
+++ model/unit.cc	2005-10-11 08:35:00.000000000 +0530
@@ -238,6 +238,12 @@ model_unit_source::check_imports ()
     (*i)->check_referenced ();
 }
 
+void
+model_unit_source::visit (visitor *v)
+{
+  v->visit_unit_source (this, package, types, filename, resolved, imports);
+}
+
 \f
 
 model_class *
@@ -374,6 +380,12 @@ model_unit_class::find_class_from_descri
     }
 }
 
+void
+model_unit_class::visit (visitor *v)
+{
+  v->visit_unit_class (this, package, types, filename, resolved);
+}
+
 \f
 
 model_class *
@@ -388,3 +400,9 @@ model_unit_fake::find_class_from_descrip
       % descriptor;
   return (*i).second;
 }
+
+void
+model_unit_fake::visit (visitor *v)
+{
+  v->visit_unit_fake (this, package, types, filename, resolved);
+}
Index: dump.cc
===================================================================
--- dump.cc	2005-10-11 06:51:10.000000000 +0530
+++ dump.cc	2005-10-11 08:48:35.000000000 +0530
@@ -1046,8 +1046,63 @@ public:
   {
     // Nothing.
   }
+  
+  void visit_annotation_member (model_annotation_member *,
+                                const ref_forwarding_type &)
+  {
+    // Nothing.
+  }
+
+  void visit_annotation_value (model_annotation_value *,
+                               const std::string &, const ref_expression &)
+  {
+    // Nothing.
+  }
 
-  void visit_element (model_element *)
+  void visit_import_single (model_import_single *,
+                            const std::list<std::string> &, model_class *)
+  {
+    // Nothing.
+  }
+
+  void visit_import_on_demand (model_import_on_demand *,
+                               const std::list<std::string> &, Iname *, bool)
+  {
+    // Nothing.
+  }
+
+  void visit_static_import_single (model_static_import_single *,
+				   const std::list<std::string> &,
+				   model_class *, const std::string &)
+  {
+    // Nothing.
+  }
+
+  void visit_static_import_on_demand (model_static_import_on_demand *,
+				      const std::list<std::string> &,
+				      model_class *)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_source (model_unit_source *, model_package *,
+			  const std::list<ref_class> &,
+			  const std::string &,
+			  bool, const std::list<ref_import> &)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_class (model_unit_class *, model_package *,
+			 const std::list<ref_class> &,
+			 const std::string &, bool)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_fake (model_unit_fake *, model_package *,
+			const std::list<ref_class> &,
+			const std::string &, bool)
   {
     // Nothing.
   }
@@ -2402,11 +2457,65 @@ public:
     out << " " << ident;
     end_element ();
   }
+  
+  void visit_annotation_member (model_annotation_member *,
+                                const ref_forwarding_type &)
+  {
+    // TODO.
+  }
 
-  void visit_element (model_element *e)
+  void visit_annotation_value (model_annotation_value *,
+                               const std::string &, const ref_expression &)
   {
-    begin_element (e, "element");
-    end_element ();
+    // TODO.
+  }
+
+  void visit_import_single (model_import_single *,
+                            const std::list<std::string> &, model_class *)
+  {
+    // TODO.
+  }
+
+  void visit_import_on_demand (model_import_on_demand *,
+                               const std::list<std::string> &, Iname *, bool)
+  {
+    // TODO.
+  }
+
+  void visit_static_import_single (model_static_import_single *,
+				   const std::list<std::string> &,
+				   model_class *, const std::string &)
+  {
+    // TODO.
+  }
+
+  void visit_static_import_on_demand (model_static_import_on_demand *,
+				      const std::list<std::string> &,
+				      model_class *)
+  {
+    // TODO.
+  }
+  
+  void visit_unit_source (model_unit_source *, model_package *,
+			  const std::list<ref_class> &,
+			  const std::string &,
+			  bool, const std::list<ref_import> &)
+  {
+    // TODO.
+  }
+  
+  void visit_unit_class (model_unit_class *, model_package *,
+			 const std::list<ref_class> &,
+			 const std::string &, bool)
+  {
+    // TODO.
+  }
+  
+  void visit_unit_fake (model_unit_fake *, model_package *,
+			const std::list<ref_class> &,
+			const std::string &, bool)
+  {
+    // TODO.
   }
 };
 
Index: defassign.cc
===================================================================
--- defassign.cc	2005-10-11 06:51:16.000000000 +0530
+++ defassign.cc	2005-10-11 08:48:19.000000000 +0530
@@ -1631,8 +1631,63 @@ public:
   {
     // Nothing.
   }
+  
+  void visit_annotation_member (model_annotation_member *,
+                                const ref_forwarding_type &)
+  {
+    // Nothing.
+  }
+
+  void visit_annotation_value (model_annotation_value *,
+                               const std::string &, const ref_expression &)
+  {
+    // Nothing.
+  }
+
+  void visit_import_single (model_import_single *,
+                            const std::list<std::string> &, model_class *)
+  {
+    // Nothing.
+  }
+
+  void visit_import_on_demand (model_import_on_demand *,
+                               const std::list<std::string> &, Iname *, bool)
+  {
+    // Nothing.
+  }
 
-  void visit_element (model_element *)
+  void visit_static_import_single (model_static_import_single *,
+				   const std::list<std::string> &,
+				   model_class *, const std::string &)
+  {
+    // Nothing.
+  }
+
+  void visit_static_import_on_demand (model_static_import_on_demand *,
+				      const std::list<std::string> &,
+				      model_class *)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_source (model_unit_source *, model_package *,
+			  const std::list<ref_class> &,
+			  const std::string &,
+			  bool, const std::list<ref_import> &)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_class (model_unit_class *, model_package *,
+			 const std::list<ref_class> &,
+			 const std::string &, bool)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_fake (model_unit_fake *, model_package *,
+			const std::list<ref_class> &,
+			const std::string &, bool)
   {
     // Nothing.
   }
Index: fold.cc
===================================================================
--- fold.cc	2005-10-11 06:51:25.000000000 +0530
+++ fold.cc	2005-10-11 08:48:45.000000000 +0530
@@ -739,8 +739,63 @@ public:
   {
     // Nothing.
   }
+  
+  void visit_annotation_member (model_annotation_member *,
+                                const ref_forwarding_type &)
+  {
+    // Nothing.
+  }
+
+  void visit_annotation_value (model_annotation_value *,
+                               const std::string &, const ref_expression &)
+  {
+    // Nothing.
+  }
+
+  void visit_import_single (model_import_single *,
+                            const std::list<std::string> &, model_class *)
+  {
+    // Nothing.
+  }
+
+  void visit_import_on_demand (model_import_on_demand *,
+                               const std::list<std::string> &, Iname *, bool)
+  {
+    // Nothing.
+  }
 
-  void visit_element (model_element *)
+  void visit_static_import_single (model_static_import_single *,
+				   const std::list<std::string> &,
+				   model_class *, const std::string &)
+  {
+    // Nothing.
+  }
+
+  void visit_static_import_on_demand (model_static_import_on_demand *,
+				      const std::list<std::string> &,
+				      model_class *)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_source (model_unit_source *, model_package *,
+			  const std::list<ref_class> &,
+			  const std::string &,
+			  bool, const std::list<ref_import> &)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_class (model_unit_class *, model_package *,
+			 const std::list<ref_class> &,
+			 const std::string &, bool)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_fake (model_unit_fake *, model_package *,
+			const std::list<ref_class> &,
+			const std::string &, bool)
   {
     // Nothing.
   }
Index: bytecode/generate.hh
===================================================================
--- bytecode/generate.hh	2005-10-11 06:52:12.000000000 +0530
+++ bytecode/generate.hh	2005-10-11 08:48:58.000000000 +0530
@@ -825,8 +825,63 @@ public:
   {
     // Nothing.
   }
+  
+  void visit_annotation_member (model_annotation_member *,
+                                const ref_forwarding_type &)
+  {
+    // Nothing.
+  }
+
+  void visit_annotation_value (model_annotation_value *,
+                               const std::string &, const ref_expression &)
+  {
+    // Nothing.
+  }
+
+  void visit_import_single (model_import_single *,
+                            const std::list<std::string> &, model_class *)
+  {
+    // Nothing.
+  }
+
+  void visit_import_on_demand (model_import_on_demand *,
+                               const std::list<std::string> &, Iname *, bool)
+  {
+    // Nothing.
+  }
 
-  void visit_element (model_element *)
+  void visit_static_import_single (model_static_import_single *,
+				   const std::list<std::string> &,
+				   model_class *, const std::string &)
+  {
+    // Nothing.
+  }
+
+  void visit_static_import_on_demand (model_static_import_on_demand *,
+				      const std::list<std::string> &,
+				      model_class *)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_source (model_unit_source *, model_package *,
+			  const std::list<ref_class> &,
+			  const std::string &,
+			  bool, const std::list<ref_import> &)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_class (model_unit_class *, model_package *,
+			 const std::list<ref_class> &,
+			 const std::string &, bool)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_fake (model_unit_fake *, model_package *,
+			const std::list<ref_class> &,
+			const std::string &, bool)
   {
     // Nothing.
   }
Index: Makefile.am
===================================================================
--- Makefile.am	2005-10-11 06:47:19.000000000 +0530
+++ Makefile.am	2005-10-11 09:22:07.000000000 +0530
@@ -80,25 +80,25 @@ dot_sources = access.cc classcache.cc co
 defassign.cc directory.cc dump.cc factory.cc fold.cc init.cc \
 location.cc name.cc owner.cc scope.cc util.cc warnings.cc
 
-model_sources = model/annotation.cc model/annomember.cc	\
-model/annotype.cc model/arrayinit.cc model/arrayref.cc \
+model_sources = model/annotation.cc model/annomember.cc model/annotype.cc \
+model/annovalue.cc model/arrayinit.cc model/arrayref.cc \
 model/arraytype.cc model/assert.cc model/assign.cc model/binary.cc \
 model/block.cc model/blockscope.cc model/break.cc model/bytecode.cc \
 model/cast.cc model/catch.cc model/class.cc model/classinst.cc \
 model/classref.cc model/cond.cc model/constructor.cc model/continue.cc \
-model/declstmt.cc model/do.cc model/element.cc model/empty.cc \
-model/enum.cc model/expr.cc model/exprstmt.cc model/field.cc \
-model/fieldinit.cc model/fieldref.cc model/for.cc model/forenhanced.cc \
-model/fwdtype.cc model/iannotatable.cc model/identifier.cc model/if.cc \
-model/import.cc model/imodifiable.cc model/init.cc model/instanceof.cc \
-model/invoke.cc model/label.cc model/literal.cc model/memberref.cc \
-model/method.cc model/modifier.cc model/newarray.cc model/new.cc \
-model/null.cc model/package.cc model/parameters.cc model/primitive.cc \
-model/return.cc model/stmt.cc model/switch.cc model/synchronized.cc \
-model/this.cc model/throw.cc model/throwsclause.cc model/try.cc \
-model/type.cc model/typemap.cc model/typevar.cc model/unary.cc \
-model/unit.cc model/value.cc model/variable.cc model/varref.cc \
-model/varstmt.cc model/while.cc model/wildcard.cc
+model/declstmt.cc model/do.cc model/empty.cc model/enum.cc model/expr.cc \
+model/exprstmt.cc model/field.cc model/fieldinit.cc model/fieldref.cc \
+model/for.cc model/forenhanced.cc model/fwdtype.cc model/iannotatable.cc \
+model/identifier.cc model/if.cc model/import.cc model/imodifiable.cc \
+model/init.cc model/instanceof.cc model/invoke.cc model/label.cc \
+model/literal.cc model/memberref.cc model/method.cc model/modifier.cc \
+model/newarray.cc model/new.cc model/null.cc model/package.cc \
+model/parameters.cc model/primitive.cc model/return.cc model/stmt.cc \
+model/switch.cc model/synchronized.cc model/this.cc model/throw.cc \
+model/throwsclause.cc model/try.cc model/type.cc model/typemap.cc \
+model/typevar.cc model/unary.cc model/unit.cc model/value.cc \
+model/variable.cc model/varref.cc model/varstmt.cc model/while.cc \
+model/wildcard.cc
 
 bytecode_sources = bytecode/attribute.cc bytecode/block.cc \
 bytecode/bytegen.cc bytecode/classreader.cc bytecode/classwriter.cc \
Index: Makefile.in
===================================================================
--- Makefile.in	2005-10-11 06:47:45.000000000 +0530
+++ Makefile.in	2005-10-11 09:22:30.000000000 +0530
@@ -75,13 +75,13 @@ am__objects_1 = access.lo classcache.lo 
 	location.lo name.lo owner.lo scope.lo util.lo warnings.lo
 am__dirstamp = $(am__leading_dot)dirstamp
 am__objects_2 = model/annotation.lo model/annomember.lo \
-	model/annotype.lo model/arrayinit.lo model/arrayref.lo \
-	model/arraytype.lo model/assert.lo model/assign.lo \
-	model/binary.lo model/block.lo model/blockscope.lo \
-	model/break.lo model/bytecode.lo model/cast.lo model/catch.lo \
-	model/class.lo model/classinst.lo model/classref.lo \
-	model/cond.lo model/constructor.lo model/continue.lo \
-	model/declstmt.lo model/do.lo model/element.lo model/empty.lo \
+	model/annotype.lo model/annovalue.lo model/arrayinit.lo \
+	model/arrayref.lo model/arraytype.lo model/assert.lo \
+	model/assign.lo model/binary.lo model/block.lo \
+	model/blockscope.lo model/break.lo model/bytecode.lo \
+	model/cast.lo model/catch.lo model/class.lo model/classinst.lo \
+	model/classref.lo model/cond.lo model/constructor.lo \
+	model/continue.lo model/declstmt.lo model/do.lo model/empty.lo \
 	model/enum.lo model/expr.lo model/exprstmt.lo model/field.lo \
 	model/fieldinit.lo model/fieldref.lo model/for.lo \
 	model/forenhanced.lo model/fwdtype.lo model/iannotatable.lo \
@@ -319,25 +319,25 @@ dot_sources = access.cc classcache.cc co
 defassign.cc directory.cc dump.cc factory.cc fold.cc init.cc \
 location.cc name.cc owner.cc scope.cc util.cc warnings.cc
 
-model_sources = model/annotation.cc model/annomember.cc	\
-model/annotype.cc model/arrayinit.cc model/arrayref.cc \
+model_sources = model/annotation.cc model/annomember.cc model/annotype.cc \
+model/annovalue.cc model/arrayinit.cc model/arrayref.cc \
 model/arraytype.cc model/assert.cc model/assign.cc model/binary.cc \
 model/block.cc model/blockscope.cc model/break.cc model/bytecode.cc \
 model/cast.cc model/catch.cc model/class.cc model/classinst.cc \
 model/classref.cc model/cond.cc model/constructor.cc model/continue.cc \
-model/declstmt.cc model/do.cc model/element.cc model/empty.cc \
-model/enum.cc model/expr.cc model/exprstmt.cc model/field.cc \
-model/fieldinit.cc model/fieldref.cc model/for.cc model/forenhanced.cc \
-model/fwdtype.cc model/iannotatable.cc model/identifier.cc model/if.cc \
-model/import.cc model/imodifiable.cc model/init.cc model/instanceof.cc \
-model/invoke.cc model/label.cc model/literal.cc model/memberref.cc \
-model/method.cc model/modifier.cc model/newarray.cc model/new.cc \
-model/null.cc model/package.cc model/parameters.cc model/primitive.cc \
-model/return.cc model/stmt.cc model/switch.cc model/synchronized.cc \
-model/this.cc model/throw.cc model/throwsclause.cc model/try.cc \
-model/type.cc model/typemap.cc model/typevar.cc model/unary.cc \
-model/unit.cc model/value.cc model/variable.cc model/varref.cc \
-model/varstmt.cc model/while.cc model/wildcard.cc
+model/declstmt.cc model/do.cc model/empty.cc model/enum.cc model/expr.cc \
+model/exprstmt.cc model/field.cc model/fieldinit.cc model/fieldref.cc \
+model/for.cc model/forenhanced.cc model/fwdtype.cc model/iannotatable.cc \
+model/identifier.cc model/if.cc model/import.cc model/imodifiable.cc \
+model/init.cc model/instanceof.cc model/invoke.cc model/label.cc \
+model/literal.cc model/memberref.cc model/method.cc model/modifier.cc \
+model/newarray.cc model/new.cc model/null.cc model/package.cc \
+model/parameters.cc model/primitive.cc model/return.cc model/stmt.cc \
+model/switch.cc model/synchronized.cc model/this.cc model/throw.cc \
+model/throwsclause.cc model/try.cc model/type.cc model/typemap.cc \
+model/typevar.cc model/unary.cc model/unit.cc model/value.cc \
+model/variable.cc model/varref.cc model/varstmt.cc model/while.cc \
+model/wildcard.cc
 
 bytecode_sources = bytecode/attribute.cc bytecode/block.cc \
 bytecode/bytegen.cc bytecode/classreader.cc bytecode/classwriter.cc \
@@ -463,6 +463,8 @@ model/annomember.lo: model/$(am__dirstam
 	model/$(DEPDIR)/$(am__dirstamp)
 model/annotype.lo: model/$(am__dirstamp) \
 	model/$(DEPDIR)/$(am__dirstamp)
+model/annovalue.lo: model/$(am__dirstamp) \
+	model/$(DEPDIR)/$(am__dirstamp)
 model/arrayinit.lo: model/$(am__dirstamp) \
 	model/$(DEPDIR)/$(am__dirstamp)
 model/arrayref.lo: model/$(am__dirstamp) \
@@ -493,8 +495,6 @@ model/continue.lo: model/$(am__dirstamp)
 model/declstmt.lo: model/$(am__dirstamp) \
 	model/$(DEPDIR)/$(am__dirstamp)
 model/do.lo: model/$(am__dirstamp) model/$(DEPDIR)/$(am__dirstamp)
-model/element.lo: model/$(am__dirstamp) \
-	model/$(DEPDIR)/$(am__dirstamp)
 model/empty.lo: model/$(am__dirstamp) model/$(DEPDIR)/$(am__dirstamp)
 model/enum.lo: model/$(am__dirstamp) model/$(DEPDIR)/$(am__dirstamp)
 model/expr.lo: model/$(am__dirstamp) model/$(DEPDIR)/$(am__dirstamp)
@@ -916,6 +916,8 @@ mostlyclean-compile:
 	-rm -f model/annotation.lo
 	-rm -f model/annotype.$(OBJEXT)
 	-rm -f model/annotype.lo
+	-rm -f model/annovalue.$(OBJEXT)
+	-rm -f model/annovalue.lo
 	-rm -f model/arrayinit.$(OBJEXT)
 	-rm -f model/arrayinit.lo
 	-rm -f model/arrayref.$(OBJEXT)
@@ -956,8 +958,6 @@ mostlyclean-compile:
 	-rm -f model/declstmt.lo
 	-rm -f model/do.$(OBJEXT)
 	-rm -f model/do.lo
-	-rm -f model/element.$(OBJEXT)
-	-rm -f model/element.lo
 	-rm -f model/empty.$(OBJEXT)
 	-rm -f model/empty.lo
 	-rm -f model/enum.$(OBJEXT)
@@ -1164,6 +1164,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/annomember.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/annotation.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/annotype.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/annovalue.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/arrayinit.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/arrayref.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/arraytype.Plo@am__quote@
@@ -1184,7 +1185,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/continue.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/declstmt.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/do.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/element.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/empty.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/enum.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@model/$(DEPDIR)/expr.Plo@am__quote@

[-- Attachment #3: p2.txt --]
[-- Type: text/plain, Size: 1953 bytes --]

Index: ChangeLog
from  Ranjit Mathew  <rmathew@gcc.gnu.org>

	* tree.hh (tree_generator): Remove visit_element() and add dummy
	implementations of new visitor methods.

Index: tree.hh
===================================================================
--- tree.hh	2005-10-11 09:36:23.000000000 +0530
+++ tree.hh	2005-10-11 09:37:10.000000000 +0530
@@ -604,8 +604,63 @@ public:
   {
     // Nothing.
   }
+  
+  void visit_annotation_member (model_annotation_member *,
+                                const ref_forwarding_type &)
+  {
+    // Nothing.
+  }
+
+  void visit_annotation_value (model_annotation_value *,
+                               const std::string &, const ref_expression &)
+  {
+    // Nothing.
+  }
+
+  void visit_import_single (model_import_single *,
+                            const std::list<std::string> &, model_class *)
+  {
+    // Nothing.
+  }
+
+  void visit_import_on_demand (model_import_on_demand *,
+                               const std::list<std::string> &, Iname *, bool)
+  {
+    // Nothing.
+  }
 
-  void visit_element (model_element *)
+  void visit_static_import_single (model_static_import_single *,
+				   const std::list<std::string> &,
+				   model_class *, const std::string &)
+  {
+    // Nothing.
+  }
+
+  void visit_static_import_on_demand (model_static_import_on_demand *,
+				      const std::list<std::string> &,
+				      model_class *)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_source (model_unit_source *, model_package *,
+			  const std::list<ref_class> &,
+			  const std::string &,
+			  bool, const std::list<ref_import> &)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_class (model_unit_class *, model_package *,
+			 const std::list<ref_class> &,
+			 const std::string &, bool)
+  {
+    // Nothing.
+  }
+  
+  void visit_unit_fake (model_unit_fake *, model_package *,
+			const std::list<ref_class> &,
+			const std::string &, bool)
   {
     // Nothing.
   }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gcjx] Make model_element abstract and expand visitor interface
  2005-10-11  4:14 [gcjx] Make model_element abstract and expand visitor interface Ranjit Mathew
@ 2005-10-11  4:24 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2005-10-11  4:24 UTC (permalink / raw)
  To: Ranjit Mathew; +Cc: java-patches

>>>>> "Ranjit" == Ranjit Mathew <rmathew@gmail.com> writes:

Ranjit>   Now that the kludgy use of model_element in the parser is gone,
Ranjit> I made model_element::visit() abstract, removed its implementation
Ranjit> from model/element.cc and expanded the visitor interface to cover
Ranjit> the model elements that need it now.

Looks good, thanks.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-11  4:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-11  4:14 [gcjx] Make model_element abstract and expand visitor interface Ranjit Mathew
2005-10-11  4:24 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).