Skip to content

Commit 8a02bf6

Browse files
authored
Merge pull request #2378 from iguessthislldo/igtd/map-fixes
Fixes for IDL maps
2 parents d9d33db + e196613 commit 8a02bf6

31 files changed

Lines changed: 2166 additions & 1878 deletions

TAO/NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
USER VISIBLE CHANGES BETWEEN TAO-4.0.3 and TAO-4.0.4
22
====================================================
33

4+
. TAO_IDL:
5+
. Fixes for IDL maps (still not fully supported in TAO):
6+
. Support for parsing bounded maps, but the `std::map` generated by the
7+
builtin backend doesn't enforce the bound
8+
. Support for using maps in unions, sequences, and arrays
9+
. Fix memory leaks caused by maps
10+
411
USER VISIBLE CHANGES BETWEEN TAO-4.0.2 and TAO-4.0.3
512
====================================================
613

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

@@ -140,6 +141,7 @@ AST_Field::AST_Field (AST_Decl::NodeType nt,
140141
this->owns_base_type_ =
141142
fnt == AST_Decl::NT_array
142143
|| fnt == AST_Decl::NT_sequence
144+
|| fnt == AST_Decl::NT_map
143145
|| fnt == AST_Decl::NT_fixed
144146
|| fnt == AST_Decl::NT_param_holder;
145147

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
@@ -3750,7 +3750,7 @@ TAO_CodeGen::make_rand_extension (char * const t)
37503750

37513751
// Factor out the constant coefficient.
37523752
float const coefficient =
3753-
static_cast<float> (MAX_VAL / (RAND_MAX + 1.0f));
3753+
static_cast<float> (MAX_VAL / (static_cast<float> (RAND_MAX) + 1.0f));
37543754

37553755
for (unsigned int n = 0; n < NUM_CHARS; ++n)
37563756
{

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
@@ -517,6 +517,12 @@ be_visitor_array_cdr_op_cs::visit_sequence (be_sequence *node)
517517
return this->visit_node (node);
518518
}
519519

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

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"

0 commit comments

Comments
 (0)