diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-12 16:51:08 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-12 16:51:08 +0000 |
commit | f44a933b44d8246b5963e350876a5b8dfbea32cf (patch) | |
tree | a02024bd3967c2a83b982d44092e0aff6b3edc0d | |
parent | 208348a7d3eed8af574d01fabdaa034280682106 (diff) | |
download | ATCD-f44a933b44d8246b5963e350876a5b8dfbea32cf.tar.gz |
ChangeLogTag: Sat Jul 12 11:35:37 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog_ref | 27 | ||||
-rw-r--r-- | TAO/TAO_IDL/Makefile.BE | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/TAO_IDL_BE.bor | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp | 16 | ||||
-rw-r--r-- | TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp | 24 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_argument.cpp | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_codegen.cpp | 40 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_decl.cpp | 32 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_operation.cpp | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp | 192 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_root.cpp | 1 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_root/root.cpp | 42 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_traits.cpp | 75 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_decl.h | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h | 66 |
15 files changed, 465 insertions, 79 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref index 48bde883f93..70c8cd659a9 100644 --- a/TAO/ChangeLog_ref +++ b/TAO/ChangeLog_ref @@ -1,3 +1,30 @@ +Sat Jul 12 11:35:37 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_visitor_arg_tmplinst.cpp: + * TAO_IDL/be_include/be_visitor_arg_tmplinst.h: + + New files, to generate explicit template instantiations + for individual argument helper classes. + + * TAO_IDL/TAO_IDL_BE_DLL.dsp: + * TAO_IDL/TAO_IDL_BE_LIB.dsp: + * TAO_IDL/TAO_IDL_BE.bor: + * TAO_IDL/Makefile.BE: + + Added new files to projects and makefiles. + + * TAO_IDL/be/be_argument.cpp: + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_decl.cpp: + * TAO_IDL/be/be_operation.cpp: + * TAO_IDL/be/be_visitor_root.cpp: + * TAO_IDL/be/be_visitor_traits.cpp: + * TAO_IDL/be/be_visitor_root/root.cpp: + * TAO_IDL/be_include/be_decl.h: + + Changes related to the above new files and to explicit + template instantiation generation in general. + Fri Jul 11 08:19:27 2003 Jeff Parsons <j.parsons@vanderbilt.edu> * tao/BD_String_Argument_T.inl: diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE index 4726e363845..069f96733c7 100644 --- a/TAO/TAO_IDL/Makefile.BE +++ b/TAO/TAO_IDL/Makefile.BE @@ -99,6 +99,8 @@ FILES = be/be_array \ be/be_visitor_structure \ be/be_visitor_structure_fwd \ be/be_visitor_traits \ + be/be_visitor_tmplinst \ + be/be_visitor_arg_tmplinst \ be/be_visitor_typecode \ be/be_visitor_typedef \ be/be_visitor_union \ diff --git a/TAO/TAO_IDL/TAO_IDL_BE.bor b/TAO/TAO_IDL/TAO_IDL_BE.bor index 10e7b118a67..f74ea98b9cf 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE.bor +++ b/TAO/TAO_IDL/TAO_IDL_BE.bor @@ -79,6 +79,8 @@ OBJFILES = \ $(OBJDIR)\be_visitor_structure.obj \ $(OBJDIR)\be_visitor_structure_fwd.obj \ $(OBJDIR)\be_visitor_traits.obj \ + $(OBJDIR)\be_visitor_tmplinst.obj \ + $(OBJDIR)\be_visitor_arg_tmplinst.obj \ $(OBJDIR)\be_visitor_typecode.obj \ $(OBJDIR)\be_visitor_typedef.obj \ $(OBJDIR)\be_visitor_union.obj \ diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp index 26936cfbc55..2bb93a05ecf 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp @@ -298,6 +298,10 @@ SOURCE=.\be\be_visitor_ami_pre_proc.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_arg_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_argument.cpp
# End Source File
# Begin Source File
@@ -398,6 +402,10 @@ SOURCE=.\be\be_visitor_structure_fwd.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_traits.cpp
# End Source File
# Begin Source File
@@ -626,6 +634,10 @@ SOURCE=.\be_include\be_visitor_ami_pre_proc.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_arg_tmplinst.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_argument.h
# End Source File
# Begin Source File
@@ -726,6 +738,10 @@ SOURCE=.\be_include\be_visitor_structure_fwd.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_tmplinst.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_traits.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp index f769a35d27a..b2a73d6c52a 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp @@ -291,6 +291,10 @@ SOURCE=.\be\be_visitor_ami_pre_proc.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_arg_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_argument.cpp
# End Source File
# Begin Source File
@@ -391,6 +395,14 @@ SOURCE=.\be\be_visitor_structure_fwd.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_tmplinst.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\be\be_visitor_traits.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_typecode.cpp
# End Source File
# Begin Source File
@@ -611,6 +623,10 @@ SOURCE=.\be_include\be_visitor_ami_pre_proc.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_arg_tmplinst.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_argument.h
# End Source File
# Begin Source File
@@ -711,6 +727,14 @@ SOURCE=.\be_include\be_visitor_structure_fwd.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_tmplinst.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\be_include\be_visitor_traits.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_typecode.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp index 2944b352d08..e451b66d497 100644 --- a/TAO/TAO_IDL/be/be_argument.cpp +++ b/TAO/TAO_IDL/be/be_argument.cpp @@ -22,6 +22,7 @@ #include "be_argument.h" #include "be_type.h" #include "be_visitor.h" +#include "nr_extern.h" ACE_RCSID (be, be_argument, @@ -51,9 +52,12 @@ be_argument::be_argument (AST_Argument::Direction d, be_decl (AST_Decl::NT_argument, n) { - be_type *bt = be_type::narrow_from_decl (ft); - bt->seen_in_operation (I_TRUE); - this->set_arg_seen_bit (bt); + if (!ScopeAsDecl (this->defined_in ())->imported ()) + { + be_type *bt = be_type::narrow_from_decl (ft); + bt->seen_in_operation (I_TRUE); + this->set_arg_seen_bit (bt); + } } diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index bbe43ebb6b8..5fc64631539 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -1360,6 +1360,25 @@ TAO_CodeGen::gen_stub_hdr_includes (void) this->gen_standard_include (this->client_header_, "tao/Valuetype/Sequence_T.h"); } + + this->gen_arg_file_include (idl_global->decls_seen_masks.basic_arg_seen_, + "tao/Basic_Arguments.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.bd_string_arg_seen_, + "tao/BD_String_Argument_T.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.fixed_array_arg_seen_, + "tao/Fixed_Array_Argument_T.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.fixed_size_arg_seen_, + "tao/Fixed_Size_Argument_T.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.object_arg_seen_, + "tao/Object_Argument_T.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.special_basic_arg_seen_, + "tao/Special_Basic_Arguments.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.ub_string_arg_seen_, + "tao/UB_String_Arguments.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.var_array_arg_seen_, + "tao/Var_Array_Argument_T.h"); + this->gen_arg_file_include (idl_global->decls_seen_masks.var_size_arg_seen_, + "tao/Var_Size_Argument_T.h"); } void @@ -1414,25 +1433,6 @@ TAO_CodeGen::gen_stub_src_includes (void) this->gen_standard_include (this->client_stubs_, "ace/Auto_Ptr.h"); } - - this->gen_arg_file_include (idl_global->decls_seen_masks.basic_arg_seen_, - "tao/Basic_Arguments.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.bd_string_arg_seen_, - "tao/BD_String_Argument_T.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.fixed_array_arg_seen_, - "tao/Fixed_Array_Argument_T.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.fixed_size_arg_seen_, - "tao/Fixed_Size_Argument_T.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.object_arg_seen_, - "tao/Object_Argument_T.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.special_basic_arg_seen_, - "tao/Special_Basic_Arguments.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.ub_string_arg_seen_, - "tao/UB_String_Arguments.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.var_array_arg_seen_, - "tao/Var_Array_Argument_T.h"); - this->gen_arg_file_include (idl_global->decls_seen_masks.var_size_arg_seen_, - "tao/Var_Size_Argument_T.h"); } void @@ -1441,7 +1441,7 @@ TAO_CodeGen::gen_arg_file_include (ACE_UINT64 mask, const char *filepath) if (ACE_BIT_ENABLED (idl_global->decls_seen_info_, mask)) { - this->gen_standard_include (this->client_stubs_, + this->gen_standard_include (this->client_header_, filepath); } } diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index 831090db995..d869e645701 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -66,7 +66,9 @@ be_decl::be_decl (void) cli_stub_cdr_op_gen_ (I_FALSE), cli_inline_cdr_op_gen_ (I_FALSE), cli_inline_cdr_decl_gen_ (I_FALSE), - cli_traits_gen_ (I_FALSE) + cli_traits_gen_ (I_FALSE), + cli_tmpl_class_gen_ (I_FALSE), + cli_pragma_inst_gen_ (I_FALSE) { } @@ -90,7 +92,9 @@ be_decl::be_decl (AST_Decl::NodeType type, cli_stub_cdr_op_gen_ (I_FALSE), cli_inline_cdr_op_gen_ (I_FALSE), cli_inline_cdr_decl_gen_ (I_FALSE), - cli_traits_gen_ (I_FALSE) + cli_traits_gen_ (I_FALSE), + cli_tmpl_class_gen_ (I_FALSE), + cli_pragma_inst_gen_ (I_FALSE) { } @@ -331,6 +335,18 @@ be_decl::cli_traits_gen (void) } idl_bool +be_decl::cli_tmpl_class_gen (void) +{ + return this->cli_tmpl_class_gen_; +} + +idl_bool +be_decl::cli_pragma_inst_gen (void) +{ + return this->cli_pragma_inst_gen_; +} + +idl_bool be_decl::cli_inline_gen (void) { return this->cli_inline_gen_; @@ -428,6 +444,18 @@ be_decl::cli_traits_gen (idl_bool val) } void +be_decl::cli_tmpl_class_gen (idl_bool val) +{ + this->cli_tmpl_class_gen_ = val; +} + +void +be_decl::cli_pragma_inst_gen (idl_bool val) +{ + this->cli_pragma_inst_gen_ = val; +} + +void be_decl::srv_hdr_gen (idl_bool val) { this->srv_hdr_gen_ = val; diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index 32264dce193..e143858b028 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -63,9 +63,12 @@ be_operation::be_operation (AST_Type *rt, ACE_NEW (this->strategy_, be_operation_default_strategy (this)); - be_type *bt = be_type::narrow_from_decl (rt); - bt->seen_in_operation (I_TRUE); - this->set_arg_seen_bit (bt); + if (!this->imported ()) + { + be_type *bt = be_type::narrow_from_decl (rt); + bt->seen_in_operation (I_TRUE); + this->set_arg_seen_bit (bt); + } } diff --git a/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp b/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp new file mode 100644 index 00000000000..b533f4efb77 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_arg_tmplinst.cpp @@ -0,0 +1,192 @@ +//============================================================================= +/** +* @file be_visitor_arg_tmplinst.cpp +* +* $Id$ +* +* This visitor generates explicit template instantiations, guarded so they +* are seen only by compilers whose platforms require explicit template +* instantiation, for the individual argument template helper classes. +* +* @author Jeff Parsons <j.parsons@vanderbilt.edu> +*/ +//============================================================================= + +#include "be_visitor_arg_tmplinst.h" +#include "be_visitor_context.h" +#include "be_interface.h" +#include "be_valuetype.h" +#include "be_interface_fwd.h" +#include "be_valuetype_fwd.h" +#include "be_eventtype.h" +#include "be_eventtype_fwd.h" +#include "be_array.h" +#include "be_enum.h" +#include "be_sequence.h" +#include "be_string.h" +#include "be_structure.h" +#include "be_field.h" +#include "be_union.h" +#include "be_union_branch.h" +#include "be_typedef.h" +#include "be_helper.h" + +be_visitor_arg_tmplinst::be_visitor_arg_tmplinst (be_visitor_tmplinst *rhs) + : be_visitor_tmplinst (rhs) +{ +} + +be_visitor_arg_tmplinst::~be_visitor_arg_tmplinst (void) +{ +} + +int +be_visitor_arg_tmplinst::visit_interface (be_interface *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_interface_fwd (be_interface_fwd *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_valuetype (be_valuetype *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_valuetype_fwd (be_valuetype_fwd *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_eventtype (be_eventtype *node) +{ + return this->visit_valuetype (node); +} + +int +be_visitor_arg_tmplinst::visit_eventtype_fwd (be_eventtype_fwd *node) +{ + return this->visit_valuetype_fwd (node); +} + +int +be_visitor_arg_tmplinst::visit_sequence (be_sequence *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_string (be_string *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_array (be_array *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_enum (be_enum *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_structure (be_structure *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_field (be_field *node) +{ + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arg_tmplinst::" + "visit_field - " + "Bad field type\n"), + -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arg_tmplinst::" + "visit_field - " + "codegen for field type failed\n"), + -1); + } + + return 0; +} + +int +be_visitor_arg_tmplinst::visit_union (be_union *node) +{ + return 0; +} + +int +be_visitor_arg_tmplinst::visit_union_branch (be_union_branch *node) +{ + be_type *bt = be_type::narrow_from_decl (node->field_type ()); + + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arg_tmplinst::" + "visit_union_branch - " + "Bad union_branch type\n"), + -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arg_tmplinst::" + "visit_union_branch - " + "codegen for union_branch type failed\n"), + -1); + } + + return 0; +} + +int +be_visitor_arg_tmplinst::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + + // Make a decision based on the primitive base type. + be_type *bt = node->primitive_base_type (); + + if (!bt || (bt->accept (this) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_arg_tmplinst::" + "visit_typedef - " + "Bad primitive type\n"), + -1); + } + + this->ctx_->alias (0); + return 0; +} + +void +be_visitor_arg_tmplinst::cleanup (void) +{ +} + diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp index 569924f5b47..10f6c35ceff 100644 --- a/TAO/TAO_IDL/be/be_visitor_root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root.cpp @@ -58,6 +58,7 @@ #include "be_visitor_component_fwd.h" #include "be_visitor_home.h" #include "be_visitor_traits.h" +#include "be_visitor_tmplinst.h" #include "be_visitor_context.h" #include "be_visitor_root/root.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 800e5cd83e5..9306335402d 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -307,7 +307,7 @@ int be_visitor_root::visit_root (be_root *node) } - // Make one more pass over the entire tree and generate the CDR operators. + // Make another pass over the entire tree and generate the CDR operators. ctx = *this->ctx_; status = 0; @@ -344,7 +344,7 @@ int be_visitor_root::visit_root (be_root *node) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_root::" - "visit_constant - " + "visit_root - " "Bad context state\n"), -1); } @@ -359,6 +359,44 @@ int be_visitor_root::visit_root (be_root *node) -1); } + if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CS) + { + // Make two more passes over the AST to generate the explicit + // template instantiations, one for 'template class ...' and + // one for '#pragma instantiate ...'. + + *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + os->gen_ifdef_AHETI (); + + be_visitor_tmplinst visitor (this->ctx_); + + if (node->accept (&visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_root - " + "explicit template instantiation failed\n"), + -1); + } + + os->gen_elif_AHETI (); + + visitor.switch_mode (); + + if (node->accept (&visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_root::" + "visit_root - " + "explicit template instantiation failed\n"), + -1); + } + + os->gen_endif_AHETI (); + } + // Generate any final code such as #endifs and/or EOF newlines. switch (this->ctx_->state ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_traits.cpp b/TAO/TAO_IDL/be/be_visitor_traits.cpp index acfe7f68d81..afa3b14a0d9 100644 --- a/TAO/TAO_IDL/be/be_visitor_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_traits.cpp @@ -95,11 +95,6 @@ be_visitor_traits::visit_interface (be_interface *node) TAO_OutStream *os = this->ctx_->stream (); - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); - // Since the three blocks below generate specialized (i.e., non-template) // classes, we don't want to generate them unless it's necessary - thus // the logic surrounding each one. @@ -108,6 +103,8 @@ be_visitor_traits::visit_interface (be_interface *node) // declarations. if (!node->imported () && !node->is_defined ()) { + os->gen_ifdef_macro (node->flat_name (), "traits"); + *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl << "struct " << be_global->stub_export_macro () << " Objref_Traits<" @@ -126,12 +123,16 @@ be_visitor_traits::visit_interface (be_interface *node) << "TAO_OutputCDR & cdr" << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "};"; + + os->gen_endif (); } // This should be generated even for imported nodes. The ifdef guard prevents // multiple declarations. if (node->seen_in_operation ()) { + os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl << "class " << be_global->stub_export_macro () << " Arg_Traits<" @@ -144,13 +145,11 @@ be_visitor_traits::visit_interface (be_interface *node) << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; - } - os->gen_endif (); - - int status = this->visit_scope (node); + os->gen_endif (); + } - if (status != 0) + if (this->visit_scope (node) != 0) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_traits::" @@ -175,9 +174,7 @@ be_visitor_traits::visit_interface_fwd (be_interface_fwd *node) // The logic in visit_interface() should handle what gets generated // and what doesn't. - int status = this->visit_interface (fd); - - if (status != 0) + if (this->visit_interface (fd) != 0) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_traits::" @@ -199,15 +196,12 @@ be_visitor_traits::visit_valuetype (be_valuetype *node) TAO_OutStream *os = this->ctx_->stream (); - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); - // I think we need to generate this only for non-defined forward // declarations. if (!node->imported () && !node->is_defined ()) { + os->gen_ifdef_macro (node->flat_name (), "traits"); + *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl << "struct " << be_global->stub_export_macro () << " Value_Traits<" @@ -217,12 +211,16 @@ be_visitor_traits::visit_valuetype (be_valuetype *node) << "static void tao_remove_ref (" << node->name () << " *);" << be_uidt_nl << "};"; + + os->gen_endif (); } // This should be generated even for imported nodes. The ifdef guard prevents // multiple declarations. if (node->seen_in_operation ()) { + os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl << "class " << be_global->stub_export_macro () << " Arg_Traits<" @@ -235,9 +233,9 @@ be_visitor_traits::visit_valuetype (be_valuetype *node) << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; - } - os->gen_endif (); + os->gen_endif (); + } int status = this->visit_scope (node); @@ -306,7 +304,7 @@ be_visitor_traits::visit_sequence (be_sequence *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + os->gen_ifdef_macro (node->flat_name (), "traits"); *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl @@ -350,13 +348,10 @@ be_visitor_traits::visit_string (be_string *node) TAO_OutStream *os = this->ctx_->stream (); - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); - // A workaround since bounded (w)strings are all generated as typedefs - // of (w)char *. + // A workaround 'dummy' type, since bounded (w)strings are all + // generated as typedefs of (w)char *. *os << be_nl << be_nl << "struct " << alias->local_name () << "_" << bound << " {};"; @@ -385,26 +380,8 @@ be_visitor_traits::visit_array (be_array *node) return 0; } - if (!node->seen_in_operation ()) - { - // @@@ (JP) I don't think we have to generate the Array_Traits decl. - /* - if (node->imported ()) - { - return 0; - } - */ - } - TAO_OutStream *os = this->ctx_->stream (); - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - - os->gen_ifdef_macro (node->flat_name (), "arg_traits"); - - // @@@ (JP) I don't think we have to generate the Array_Traits decl. - // This is used by the _var and _out classes, so it should always be // generated in the main file. if (!node->imported () && !node->anonymous ()) @@ -434,6 +411,8 @@ be_visitor_traits::visit_array (be_array *node) // multiple declarations. if (node->seen_in_operation ()) { + os->gen_ifdef_macro (node->flat_name (), "arg_traits"); + *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl << "class " << be_global->stub_export_macro () << " Arg_Traits<" @@ -455,9 +434,9 @@ be_visitor_traits::visit_array (be_array *node) << ">" << be_uidt << be_uidt << be_uidt << be_uidt_nl << "{" << be_nl << "};"; - } - os->gen_endif (); + os->gen_endif (); + } node->cli_traits_gen (I_TRUE); return 0; @@ -542,9 +521,7 @@ be_visitor_traits::visit_structure (be_structure *node) os->gen_endif (); } - int status = this->visit_scope (node); - - if (status != 0) + if (this->visit_scope (node) != 0) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_traits::" diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index 4d766ea2e39..262bc2768f5 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -87,6 +87,8 @@ public: idl_bool cli_inline_cdr_op_gen (void); idl_bool cli_inline_cdr_decl_gen (void); idl_bool cli_traits_gen (void); + idl_bool cli_tmpl_class_gen (void); + idl_bool cli_pragma_inst_gen (void); // Set the flag indicating that code generation is done. void cli_hdr_gen (idl_bool); @@ -104,6 +106,8 @@ public: void cli_inline_cdr_op_gen (idl_bool); void cli_inline_cdr_decl_gen (idl_bool); void cli_traits_gen (idl_bool); + void cli_tmpl_class_gen (idl_bool); + void cli_pragma_inst_gen (idl_bool); // Narrowing DEF_NARROW_METHODS1 (be_decl, AST_Decl); @@ -131,6 +135,8 @@ private: idl_bool cli_inline_cdr_op_gen_; idl_bool cli_inline_cdr_decl_gen_; idl_bool cli_traits_gen_; + idl_bool cli_tmpl_class_gen_; + idl_bool cli_pragma_inst_gen_; }; #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h b/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h new file mode 100644 index 00000000000..cb94bf5ed2d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_arg_tmplinst.h @@ -0,0 +1,66 @@ +//============================================================================= +/** +* @file be_visitor_arg_tmplinst.h +* +* $Id$ +* +* This visitor generates explicit template instantiations, guarded so they +* are seen only by compilers whose platforms require explicit template +* instantiation, for the individual argument template helper classes. +* +* @author Jeff Parsons <j.parsons@vanderbilt.edu> +*/ +//============================================================================= +#ifndef TAO_BE_VISITOR_ARG_TMPLINST_H +#define TAO_BE_VISITOR_ARG_TMPLINST_H + +#include "be_visitor_tmplinst.h" + +/** + * @class be_visitor_arg_tmplinst + * + * @brief Generates explicit template instantiations for arg helper classes. + */ +class be_visitor_arg_tmplinst : public be_visitor_tmplinst +{ +public: + be_visitor_arg_tmplinst (be_visitor_tmplinst *rhs); + + virtual ~be_visitor_arg_tmplinst (void); + + virtual int visit_array (be_array *node); + + virtual int visit_enum (be_enum *node); + + virtual int visit_interface (be_interface *node); + + virtual int visit_interface_fwd (be_interface_fwd *node); + + virtual int visit_valuetype (be_valuetype *node); + + virtual int visit_valuetype_fwd (be_valuetype_fwd *node); + + virtual int visit_eventtype (be_eventtype *node); + + virtual int visit_eventtype_fwd (be_eventtype_fwd *node); + + virtual int visit_sequence (be_sequence *node); + + virtual int visit_string (be_string *node); + + virtual int visit_structure (be_structure *node); + + virtual int visit_field (be_field *node); + + virtual int visit_union (be_union *node); + + virtual int visit_union_branch (be_union_branch *node); + + virtual int visit_typedef (be_typedef *node); + +protected: + virtual void cleanup (void); +}; + + +#endif // TAO_BE_VISITOR_ARG_TMPLINST_H |