Skip to content

Commit 27e40ae

Browse files
authored
Merge pull request #2379 from mitza-oci/tao2-idl-map
[TAO 2] Fixes for IDL maps
2 parents fd3897e + d3b733f commit 27e40ae

30 files changed

Lines changed: 2147 additions & 1868 deletions

TAO/TAO_IDL/ast/ast_array.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ AST_Array::set_base_type (AST_Type *nbt)
226226
AST_Decl::NodeType bnt = nbt->node_type ();
227227

228228
if (bnt == AST_Decl::NT_sequence
229+
|| bnt == AST_Decl::NT_map
229230
|| bnt == AST_Decl::NT_param_holder)
230231
{
231232
this->owns_base_type_ = true;

TAO/TAO_IDL/ast/ast_decl.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
6868
#include <ast_field.h>
6969
#include <ast_structure.h>
7070
#include <ast_sequence.h>
71+
#include <ast_map.h>
7172
#include <ast_string.h>
7273
#include <ast_typedef.h>
7374
#include <ast_visitor.h>
@@ -857,6 +858,11 @@ AST_Decl::node_type_to_string (NodeType nt)
857858
}
858859
}
859860

861+
const char *AST_Decl::node_type_name () const
862+
{
863+
return node_type_to_string (pd_node_type);
864+
}
865+
860866
// Return TRUE if one of my ancestor scopes is "s"
861867
// and FALSE otherwise.
862868
bool
@@ -1494,6 +1500,14 @@ AST_Decl::contains_wstring ()
14941500
break;
14951501
}
14961502

1503+
case AST_Decl::NT_map:
1504+
{
1505+
AST_Map *m = dynamic_cast<AST_Map *> (this);
1506+
this->contains_wstring_ = m->key_type ()->contains_wstring () ||
1507+
m->value_type ()->contains_wstring ();
1508+
break;
1509+
}
1510+
14971511
case AST_Decl::NT_attr:
14981512
case AST_Decl::NT_field:
14991513
case AST_Decl::NT_union_branch:

TAO/TAO_IDL/ast/ast_field.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ AST_Field::AST_Field (AST_Type *ft,
103103
this->owns_base_type_ =
104104
fnt == AST_Decl::NT_array
105105
|| fnt == AST_Decl::NT_sequence
106+
|| fnt == AST_Decl::NT_map
106107
|| fnt == AST_Decl::NT_fixed
107108
|| fnt == AST_Decl::NT_param_holder;
108109

@@ -136,6 +137,7 @@ AST_Field::AST_Field (AST_Decl::NodeType nt,
136137
this->owns_base_type_ =
137138
fnt == AST_Decl::NT_array
138139
|| fnt == AST_Decl::NT_sequence
140+
|| fnt == AST_Decl::NT_map
139141
|| fnt == AST_Decl::NT_fixed
140142
|| fnt == AST_Decl::NT_param_holder;
141143

TAO/TAO_IDL/ast/ast_sequence.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ AST_Sequence::AST_Sequence (AST_Expression *ms,
141141
this->owns_base_type_ =
142142
nt == AST_Decl::NT_array
143143
|| nt == AST_Decl::NT_sequence
144+
|| nt == AST_Decl::NT_map
144145
|| nt == AST_Decl::NT_param_holder;
145146
}
146147

@@ -180,7 +181,8 @@ AST_Sequence::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
180181
if (nt != AST_Decl::NT_struct
181182
&& nt != AST_Decl::NT_union
182183
&& nt != AST_Decl::NT_valuetype
183-
&& nt != AST_Decl::NT_sequence)
184+
&& nt != AST_Decl::NT_sequence
185+
&& nt != AST_Decl::NT_map)
184186
{
185187
return false;
186188
}

TAO/TAO_IDL/be/be_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3772,7 +3772,7 @@ TAO_CodeGen::make_rand_extension (char * const t)
37723772

37733773
// Factor out the constant coefficient.
37743774
float const coefficient =
3775-
static_cast<float> (MAX_VAL / (RAND_MAX + 1.0f));
3775+
static_cast<float> (MAX_VAL / (static_cast<float> (RAND_MAX) + 1.0f));
37763776

37773777
for (unsigned int n = 0; n < NUM_CHARS; ++n)
37783778
{

TAO/TAO_IDL/be/be_visitor_array/array.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "be_structure.h"
2424
#include "be_union.h"
2525
#include "be_sequence.h"
26+
#include "be_map.h"
2627
#include "be_helper.h"
2728
#include "be_extern.h"
2829
#include "utl_identifier.h"

TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,12 @@ be_visitor_array_cdr_op_cs::visit_sequence (be_sequence *node)
518518
return this->visit_node (node);
519519
}
520520

521+
int
522+
be_visitor_array_cdr_op_cs::visit_map (be_map *node)
523+
{
524+
return this->visit_node (node);
525+
}
526+
521527
int
522528
be_visitor_array_cdr_op_cs::visit_string (be_string *node)
523529
{

TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ be_visitor_sequence_buffer_type::visit_sequence (be_sequence *node)
8686
return this->visit_node (node);
8787
}
8888

89+
int
90+
be_visitor_sequence_buffer_type::visit_map (be_map *node)
91+
{
92+
return this->visit_node (node);
93+
}
94+
8995
int
9096
be_visitor_sequence_buffer_type::visit_interface (be_interface *node)
9197
{

TAO/TAO_IDL/be/be_visitor_sequence/sequence.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "be_home.h"
2424
#include "be_predefined_type.h"
2525
#include "be_sequence.h"
26+
#include "be_map.h"
2627
#include "be_string.h"
2728
#include "be_structure.h"
2829
#include "be_structure_fwd.h"

TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,18 @@ be_visitor_union_branch_private_ch::visit_predefined_type (
406406

407407
int
408408
be_visitor_union_branch_private_ch::visit_sequence (be_sequence *node)
409+
{
410+
return visit_seq_map_common (node);
411+
}
412+
413+
int
414+
be_visitor_union_branch_private_ch::visit_map (be_map *node)
415+
{
416+
return visit_seq_map_common (node);
417+
}
418+
419+
int
420+
be_visitor_union_branch_private_ch::visit_seq_map_common (be_type *node)
409421
{
410422
be_decl *ub = this->ctx_->node ();
411423
be_decl *bu = this->ctx_->scope ()->decl ();
@@ -425,7 +437,7 @@ be_visitor_union_branch_private_ch::visit_sequence (be_sequence *node)
425437
{
426438
ACE_ERROR_RETURN ((LM_ERROR,
427439
"(%N:%l) be_visitor_union_branch_private_ch::"
428-
"visit_sequence - "
440+
"visit_seq_map_common - "
429441
"bad context information\n"),
430442
-1);
431443
}

0 commit comments

Comments
 (0)