summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hornsey <hornseyf@objectcomputing.com>2018-10-09 15:37:50 -0500
committerFred Hornsey <hornseyf@objectcomputing.com>2018-10-09 15:37:50 -0500
commitfd01bfeb662021662c80bd9343a9faef7e93c36e (patch)
tree6dbc87b70ade954b6d163ca568ed37517b3e37f9
parent6913f1423f87f25a7ab4f76b4dd37379b3e6d129 (diff)
downloadATCD-fd01bfeb662021662c80bd9343a9faef7e93c36e.tar.gz
tao_idl: Fixes for AST dump and annotations
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp10
-rw-r--r--TAO/TAO_IDL/ast/ast_enum.cpp2
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp1
-rw-r--r--TAO/TAO_IDL/ast/ast_union.cpp1
-rw-r--r--TAO/TAO_IDL/ast/ast_union_branch.cpp3
-rw-r--r--TAO/TAO_IDL/include/ast_concrete_type.h2
-rw-r--r--TAO/TAO_IDL/include/ast_constant.h2
-rw-r--r--TAO/TAO_IDL/include/ast_decl.h5
-rw-r--r--TAO/TAO_IDL/include/ast_enum.h2
-rw-r--r--TAO/TAO_IDL/include/ast_enum_val.h2
-rw-r--r--TAO/TAO_IDL/include/ast_module.h2
-rw-r--r--TAO/TAO_IDL/include/ast_union_branch.h2
-rw-r--r--TAO/TAO_IDL/util/utl_idlist.cpp25
13 files changed, 43 insertions, 16 deletions
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp
index da422ebc025..3a53bb19a37 100644
--- a/TAO/TAO_IDL/ast/ast_decl.cpp
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -1550,7 +1550,7 @@ void AST_Decl::annotations (Annotations *annotations)
else
{
ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("ERROR: %C is annotated but its type can't be annotated!\n"),
+ ACE_TEXT ("WARNING: %C is annotated but its type can't be annotated!\n"),
full_name ()
));
}
@@ -1587,7 +1587,7 @@ AST_Decl::dump_annotations (ACE_OSTREAM_TYPE &o, bool print_inline)
void
AST_Decl::dump_with_annotations (ACE_OSTREAM_TYPE &o, bool inline_annotations)
{
- if (annotatable ())
+ if (annotatable () && auto_dump_annotations())
{
dump_annotations (o, inline_annotations);
}
@@ -1614,3 +1614,9 @@ AST_Decl::dump_annotations_inline () const
{
return false;
}
+
+bool
+AST_Decl::auto_dump_annotations () const
+{
+ return true;
+}
diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp
index e0b0629f18c..6ad9afb3fc9 100644
--- a/TAO/TAO_IDL/ast/ast_enum.cpp
+++ b/TAO/TAO_IDL/ast/ast_enum.cpp
@@ -315,8 +315,6 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t)
void
AST_Enum::dump (ACE_OSTREAM_TYPE &o)
{
- dump_annotations (o);
-
AST_Decl *d = 0;
if (this->is_local ())
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index a52406031bd..7c6ecc1e7a0 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -138,7 +138,6 @@ IMPL_NARROW_FROM_SCOPE(AST_Module)
void
AST_Module::dump (ACE_OSTREAM_TYPE &o)
{
- dump_annotations (o);
this->dump_i (o, "module ");
this->local_name ()->dump (o);
this->dump_i (o, " {\n");
diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp
index debcb10a3c9..6f848616e64 100644
--- a/TAO/TAO_IDL/ast/ast_union.cpp
+++ b/TAO/TAO_IDL/ast/ast_union.cpp
@@ -966,7 +966,6 @@ AST_Union::fe_add_enum_val (AST_EnumVal *t)
void
AST_Union::dump (ACE_OSTREAM_TYPE &o)
{
- dump_annotations (o);
o << "union ";
this->local_name ()->dump (o);
o << " switch (";
diff --git a/TAO/TAO_IDL/ast/ast_union_branch.cpp b/TAO/TAO_IDL/ast/ast_union_branch.cpp
index 60ca8c8ad0a..e0a205b9a87 100644
--- a/TAO/TAO_IDL/ast/ast_union_branch.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_branch.cpp
@@ -118,7 +118,8 @@ AST_UnionBranch::dump (ACE_OSTREAM_TYPE &o)
idl_global->indent ()->increase ();
idl_global->indent ()->skip_to (o);
- AST_Field::dump_with_annotations (o, true /* inline annotations */);
+ AST_Field::dump_annotations (o, true /* print inline */);
+ AST_Field::dump (o);
idl_global->indent ()->decrease ();
}
diff --git a/TAO/TAO_IDL/include/ast_concrete_type.h b/TAO/TAO_IDL/include/ast_concrete_type.h
index 18018eba25d..edac0ba5211 100644
--- a/TAO/TAO_IDL/include/ast_concrete_type.h
+++ b/TAO/TAO_IDL/include/ast_concrete_type.h
@@ -84,6 +84,8 @@ public:
// Narrowing.
DEF_NARROW_FROM_DECL(AST_ConcreteType);
+
+ virtual bool annotatable () const { return true; }
};
#endif // _AST_CONCRETE_TYPE_AST_CONCRETE_TYPE_HH
diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h
index 4af90810fc7..01196eb790a 100644
--- a/TAO/TAO_IDL/include/ast_constant.h
+++ b/TAO/TAO_IDL/include/ast_constant.h
@@ -126,6 +126,8 @@ public:
static AST_Decl::NodeType const NT;
+ virtual bool annotatable () const { return true; }
+
protected:
AST_Expression *pd_constant_value;
// The value.
diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h
index 73837e67a15..754ba46d288 100644
--- a/TAO/TAO_IDL/include/ast_decl.h
+++ b/TAO/TAO_IDL/include/ast_decl.h
@@ -351,6 +351,11 @@ public:
*/
virtual bool dump_annotations_inline () const;
+ /**
+ * Return true if annotations are dumped at all when using <<
+ */
+ virtual bool auto_dump_annotations () const;
+
protected:
// These are not private because they're used by
// be_predefined_type' constructor and can be called
diff --git a/TAO/TAO_IDL/include/ast_enum.h b/TAO/TAO_IDL/include/ast_enum.h
index fb373291f97..62c10cb6622 100644
--- a/TAO/TAO_IDL/include/ast_enum.h
+++ b/TAO/TAO_IDL/include/ast_enum.h
@@ -124,6 +124,8 @@ private:
virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
// Scope Management.
+
+ virtual bool annotatable () const { return true; }
};
#endif // _AST_ENUM_AST_ENUM_HH
diff --git a/TAO/TAO_IDL/include/ast_enum_val.h b/TAO/TAO_IDL/include/ast_enum_val.h
index a7d5df282d3..cdc7abbf974 100644
--- a/TAO/TAO_IDL/include/ast_enum_val.h
+++ b/TAO/TAO_IDL/include/ast_enum_val.h
@@ -88,6 +88,8 @@ public:
virtual int ast_accept (ast_visitor *visitor);
static AST_Decl::NodeType const NT;
+
+ virtual bool annotatable () const { return true; }
};
#endif // _AST_ENUM_VAL_AST_ENUM_VAL_HH
diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h
index eefe207a66d..269a86075b2 100644
--- a/TAO/TAO_IDL/include/ast_module.h
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -236,6 +236,8 @@ public:
// multiple IDL files.
void reset_last_in_same_parent_scope (void);
+ virtual bool annotatable () const { return true; }
+
private: // Data
bool pd_has_nested_valuetype_;
diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h
index a7e04a1a6d8..955f9e0c8e3 100644
--- a/TAO/TAO_IDL/include/ast_union_branch.h
+++ b/TAO/TAO_IDL/include/ast_union_branch.h
@@ -118,6 +118,8 @@ public:
static AST_Decl::NodeType const NT;
+ virtual bool auto_dump_annotations () const { return false; }
+
private:
// list of labels.
UTL_LabelList *pd_ll;
diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp
index 601dec5b420..8a0e6344575 100644
--- a/TAO/TAO_IDL/util/utl_idlist.cpp
+++ b/TAO/TAO_IDL/util/utl_idlist.cpp
@@ -214,19 +214,26 @@ UTL_IdList::dump (ACE_OSTREAM_TYPE &o)
first = second = false;
}
- i.item ()->dump (o);
-
- if (first)
+ if (i.item ()->get_string ())
{
- if (ACE_OS::strcmp (i.item ()->get_string (), "::") != 0)
- {
- first = false;
- }
- else
+ i.item ()->dump (o);
+
+ if (first)
{
- second = true;
+ if (ACE_OS::strcmp (i.item ()->get_string (), "::") != 0)
+ {
+ first = false;
+ }
+ else
+ {
+ second = true;
+ }
}
}
+ else
+ {
+ o << "(null string)";
+ }
}
}