summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-15 17:12:36 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-15 17:12:36 +0000
commit1718b23a57c08d3dc9bdb200406321b48fbcdb26 (patch)
tree5002d31a1ce55f4647680c1df2e802a530a6672b
parent8bdf17f121520d16b47391fad05071c68f65b553 (diff)
downloadATCD-1718b23a57c08d3dc9bdb200406321b48fbcdb26.tar.gz
ChangeLogTag: Thu Apr 15 17:11:58 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--CIAO/ChangeLog25
-rw-r--r--CIAO/tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc2
-rw-r--r--CIAO/tools/IDL3_to_IDL2/basic_visitor.h14
-rw-r--r--CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp16
-rw-r--r--CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.cpp283
-rw-r--r--CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.h90
6 files changed, 416 insertions, 14 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog
index f88eb101fee..1ea41a7f920 100644
--- a/CIAO/ChangeLog
+++ b/CIAO/ChangeLog
@@ -1,3 +1,28 @@
+Thu Apr 15 17:11:58 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * tools/IDL3_to_IDL2/idl3p_checking_visitor.cpp:
+ * tools/IDL3_to_IDL2/idl3p_checking_visitor.h:
+
+ New visitor that checks module scopes. If they
+ contain only template module or porttype
+ declarations, code generation for that module
+ must be skipped, since it would be empty.
+
+ * tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc:
+
+ Added new files to project.
+
+ * tools/IDL3_to_IDL2/basic_visitor.h:
+
+ Removed some pure virtual methods repeated from
+ the ast_visitor base class.
+
+ * tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp(visit_module):
+
+ Added creation and launch of the new visitor. When it's
+ finished, a member flag is checked to see if code
+ generation is necessary or not.
+
Thu Apr 15 09:56:30 UTC 2010 Marcel Smit <msmit@remedy.nl>
* connectors/dds4ccm/impl/dds/DataWriterListener.cpp:
diff --git a/CIAO/tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc b/CIAO/tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc
index 79b1353a8f8..17431c6af2f 100644
--- a/CIAO/tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc
+++ b/CIAO/tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc
@@ -18,6 +18,7 @@ project(TAO_IDL3_TO_IDL2_BE) : acelib, install, ciao_output, tao_idl_fe {
checking_visitor.cpp
identifier_helper.cpp
idl3_to_idl2_visitor.cpp
+ idl3p_checking_visitor.cpp
}
Header_Files {
@@ -30,6 +31,7 @@ project(TAO_IDL3_TO_IDL2_BE) : acelib, install, ciao_output, tao_idl_fe {
identifier_helper.h
idl3_to_idl2_visitor.h
TAO_IDL3_TO_IDL2_BE_Export.h
+ idl3p_checking_visitor.h
}
}
diff --git a/CIAO/tools/IDL3_to_IDL2/basic_visitor.h b/CIAO/tools/IDL3_to_IDL2/basic_visitor.h
index a8d0be526c0..b005e209d8b 100644
--- a/CIAO/tools/IDL3_to_IDL2/basic_visitor.h
+++ b/CIAO/tools/IDL3_to_IDL2/basic_visitor.h
@@ -30,7 +30,8 @@
class TAO_OutStream;
class UTL_ExceptList;
-class TAO_IDL3_TO_IDL2_BE_Export basic_visitor : public ast_visitor
+class TAO_IDL3_TO_IDL2_BE_Export basic_visitor
+ : public ast_visitor
{
//
// = TITLE
@@ -47,14 +48,10 @@ public:
virtual int visit_scope (UTL_Scope *node);
virtual int visit_type (AST_Type *node);
virtual int visit_predefined_type (AST_PredefinedType *node);
- virtual int visit_module (AST_Module *node) = 0;
- virtual int visit_interface (AST_Interface *node) = 0;
virtual int visit_interface_fwd (AST_InterfaceFwd *node);
virtual int visit_valuebox (AST_ValueBox *node);
virtual int visit_valuetype (AST_ValueType *node);
virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node);
- virtual int visit_component (AST_Component *node) = 0;
- virtual int visit_component_fwd (AST_ComponentFwd *node) = 0;
virtual int visit_template_module (AST_Template_Module *node);
virtual int visit_template_module_inst (AST_Template_Module_Inst *node);
virtual int visit_template_module_ref (AST_Template_Module_Ref *node);
@@ -64,12 +61,6 @@ public:
virtual int visit_publishes (AST_Publishes *node);
virtual int visit_emits (AST_Emits *node);
virtual int visit_consumes (AST_Consumes *node);
- virtual int visit_extended_port (AST_Extended_Port *node) = 0;
- virtual int visit_mirror_port (AST_Mirror_Port *node) = 0;
- virtual int visit_connector (AST_Connector *node) = 0;
- virtual int visit_eventtype (AST_EventType *node) = 0;
- virtual int visit_eventtype_fwd (AST_EventTypeFwd *node) = 0;
- virtual int visit_home (AST_Home *node) = 0;
virtual int visit_factory (AST_Factory *node);
virtual int visit_structure (AST_Structure *node);
virtual int visit_structure_fwd (AST_StructureFwd *node);
@@ -90,7 +81,6 @@ public:
virtual int visit_sequence (AST_Sequence *node);
virtual int visit_string (AST_String *node);
virtual int visit_typedef (AST_Typedef *node);
- virtual int visit_root (AST_Root *node) = 0;
virtual int visit_native (AST_Native *node);
virtual int visit_param_holder (AST_Param_Holder *node);
diff --git a/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp b/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp
index fc6d6d9f4e2..3c130dc23bb 100644
--- a/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp
+++ b/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp
@@ -2,6 +2,7 @@
// $Id$
#include "idl3_to_idl2_visitor.h"
+#include "idl3p_checking_visitor.h"
#include "identifier_helper.h"
#include "be_sunsoft.h"
#include "be_extern.h"
@@ -28,8 +29,7 @@
#include "nr_extern.h"
idl3_to_idl2_visitor::idl3_to_idl2_visitor (void)
- : basic_visitor (),
- home_ (0)
+ : home_ (0)
{
}
@@ -44,6 +44,18 @@ idl3_to_idl2_visitor::visit_module (AST_Module *node)
{
return 0;
}
+
+ idl3p_checking_visitor v;
+
+ /// Inherited visit_* methods must return int, but this
+ /// visitor never returns anything but 0.
+ (void) v.visit_scope (node);
+
+ if (!v.needs_codegen ())
+ {
+ /// We'd be generating an (illegal) empty module.
+ return 0;
+ }
*os << be_nl << be_nl;
diff --git a/CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.cpp b/CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.cpp
new file mode 100644
index 00000000000..cbb8106a198
--- /dev/null
+++ b/CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.cpp
@@ -0,0 +1,283 @@
+/* -*- c++ -*- */
+// $Id$
+
+#include "idl3p_checking_visitor.h"
+
+#include "ast_module.h"
+
+#include "utl_scope.h"
+
+idl3p_checking_visitor::idl3p_checking_visitor (void)
+ : needs_codegen_ (false)
+{
+}
+
+idl3p_checking_visitor::~idl3p_checking_visitor (void)
+{
+}
+
+int
+idl3p_checking_visitor::visit_scope (UTL_Scope *node)
+{
+ for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+ !si.is_done ();
+ si.next ())
+ {
+ /// No need to check the return value, there is no
+ /// case where it returns anything but 0.
+ (void) si.item ()->ast_accept (this);
+
+ if (this->needs_codegen_)
+ {
+ /// No need to go any further.
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_module (AST_Module *node)
+{
+ return this->visit_scope (node);
+}
+
+int
+idl3p_checking_visitor::visit_interface (AST_Interface *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_interface_fwd (AST_InterfaceFwd *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_valuebox (AST_ValueBox *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_valuetype (AST_ValueType *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_valuetype_fwd (AST_ValueTypeFwd *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_component (AST_Component *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_component_fwd (AST_ComponentFwd *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_template_module_inst (AST_Template_Module_Inst *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_extended_port (AST_Extended_Port *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_mirror_port (AST_Mirror_Port *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_connector (AST_Connector *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_eventtype (AST_EventType *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_eventtype_fwd (AST_EventTypeFwd *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_home (AST_Home *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_factory (AST_Factory *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_finder (AST_Finder *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_structure (AST_Structure *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_structure_fwd (AST_StructureFwd *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_exception (AST_Exception *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_enum (AST_Enum *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_operation (AST_Operation *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_field (AST_Field *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_argument (AST_Argument *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_attribute (AST_Attribute *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_union (AST_Union *node)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_union_fwd (AST_UnionFwd *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_union_branch (AST_UnionBranch *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_union_label (AST_UnionLabel *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_constant (AST_Constant *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_array (AST_Array *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_sequence (AST_Sequence *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_string (AST_String *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_typedef (AST_Typedef *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_root (AST_Root *)
+{
+ return 0;
+}
+
+int
+idl3p_checking_visitor::visit_native (AST_Native *)
+{
+ this->needs_codegen_ = true;
+ return 0;
+}
+
+bool
+idl3p_checking_visitor::needs_codegen (void) const
+{
+ return this->needs_codegen_;
+} \ No newline at end of file
diff --git a/CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.h b/CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.h
new file mode 100644
index 00000000000..62e11c29517
--- /dev/null
+++ b/CIAO/tools/IDL3_to_IDL2/idl3p_checking_visitor.h
@@ -0,0 +1,90 @@
+// $Id$
+
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO_IDL3_TO_IDL2_BE_DLL
+//
+// = FILENAME
+// idl3p_checking_visitor.h
+//
+// = DESCRIPTION
+// Header file for visitor that checks modules for the
+// presence of declarations other than non-code-generating
+// IDL3+ constructs. Prevents the generation of illegal
+// empty modules in the *_IDL2 artifact.
+//
+// ============================================================================
+
+#ifndef TAO_IDL3P_CHECKING_VISITOR_H
+#define TAO_IDL3P_CHECKING_VISITOR_H
+
+#include "basic_visitor.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "TAO_IDL3_TO_IDL2_BE_Export.h"
+
+class TAO_IDL3_TO_IDL2_BE_Export idl3p_checking_visitor
+ : public basic_visitor
+{
+ //
+ // = TITLE
+ // idl3p_checking_visitor
+ //
+ // = DESCRIPTION
+ // Checks for modules empty of anything except template
+ // module and porttype declarations.
+ //
+public:
+ idl3p_checking_visitor (void);
+ virtual ~idl3p_checking_visitor (void);
+
+ virtual int visit_scope (UTL_Scope *node);
+ virtual int visit_module (AST_Module *node);
+ virtual int visit_interface (AST_Interface *node);
+ virtual int visit_interface_fwd (AST_InterfaceFwd *node);
+ virtual int visit_valuebox (AST_ValueBox *node);
+ virtual int visit_valuetype (AST_ValueType *node);
+ virtual int visit_valuetype_fwd (AST_ValueTypeFwd *node);
+ virtual int visit_component (AST_Component *node);
+ virtual int visit_component_fwd (AST_ComponentFwd *node);
+ virtual int visit_template_module_inst (AST_Template_Module_Inst *node);
+ virtual int visit_extended_port (AST_Extended_Port *node);
+ virtual int visit_mirror_port (AST_Mirror_Port *node);
+ virtual int visit_connector (AST_Connector *node);
+ virtual int visit_eventtype (AST_EventType *node);
+ virtual int visit_eventtype_fwd (AST_EventTypeFwd *node);
+ virtual int visit_home (AST_Home *node);
+ virtual int visit_factory (AST_Factory *node);
+ virtual int visit_finder (AST_Finder *node);
+ virtual int visit_structure (AST_Structure *node);
+ virtual int visit_structure_fwd (AST_StructureFwd *node);
+ virtual int visit_exception (AST_Exception *node);
+ virtual int visit_enum (AST_Enum *node);
+ virtual int visit_operation (AST_Operation *node);
+ virtual int visit_field (AST_Field *node);
+ virtual int visit_argument (AST_Argument *node);
+ virtual int visit_attribute (AST_Attribute *node);
+ virtual int visit_union (AST_Union *node);
+ virtual int visit_union_fwd (AST_UnionFwd *node);
+ virtual int visit_union_branch (AST_UnionBranch *node);
+ virtual int visit_union_label (AST_UnionLabel *node);
+ virtual int visit_constant (AST_Constant *node);
+ virtual int visit_array (AST_Array *node);
+ virtual int visit_sequence (AST_Sequence *node);
+ virtual int visit_string (AST_String *node);
+ virtual int visit_typedef (AST_Typedef *node);
+ virtual int visit_root (AST_Root *node);
+ virtual int visit_native (AST_Native *node);
+
+ bool needs_codegen (void) const;
+
+private:
+ bool needs_codegen_;
+};
+
+#endif // TAO_IDL3P_CHECKING_VISITOR_H