summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-25 18:00:41 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-11-25 18:00:41 +0000
commit1edfbf24cb7ff2f3e7d9258320eb5f23ff2d399b (patch)
tree61934c0f77327ff91dd0e9d5469a16b46699587a
parent067631e69510bed3b6622ea172ab50650aab9975 (diff)
downloadATCD-1edfbf24cb7ff2f3e7d9258320eb5f23ff2d399b.tar.gz
ChangeLogTag: Wed Nov 25 17:58:50 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog9
-rw-r--r--modules/TAO/TAO_IDL/fe/fe_utils.cpp6
-rw-r--r--modules/TAO/TAO_IDL/fe/idl.yy61
-rw-r--r--modules/TAO/TAO_IDL/fe/y.tab.cpp59
-rw-r--r--modules/TAO/TAO_IDL/include/fe_utils.h9
5 files changed, 93 insertions, 51 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index 06f608925fd..a68856d14c5 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,12 @@
+Wed Nov 25 17:58:50 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/include/fe_utils.h:
+ * TAO_IDL/fe/fe_utils.cpp:
+ * TAO_IDL/fe/y.tab.cpp:
+ * TAO_IDL/fe/idl.yy:
+
+ Added support for the 'const' formal template parameter type.
+
Wed Nov 25 01:35:38 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/include/idl_global.h:
diff --git a/modules/TAO/TAO_IDL/fe/fe_utils.cpp b/modules/TAO/TAO_IDL/fe/fe_utils.cpp
index f6a6a6658fb..53b42d331c4 100644
--- a/modules/TAO/TAO_IDL/fe/fe_utils.cpp
+++ b/modules/TAO/TAO_IDL/fe/fe_utils.cpp
@@ -7,6 +7,12 @@
#include "utl_namelist.h"
#include "utl_identifier.h"
+FE_Utils::T_Param_Info::T_Param_Info (void)
+ : const_type_ (AST_Expression::EV_none),
+ enum_const_type_decl_ (0)
+{
+}
+
FE_Utils::T_Ref_Info::T_Ref_Info (void)
: name_ (0),
params_ (0)
diff --git a/modules/TAO/TAO_IDL/fe/idl.yy b/modules/TAO/TAO_IDL/fe/idl.yy
index ed13db04c16..ba883f54205 100644
--- a/modules/TAO/TAO_IDL/fe/idl.yy
+++ b/modules/TAO/TAO_IDL/fe/idl.yy
@@ -133,7 +133,8 @@ int yylex (void);
extern "C" int yywrap (void);
extern char yytext[];
extern int yyleng;
-AST_Decl *tao_enum_constant_decl = 0;
+AST_Enum *tao_enum_constant_decl = 0;
+AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none;
#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext)
// Force the pretty debugging code to compile.
#define YYDEBUG 1
@@ -1704,23 +1705,21 @@ const_type
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_PredefinedType *c = 0;
AST_Typedef *t = 0;
+ UTL_ScopedName *sn = $1;
/*
* If the constant's type is a scoped name, it must resolve
* to a scalar constant type
*/
AST_Decl *d =
- s->lookup_by_name ($1,
- true);
+ s->lookup_by_name (sn, true);
$1->destroy ();
delete $1;
$1 = 0;
- if (s != 0 && d != 0)
+ if (s != 0 && d != 0)
{
- tao_enum_constant_decl = d;
-
/*
* Look through typedefs.
*/
@@ -1736,40 +1735,40 @@ const_type
d = t->base_type ();
}
- if (d == 0)
- {
- $$ = AST_Expression::EV_enum;
- }
- else if (d->node_type () == AST_Decl::NT_pre_defined)
+ if (d->node_type () == AST_Decl::NT_pre_defined)
{
c = AST_PredefinedType::narrow_from_decl (d);
- if (c != 0)
- {
- $$ = idl_global->PredefinedTypeToExprType (c->pt ());
- }
- else
- {
- $$ = AST_Expression::EV_enum;
- }
+ $<etval>$ = idl_global->PredefinedTypeToExprType (c->pt ());
}
else if (d->node_type () == AST_Decl::NT_string)
{
- $$ = AST_Expression::EV_string;
+ $<etval>$ = AST_Expression::EV_string;
}
else if (d->node_type () == AST_Decl::NT_wstring)
{
- $$ = AST_Expression::EV_wstring;
+ $<etval>$ = AST_Expression::EV_wstring;
+ }
+ else if (d->node_type () == AST_Decl::NT_enum)
+ {
+ $<etval>$ = AST_Expression::EV_enum;
+ tao_enum_constant_decl =
+ AST_Enum::narrow_from_decl (d);
}
else
{
- $$ = AST_Expression::EV_enum;
+ idl_global->err ()->constant_expected (sn, d);
}
}
else
{
- $$ = AST_Expression::EV_enum;
+ idl_global->err ()->lookup_error (sn);
}
+
+ sn->destroy ();
+ delete sn;
+ sn = 0;
+ $1 = 0;
}
;
@@ -5997,6 +5996,7 @@ formal_parameter_type
{
// IDL_CONST const_type
$<ntval>$ = AST_Decl::NT_const;
+ t_param_const_type = $2;
}
;
@@ -6094,9 +6094,22 @@ formal_parameter
ACE_NEW_RETURN ($<pival>$,
FE_Utils::T_Param_Info,
1);
+
+ AST_Decl::NodeType nt = $1;
- $<pival>$->type_ = $1;
+ $<pival>$->type_ = nt;
$<pival>$->name_ = $2;
+
+ if (nt == AST_Decl::NT_const)
+ {
+ $<pival>$->const_type_ = t_param_const_type;
+ $<pival>$->enum_const_type_decl_ =
+ tao_enum_constant_decl;
+
+ // Reset these values.
+ t_param_const_type = AST_Expression::EV_none;
+ tao_enum_constant_decl = 0;
+ }
}
| IDL_SEQUENCE '<' IDENTIFIER '>'
{
diff --git a/modules/TAO/TAO_IDL/fe/y.tab.cpp b/modules/TAO/TAO_IDL/fe/y.tab.cpp
index 635dcd78c94..e5715ed66a2 100644
--- a/modules/TAO/TAO_IDL/fe/y.tab.cpp
+++ b/modules/TAO/TAO_IDL/fe/y.tab.cpp
@@ -303,7 +303,8 @@ int tao_yylex (void);
extern "C" int tao_yywrap (void);
extern char tao_yytext[];
extern int tao_yyleng;
-AST_Decl *tao_enum_constant_decl = 0;
+AST_Enum *tao_enum_constant_decl = 0;
+AST_Expression::ExprType t_param_const_type = AST_Expression::EV_none;
#define TAO_YYDEBUG_LEXER_TEXT (tao_yytext[tao_yyleng] = '\0', tao_yytext)
// Force the pretty debugging code to compile.
#define TAO_YYDEBUG 1
@@ -4143,23 +4144,17 @@ tao_yyreduce:
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_PredefinedType *c = 0;
AST_Typedef *t = 0;
+ UTL_ScopedName *sn = (tao_yyvsp[(1) - (1)].idlist);
/*
* If the constant's type is a scoped name, it must resolve
* to a scalar constant type
*/
AST_Decl *d =
- s->lookup_by_name ((tao_yyvsp[(1) - (1)].idlist),
- true);
-
- (tao_yyvsp[(1) - (1)].idlist)->destroy ();
- delete (tao_yyvsp[(1) - (1)].idlist);
- (tao_yyvsp[(1) - (1)].idlist) = 0;
+ s->lookup_by_name (sn, true);
if (s != 0 && d != 0)
{
- tao_enum_constant_decl = d;
-
/*
* Look through typedefs.
*/
@@ -4175,22 +4170,11 @@ tao_yyreduce:
d = t->base_type ();
}
- if (d == 0)
- {
- (tao_yyval.etval) = AST_Expression::EV_enum;
- }
- else if (d->node_type () == AST_Decl::NT_pre_defined)
+ if (d->node_type () == AST_Decl::NT_pre_defined)
{
c = AST_PredefinedType::narrow_from_decl (d);
- if (c != 0)
- {
- (tao_yyval.etval) = idl_global->PredefinedTypeToExprType (c->pt ());
- }
- else
- {
- (tao_yyval.etval) = AST_Expression::EV_enum;
- }
+ (tao_yyval.etval) = idl_global->PredefinedTypeToExprType (c->pt ());
}
else if (d->node_type () == AST_Decl::NT_string)
{
@@ -4200,15 +4184,26 @@ tao_yyreduce:
{
(tao_yyval.etval) = AST_Expression::EV_wstring;
}
- else
+ else if (d->node_type () == AST_Decl::NT_enum)
{
(tao_yyval.etval) = AST_Expression::EV_enum;
+ tao_enum_constant_decl =
+ AST_Enum::narrow_from_decl (d);
+ }
+ else
+ {
+ idl_global->err ()->constant_expected (sn, d);
}
}
else
{
- (tao_yyval.etval) = AST_Expression::EV_enum;
+ idl_global->err ()->lookup_error (sn);
}
+
+ sn->destroy ();
+ delete sn;
+ sn = 0;
+ (tao_yyvsp[(1) - (1)].idlist) = 0;
}
break;
@@ -8852,6 +8847,7 @@ tao_yyreduce:
{
// IDL_CONST const_type
(tao_yyval.ntval) = AST_Decl::NT_const;
+ t_param_const_type = (tao_yyvsp[(2) - (2)].etval);
}
break;
@@ -8932,8 +8928,21 @@ tao_yyreduce:
FE_Utils::T_Param_Info,
1);
- (tao_yyval.pival)->type_ = (tao_yyvsp[(1) - (2)].ntval);
+ AST_Decl::NodeType nt = (tao_yyvsp[(1) - (2)].ntval);
+
+ (tao_yyval.pival)->type_ = nt;
(tao_yyval.pival)->name_ = (tao_yyvsp[(2) - (2)].strval);
+
+ if (nt == AST_Decl::NT_const)
+ {
+ (tao_yyval.pival)->const_type_ = t_param_const_type;
+ (tao_yyval.pival)->enum_const_type_decl_ =
+ tao_enum_constant_decl;
+
+ // Reset these values.
+ t_param_const_type = AST_Expression::EV_none;
+ tao_enum_constant_decl = 0;
+ }
}
break;
diff --git a/modules/TAO/TAO_IDL/include/fe_utils.h b/modules/TAO/TAO_IDL/include/fe_utils.h
index a6ce89de009..78b4c72bfa4 100644
--- a/modules/TAO/TAO_IDL/include/fe_utils.h
+++ b/modules/TAO/TAO_IDL/include/fe_utils.h
@@ -5,7 +5,8 @@
#include "ace/Unbounded_Queue.h"
-#include "ast_decl.h"
+#include "ast_enum.h"
+#include "ast_expression.h"
class UTL_StrList;
class UTL_IdList;
@@ -18,9 +19,13 @@ struct TAO_IDL_FE_Export FE_Utils
struct T_Param_Info
{
AST_Decl::NodeType type_;
+ AST_Expression::ExprType const_type_;
+ AST_Enum *enum_const_type_decl_;
ACE_CString name_;
- };
+ T_Param_Info (void);
+ };
+
typedef ACE_Unbounded_Queue<T_Param_Info> T_PARAMLIST_INFO;
struct T_Ref_Info