From d962de7484784d44a19ca5732689bdc4ae2f2007 Mon Sep 17 00:00:00 2001 From: parsons Date: Thu, 18 Feb 2010 20:37:07 +0000 Subject: ChangeLogTag: Thu Feb 18 20:36:04 UTC 2010 Jeff Parsons --- TAO/TAO_IDL/include/ast_argument.h | 2 + TAO/TAO_IDL/include/ast_array.h | 2 + TAO/TAO_IDL/include/ast_attribute.h | 2 + TAO/TAO_IDL/include/ast_component.h | 3 + TAO/TAO_IDL/include/ast_component_fwd.h | 2 + TAO/TAO_IDL/include/ast_connector.h | 2 + TAO/TAO_IDL/include/ast_constant.h | 2 + TAO/TAO_IDL/include/ast_consumes.h | 2 + TAO/TAO_IDL/include/ast_decl.h | 2 +- TAO/TAO_IDL/include/ast_emits.h | 2 + TAO/TAO_IDL/include/ast_enum.h | 2 + TAO/TAO_IDL/include/ast_enum_val.h | 2 + TAO/TAO_IDL/include/ast_eventtype.h | 3 + TAO/TAO_IDL/include/ast_eventtype_fwd.h | 2 + TAO/TAO_IDL/include/ast_exception.h | 10 +- TAO/TAO_IDL/include/ast_extended_port.h | 2 + TAO/TAO_IDL/include/ast_factory.h | 2 + TAO/TAO_IDL/include/ast_field.h | 2 + TAO/TAO_IDL/include/ast_finder.h | 2 + TAO/TAO_IDL/include/ast_home.h | 2 + TAO/TAO_IDL/include/ast_interface.h | 5 +- TAO/TAO_IDL/include/ast_interface_fwd.h | 2 + TAO/TAO_IDL/include/ast_mirror_port.h | 2 + TAO/TAO_IDL/include/ast_module.h | 4 +- TAO/TAO_IDL/include/ast_native.h | 2 + TAO/TAO_IDL/include/ast_operation.h | 2 + TAO/TAO_IDL/include/ast_param_holder.h | 2 + TAO/TAO_IDL/include/ast_porttype.h | 2 + TAO/TAO_IDL/include/ast_predefined_type.h | 2 + TAO/TAO_IDL/include/ast_provides.h | 2 + TAO/TAO_IDL/include/ast_publishes.h | 2 + TAO/TAO_IDL/include/ast_root.h | 2 + TAO/TAO_IDL/include/ast_sequence.h | 2 + TAO/TAO_IDL/include/ast_string.h | 2 + TAO/TAO_IDL/include/ast_structure.h | 5 + TAO/TAO_IDL/include/ast_structure_fwd.h | 2 + TAO/TAO_IDL/include/ast_template_module.h | 2 + TAO/TAO_IDL/include/ast_template_module_inst.h | 2 + TAO/TAO_IDL/include/ast_template_module_ref.h | 2 + TAO/TAO_IDL/include/ast_typedef.h | 2 + TAO/TAO_IDL/include/ast_union.h | 2 + TAO/TAO_IDL/include/ast_union_branch.h | 2 + TAO/TAO_IDL/include/ast_union_fwd.h | 2 + TAO/TAO_IDL/include/ast_uses.h | 2 + TAO/TAO_IDL/include/ast_valuebox.h | 2 + TAO/TAO_IDL/include/ast_valuetype.h | 5 + TAO/TAO_IDL/include/ast_valuetype_fwd.h | 2 + TAO/TAO_IDL/include/utl_scope.h | 39 +++++- TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp | 172 +++++++++++++++++++++++++ 49 files changed, 312 insertions(+), 14 deletions(-) create mode 100644 TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp (limited to 'TAO/TAO_IDL/include') diff --git a/TAO/TAO_IDL/include/ast_argument.h b/TAO/TAO_IDL/include/ast_argument.h index abbf34a0a7b..d97411eb9d7 100644 --- a/TAO/TAO_IDL/include/ast_argument.h +++ b/TAO/TAO_IDL/include/ast_argument.h @@ -111,6 +111,8 @@ public: // Cleanup. virtual void destroy (void); + + static AST_Decl::NodeType const NT; private: const Direction pd_direction; diff --git a/TAO/TAO_IDL/include/ast_array.h b/TAO/TAO_IDL/include/ast_array.h index ef0b1d9651c..5f70b4e7498 100644 --- a/TAO/TAO_IDL/include/ast_array.h +++ b/TAO/TAO_IDL/include/ast_array.h @@ -125,6 +125,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + protected: virtual int compute_size_type (void); // Compute the size type if it is unknown. diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h index 161dfe94a7b..4c721ef30dd 100644 --- a/TAO/TAO_IDL/include/ast_attribute.h +++ b/TAO/TAO_IDL/include/ast_attribute.h @@ -113,6 +113,8 @@ public: UTL_ExceptList *be_add_get_exceptions (UTL_ExceptList *t); UTL_ExceptList *be_add_set_exceptions (UTL_ExceptList *t); + static AST_Decl::NodeType const NT; + private: // Data. diff --git a/TAO/TAO_IDL/include/ast_component.h b/TAO/TAO_IDL/include/ast_component.h index c234196aeff..ee2a346f91c 100644 --- a/TAO/TAO_IDL/include/ast_component.h +++ b/TAO/TAO_IDL/include/ast_component.h @@ -69,6 +69,9 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + typedef AST_ComponentFwd FWD_TYPE; + protected: virtual AST_Provides *fe_add_provides (AST_Provides *p); diff --git a/TAO/TAO_IDL/include/ast_component_fwd.h b/TAO/TAO_IDL/include/ast_component_fwd.h index 3b5186f506b..f1dc89eb467 100644 --- a/TAO/TAO_IDL/include/ast_component_fwd.h +++ b/TAO/TAO_IDL/include/ast_component_fwd.h @@ -30,6 +30,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // _AST_COMPONENT_FWD_AST_COMPONENT_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_connector.h b/TAO/TAO_IDL/include/ast_connector.h index f3cca4b475c..33c39f352e8 100644 --- a/TAO/TAO_IDL/include/ast_connector.h +++ b/TAO/TAO_IDL/include/ast_connector.h @@ -33,6 +33,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // AST_CONNECTOR_H diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h index aee9aed5b9f..3303fb468ed 100644 --- a/TAO/TAO_IDL/include/ast_constant.h +++ b/TAO/TAO_IDL/include/ast_constant.h @@ -127,6 +127,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + protected: AST_Expression *pd_constant_value; // The value. diff --git a/TAO/TAO_IDL/include/ast_consumes.h b/TAO/TAO_IDL/include/ast_consumes.h index 58ef62049d6..df6f3b0fe9f 100644 --- a/TAO/TAO_IDL/include/ast_consumes.h +++ b/TAO/TAO_IDL/include/ast_consumes.h @@ -30,6 +30,8 @@ public: // Cleanup. virtual void destroy (void); + + static AST_Decl::NodeType const NT; }; #endif // AST_CONSUMES_H diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h index 8d4b887cc6e..f3396d4f21c 100644 --- a/TAO/TAO_IDL/include/ast_decl.h +++ b/TAO/TAO_IDL/include/ast_decl.h @@ -159,7 +159,7 @@ public: , NT_home // Denotes a CORBA component home , NT_eventtype // Denotes a CCM event source or sink , NT_eventtype_fwd // Denotes a forward declared CCM event - , NT_valuebox // Denotes an value box + , NT_valuebox // Denotes a value box , NT_type // Template interface parameter , NT_fixed // Denotes (unsupported) fixed type , NT_porttype // Denotes a port type diff --git a/TAO/TAO_IDL/include/ast_emits.h b/TAO/TAO_IDL/include/ast_emits.h index c9fc200dfce..d1aba825406 100644 --- a/TAO/TAO_IDL/include/ast_emits.h +++ b/TAO/TAO_IDL/include/ast_emits.h @@ -30,6 +30,8 @@ public: // Cleanup. virtual void destroy (void); + + static AST_Decl::NodeType const NT; }; #endif // AST_EMITS_H diff --git a/TAO/TAO_IDL/include/ast_enum.h b/TAO/TAO_IDL/include/ast_enum.h index d1df0ba3b1c..adf69fa5d35 100644 --- a/TAO/TAO_IDL/include/ast_enum.h +++ b/TAO/TAO_IDL/include/ast_enum.h @@ -109,6 +109,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: friend int tao_yyparse (void); diff --git a/TAO/TAO_IDL/include/ast_enum_val.h b/TAO/TAO_IDL/include/ast_enum_val.h index 80af9da9230..a5a3af9c675 100644 --- a/TAO/TAO_IDL/include/ast_enum_val.h +++ b/TAO/TAO_IDL/include/ast_enum_val.h @@ -94,6 +94,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // _AST_ENUM_VAL_AST_ENUM_VAL_HH diff --git a/TAO/TAO_IDL/include/ast_eventtype.h b/TAO/TAO_IDL/include/ast_eventtype.h index fad9ed9e40d..4ee1e3a995f 100644 --- a/TAO/TAO_IDL/include/ast_eventtype.h +++ b/TAO/TAO_IDL/include/ast_eventtype.h @@ -39,6 +39,9 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; + typedef AST_EventTypeFwd FWD_TYPE; }; #endif // _AST_VALUETYPE_AST_EVENTTYPE_HH diff --git a/TAO/TAO_IDL/include/ast_eventtype_fwd.h b/TAO/TAO_IDL/include/ast_eventtype_fwd.h index b7f2729b69d..38bbcfc408a 100644 --- a/TAO/TAO_IDL/include/ast_eventtype_fwd.h +++ b/TAO/TAO_IDL/include/ast_eventtype_fwd.h @@ -30,6 +30,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // _AST_VALUETYPE_FWD_AST_EVENTTYPE_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_exception.h b/TAO/TAO_IDL/include/ast_exception.h index 7ea88871915..99f31f207c7 100644 --- a/TAO/TAO_IDL/include/ast_exception.h +++ b/TAO/TAO_IDL/include/ast_exception.h @@ -105,15 +105,7 @@ public: // Cleanup. virtual void destroy (void); -private: - friend int tao_yyparse (void); - - // Scope Management Protocol. - virtual AST_Field *fe_add_field (AST_Field *f); - virtual AST_Union *fe_add_union (AST_Union *u); - virtual AST_Structure *fe_add_structure (AST_Structure *s); - virtual AST_Enum *fe_add_enum (AST_Enum *e); - virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v); + static AST_Decl::NodeType const NT; }; #endif // _AST_EXCEPTION_AST_EXCEPTION_HH diff --git a/TAO/TAO_IDL/include/ast_extended_port.h b/TAO/TAO_IDL/include/ast_extended_port.h index f44748286c7..2874e565b0f 100644 --- a/TAO/TAO_IDL/include/ast_extended_port.h +++ b/TAO/TAO_IDL/include/ast_extended_port.h @@ -31,6 +31,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif /* AST_EXTENDED_PORT_H */ diff --git a/TAO/TAO_IDL/include/ast_factory.h b/TAO/TAO_IDL/include/ast_factory.h index b2dc4ba295f..0bee1e12d4f 100644 --- a/TAO/TAO_IDL/include/ast_factory.h +++ b/TAO/TAO_IDL/include/ast_factory.h @@ -124,6 +124,8 @@ public: // Method to add exceptions. UTL_ExceptList *be_add_exceptions (UTL_ExceptList *t); + static AST_Decl::NodeType const NT; + protected: // Data. diff --git a/TAO/TAO_IDL/include/ast_field.h b/TAO/TAO_IDL/include/ast_field.h index 3c5f9de1e35..f2bcf39eec4 100644 --- a/TAO/TAO_IDL/include/ast_field.h +++ b/TAO/TAO_IDL/include/ast_field.h @@ -132,6 +132,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + protected: // Data. diff --git a/TAO/TAO_IDL/include/ast_finder.h b/TAO/TAO_IDL/include/ast_finder.h index ad363897b8c..8e6b55f3688 100644 --- a/TAO/TAO_IDL/include/ast_finder.h +++ b/TAO/TAO_IDL/include/ast_finder.h @@ -28,6 +28,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // TAO_IDL_AST_FINDER_H diff --git a/TAO/TAO_IDL/include/ast_home.h b/TAO/TAO_IDL/include/ast_home.h index 547b6aae8bd..ae0379dd431 100644 --- a/TAO/TAO_IDL/include/ast_home.h +++ b/TAO/TAO_IDL/include/ast_home.h @@ -59,6 +59,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; private: // Scope Management Protocol. diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h index 2e59a7444a5..c9fd4533202 100644 --- a/TAO/TAO_IDL/include/ast_interface.h +++ b/TAO/TAO_IDL/include/ast_interface.h @@ -153,6 +153,9 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + typedef AST_InterfaceFwd FWD_TYPE; + protected: // Data. @@ -203,8 +206,6 @@ protected: virtual AST_Attribute *fe_add_attribute (AST_Attribute *a); - virtual AST_Field *fe_add_field (AST_Field *o); - virtual AST_Operation *fe_add_operation (AST_Operation *o); virtual AST_Union *fe_add_union (AST_Union *u); diff --git a/TAO/TAO_IDL/include/ast_interface_fwd.h b/TAO/TAO_IDL/include/ast_interface_fwd.h index 925f55bbc70..7aeea93db91 100644 --- a/TAO/TAO_IDL/include/ast_interface_fwd.h +++ b/TAO/TAO_IDL/include/ast_interface_fwd.h @@ -108,6 +108,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: AST_Interface *pd_full_definition; // The interface this is a forward declaration of. diff --git a/TAO/TAO_IDL/include/ast_mirror_port.h b/TAO/TAO_IDL/include/ast_mirror_port.h index 1b7834d5914..60d926ecc33 100644 --- a/TAO/TAO_IDL/include/ast_mirror_port.h +++ b/TAO/TAO_IDL/include/ast_mirror_port.h @@ -28,6 +28,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif /* AST_MIRROR_PORT_H */ diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h index d919f8d55f6..1918a7d8cf7 100644 --- a/TAO/TAO_IDL/include/ast_module.h +++ b/TAO/TAO_IDL/include/ast_module.h @@ -114,7 +114,7 @@ public: // Has this node been referenced here already? // Override of method in UTL_Scope. virtual bool referenced (AST_Decl *e, - Identifier *id = 0); + Identifier *id = 0); // Add decls from previous opening of this module to the // 'previous' set of this module, along with the argument's @@ -134,6 +134,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: friend void fe_populate_global_scope (AST_Module *m); friend int tao_yyparse (void); diff --git a/TAO/TAO_IDL/include/ast_native.h b/TAO/TAO_IDL/include/ast_native.h index 719e2a67915..6d79ca8a5ee 100644 --- a/TAO/TAO_IDL/include/ast_native.h +++ b/TAO/TAO_IDL/include/ast_native.h @@ -40,6 +40,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif /* AST_NATIVE_H */ diff --git a/TAO/TAO_IDL/include/ast_operation.h b/TAO/TAO_IDL/include/ast_operation.h index d1aef80a39a..48d0077e3c0 100644 --- a/TAO/TAO_IDL/include/ast_operation.h +++ b/TAO/TAO_IDL/include/ast_operation.h @@ -149,6 +149,8 @@ public: // Method to add exceptions UTL_ExceptList *be_add_exceptions (UTL_ExceptList *t); + static AST_Decl::NodeType const NT; + protected: // Data. diff --git a/TAO/TAO_IDL/include/ast_param_holder.h b/TAO/TAO_IDL/include/ast_param_holder.h index e3358fe273b..0f8fcb8a6a9 100644 --- a/TAO/TAO_IDL/include/ast_param_holder.h +++ b/TAO/TAO_IDL/include/ast_param_holder.h @@ -31,6 +31,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: FE_Utils::T_Param_Info *info_; }; diff --git a/TAO/TAO_IDL/include/ast_porttype.h b/TAO/TAO_IDL/include/ast_porttype.h index feabf056b20..27306bcc055 100644 --- a/TAO/TAO_IDL/include/ast_porttype.h +++ b/TAO/TAO_IDL/include/ast_porttype.h @@ -35,6 +35,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; protected: virtual AST_Provides *fe_add_provides (AST_Provides *p); diff --git a/TAO/TAO_IDL/include/ast_predefined_type.h b/TAO/TAO_IDL/include/ast_predefined_type.h index e076bbe1ee4..24e48d991a2 100644 --- a/TAO/TAO_IDL/include/ast_predefined_type.h +++ b/TAO/TAO_IDL/include/ast_predefined_type.h @@ -124,6 +124,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + protected: virtual int compute_size_type (void); // Compute the size type if it is unknown. diff --git a/TAO/TAO_IDL/include/ast_provides.h b/TAO/TAO_IDL/include/ast_provides.h index 244954fb32f..8d4b5546092 100644 --- a/TAO/TAO_IDL/include/ast_provides.h +++ b/TAO/TAO_IDL/include/ast_provides.h @@ -28,6 +28,8 @@ public: // Cleanup. virtual void destroy (void); + + static AST_Decl::NodeType const NT; }; #endif // AST_PROVIDES_H diff --git a/TAO/TAO_IDL/include/ast_publishes.h b/TAO/TAO_IDL/include/ast_publishes.h index ceb225e7b80..a6208a1f59f 100644 --- a/TAO/TAO_IDL/include/ast_publishes.h +++ b/TAO/TAO_IDL/include/ast_publishes.h @@ -30,6 +30,8 @@ public: // Cleanup. virtual void destroy (void); + + static AST_Decl::NodeType const NT; }; #endif // AST_PUBLISHES_H diff --git a/TAO/TAO_IDL/include/ast_root.h b/TAO/TAO_IDL/include/ast_root.h index 133c5c2c642..90e39ee64c4 100644 --- a/TAO/TAO_IDL/include/ast_root.h +++ b/TAO/TAO_IDL/include/ast_root.h @@ -99,6 +99,8 @@ public: // Final cleanup. void fini (void); + static AST_Decl::NodeType const NT; + private: friend class FE_Declarator; friend int tao_yyparse (void); diff --git a/TAO/TAO_IDL/include/ast_sequence.h b/TAO/TAO_IDL/include/ast_sequence.h index 42646602968..70f54e134ce 100644 --- a/TAO/TAO_IDL/include/ast_sequence.h +++ b/TAO/TAO_IDL/include/ast_sequence.h @@ -121,6 +121,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: // Data. AST_Expression *pd_max_size; diff --git a/TAO/TAO_IDL/include/ast_string.h b/TAO/TAO_IDL/include/ast_string.h index a786dd9f60a..c11d73324e0 100644 --- a/TAO/TAO_IDL/include/ast_string.h +++ b/TAO/TAO_IDL/include/ast_string.h @@ -107,6 +107,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + private: // Data. diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h index d93f06a388b..bdd952aa5c4 100644 --- a/TAO/TAO_IDL/include/ast_structure.h +++ b/TAO/TAO_IDL/include/ast_structure.h @@ -151,6 +151,11 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + // Accessor for the member. + ACE_Unbounded_Queue &fields (void); + + static AST_Decl::NodeType const NT; protected: friend int tao_yyparse (void); diff --git a/TAO/TAO_IDL/include/ast_structure_fwd.h b/TAO/TAO_IDL/include/ast_structure_fwd.h index 75db243bc69..e0ccf980c36 100644 --- a/TAO/TAO_IDL/include/ast_structure_fwd.h +++ b/TAO/TAO_IDL/include/ast_structure_fwd.h @@ -39,6 +39,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: AST_Structure *pd_full_definition; // The structure this is a forward declaration of. diff --git a/TAO/TAO_IDL/include/ast_template_module.h b/TAO/TAO_IDL/include/ast_template_module.h index 618efcb3fd2..41a51e9fda1 100644 --- a/TAO/TAO_IDL/include/ast_template_module.h +++ b/TAO/TAO_IDL/include/ast_template_module.h @@ -46,6 +46,8 @@ public: AST_Template_Module_Ref *fe_add_template_module_ref ( AST_Template_Module_Ref *m); + static AST_Decl::NodeType const NT; + protected: FE_Utils::T_PARAMLIST_INFO * template_params_; diff --git a/TAO/TAO_IDL/include/ast_template_module_inst.h b/TAO/TAO_IDL/include/ast_template_module_inst.h index 2d40c1c6e10..ebe5e3c0d6c 100644 --- a/TAO/TAO_IDL/include/ast_template_module_inst.h +++ b/TAO/TAO_IDL/include/ast_template_module_inst.h @@ -35,6 +35,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; private: FE_Utils::T_ARGLIST * template_args_; diff --git a/TAO/TAO_IDL/include/ast_template_module_ref.h b/TAO/TAO_IDL/include/ast_template_module_ref.h index 66c21b14391..f592554ab39 100644 --- a/TAO/TAO_IDL/include/ast_template_module_ref.h +++ b/TAO/TAO_IDL/include/ast_template_module_ref.h @@ -35,6 +35,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + private: UTL_StrList * param_refs_; }; diff --git a/TAO/TAO_IDL/include/ast_typedef.h b/TAO/TAO_IDL/include/ast_typedef.h index 711ac151be7..e5ce4633bd4 100644 --- a/TAO/TAO_IDL/include/ast_typedef.h +++ b/TAO/TAO_IDL/include/ast_typedef.h @@ -115,6 +115,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + protected: virtual int compute_size_type (void); // Compute the size type if it is unknown. diff --git a/TAO/TAO_IDL/include/ast_union.h b/TAO/TAO_IDL/include/ast_union.h index c38a01df8ff..b9c3627a8f1 100644 --- a/TAO/TAO_IDL/include/ast_union.h +++ b/TAO/TAO_IDL/include/ast_union.h @@ -144,6 +144,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + protected: virtual int compute_size_type (void); // Compute the size type if it is unknown. diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h index ef4a2f4ea22..3d36f980f90 100644 --- a/TAO/TAO_IDL/include/ast_union_branch.h +++ b/TAO/TAO_IDL/include/ast_union_branch.h @@ -122,6 +122,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + private: // list of labels. UTL_LabelList *pd_ll; diff --git a/TAO/TAO_IDL/include/ast_union_fwd.h b/TAO/TAO_IDL/include/ast_union_fwd.h index a731f4ad768..d1a39d78cb2 100644 --- a/TAO/TAO_IDL/include/ast_union_fwd.h +++ b/TAO/TAO_IDL/include/ast_union_fwd.h @@ -32,6 +32,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // _AST_UNION_FWD_AST_UNION_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_uses.h b/TAO/TAO_IDL/include/ast_uses.h index 48bc0dd6794..0d3b7f00eba 100644 --- a/TAO/TAO_IDL/include/ast_uses.h +++ b/TAO/TAO_IDL/include/ast_uses.h @@ -30,6 +30,8 @@ public: // Cleanup. virtual void destroy (void); + + static AST_Decl::NodeType const NT; private: bool is_multiple_; diff --git a/TAO/TAO_IDL/include/ast_valuebox.h b/TAO/TAO_IDL/include/ast_valuebox.h index 7cdfc40d51c..56d791c81ad 100644 --- a/TAO/TAO_IDL/include/ast_valuebox.h +++ b/TAO/TAO_IDL/include/ast_valuebox.h @@ -34,6 +34,8 @@ public: // Cleanup. virtual void destroy (void); + static AST_Decl::NodeType const NT; + protected: AST_Type *pd_boxed_type; }; diff --git a/TAO/TAO_IDL/include/ast_valuetype.h b/TAO/TAO_IDL/include/ast_valuetype.h index 344570c7886..e412e31d614 100644 --- a/TAO/TAO_IDL/include/ast_valuetype.h +++ b/TAO/TAO_IDL/include/ast_valuetype.h @@ -70,6 +70,9 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + static AST_Decl::NodeType const NT; + typedef AST_ValueTypeFwd FWD_TYPE; + protected: AST_Type **pd_supports; long pd_n_supports; @@ -81,6 +84,8 @@ protected: protected: virtual AST_Factory *fe_add_factory (AST_Factory *f); + virtual AST_Field *fe_add_field (AST_Field *o); + bool derived_from_primary_key_base (const AST_ValueType *node, const AST_ValueType *pk_base) const; AST_ValueType *lookup_primary_key_base (void) const; diff --git a/TAO/TAO_IDL/include/ast_valuetype_fwd.h b/TAO/TAO_IDL/include/ast_valuetype_fwd.h index 2d525efbc01..dc455c3915d 100644 --- a/TAO/TAO_IDL/include/ast_valuetype_fwd.h +++ b/TAO/TAO_IDL/include/ast_valuetype_fwd.h @@ -30,6 +30,8 @@ public: // Visiting. virtual int ast_accept (ast_visitor *visitor); + + static AST_Decl::NodeType const NT; }; #endif // _AST_INTERFACE_FWD_AST_VALUETYPE_FWD_HH diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h index f9f697010da..cf9c8edb1c2 100644 --- a/TAO/TAO_IDL/include/utl_scope.h +++ b/TAO/TAO_IDL/include/utl_scope.h @@ -316,7 +316,26 @@ protected: friend class AST_Enum; friend class IDL_GlobalData; - // Scope Management Protocol. + /// Scope Management Protocol. + + /// Common code for most basic adding action. + AST_Decl *fe_add_decl (AST_Decl *d); + + /// Specialized for types that reference another type. + AST_Field *fe_add_ref_decl (AST_Field *d); + + template + DECL *fe_add_full_intf_decl (DECL *t); + + template + typename FULL_DECL::FWD_TYPE *fe_add_fwd_intf_decl ( + typename FULL_DECL::FWD_TYPE *t); + + AST_Structure *fe_add_full_struct_type (AST_Structure *t); + AST_StructureFwd *fe_add_fwd_struct_type (AST_StructureFwd *t); + + /// No-op base class version of the specialized adding actions. + virtual AST_PredefinedType *fe_add_predefined_type ( AST_PredefinedType *t); @@ -454,6 +473,16 @@ protected: virtual AST_Mirror_Port *fe_add_mirror_port (AST_Mirror_Port *mp); + +private: + /// Checks called from fe_add_decl() specific to interfaces + /// (and its subtypes) and operations respectively. + bool inherited_op_attr_clash (AST_Decl *t); + bool arg_specific_error (AST_Decl *t); + + /// Encapsulates the vagaries of adding fields vs decls to + /// structs/unions vs other types. + void smart_local_add (AST_Decl *t); }; // Active iterator for a UTL_Scope node @@ -495,4 +524,12 @@ private: long il; }; +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "utl_tmpl/UTL_Scope_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("utl_tmpl/UTL_Scope_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + #endif // _UTL_SCOPE_UTL_SCOPE_HH diff --git a/TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp b/TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp new file mode 100644 index 00000000000..b1b79f38411 --- /dev/null +++ b/TAO/TAO_IDL/include/utl_tmpl/UTL_Scope_T.cpp @@ -0,0 +1,172 @@ +template +DECL * +UTL_Scope::fe_add_full_intf_decl (DECL *t) +{ + if (t->redef_clash ()) + { + return 0; + } + + AST_Decl *predef = 0; + DECL *fwd = 0; + + // Already defined? + if ((predef = this->lookup_for_add (t, false)) != 0) + { + // Treat fwd declared interfaces specially + if (predef->node_type () == DECL::NT) + { + fwd = DECL::narrow_from_decl (predef); + + if (fwd == 0) + { + return 0; + } + + // Forward declared and not defined yet. + if (!fwd->is_defined ()) + { + if (fwd->defined_in () != this) + { + idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT, + fwd, + t, + ScopeAsDecl (this)); + + return 0; + } + } + // OK, not illegal redef of forward declaration. Now check whether. + // it has been referenced already. + else if (this->referenced (predef, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + ScopeAsDecl (this), + predef); + + return 0; + } + + } + else if (!can_be_redefined (predef)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + ScopeAsDecl (this), + predef); + + return 0; + } + else if (referenced (predef, t->local_name ()) && !t->is_defined ()) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + ScopeAsDecl (this), + predef); + + return 0; + } + else if (t->has_ancestor (predef)) + { + idl_global->err ()->redefinition_in_scope (t, predef); + + return 0; + } + } + + // Add it to scope + this->add_to_scope (t); + + // We do this for interfaces, valuetypes and components in + // a different place than we do for structs and unions, + // since fwd declared structs and unions must be defined in + // the same translation unit. + AST_InterfaceFwd *fd = t->fwd_decl (); + + if (0 != fd) + { + fd->set_as_defined (); + } + + // Add it to set of locally referenced symbols + this->add_to_referenced (t, + false, + t->local_name ()); + return t; +} + +template +typename FULL_DECL::FWD_TYPE * +UTL_Scope::fe_add_fwd_intf_decl (typename FULL_DECL::FWD_TYPE *t) +{ + AST_Decl *d = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (t, false)) != 0) + { + AST_Decl::NodeType nt = d->node_type (); + + // There used to be another check here ANDed with the one below: + // d->defined_in () == this. But lookup_for_add calls only + // lookup_by_name_local(), which does not bump up the scope, + // and look_in_previous() for modules. If look_in_previous() + // finds something, the scopes will NOT be the same pointer + // value, but the result is what we want. + if (nt == FULL_DECL::NT) + { + FULL_DECL *itf = FULL_DECL::narrow_from_decl (d); + + if (itf == 0) + { + return 0; + } + + // If the lookup found the full_definition member of another + // interface_fwd, don't reset this full_definition. Otherwise + // reset the member and set is_defined_ on i so it itf won't + // get destroyed twice. + if (itf->is_defined ()) + { + if (!t->is_defined ()) + { + AST_Interface *prev_fd = t->full_definition (); + prev_fd->destroy (); + // No need to delete prev_fd, the call to + // set_full_definition() below will do it. + } + + t->set_full_definition (itf); + t->set_as_defined (); + } + } + + if (!can_be_redefined (d)) { + + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + ScopeAsDecl (this), + d); + return 0; + } + + // No need to call referenced() for forward declared interafces, + // they can be redeclared after referencing. + + if (t->has_ancestor (d)) + { + idl_global->err ()->redefinition_in_scope (t, d); + return 0; + } + } + + // Add it to scope + this->add_to_scope (t); + + // Add it to set of locally referenced symbols + this->add_to_referenced (t, + false, + t->local_name ()); + + return t; +} -- cgit v1.2.1