summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-ada-spec.c17
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/dump-ada-spec-3.C27
4 files changed, 49 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7b638665c54..e1d4eff7bdc 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-ada-spec.c (is_tagged_type): Add guard for DECL_VINDEX.
+ (dump_template_types): Adjust DECL_TEMPLATE_INSTANTIATIONS and
+ DECL_TEMPLATE_RESULT emulations.
+ (dump_ada_template)): Add guard for TYPE_METHODS.
+
2015-02-27 Marek Polacek <polacek@redhat.com>
PR c/65040
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 945fa7cdb34..fcfefb03f79 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -961,7 +961,7 @@ is_tagged_type (const_tree type)
return false;
for (tmp = TYPE_METHODS (type); tmp; tmp = TREE_CHAIN (tmp))
- if (DECL_VINDEX (tmp))
+ if (TREE_CODE (tmp) == FUNCTION_DECL && DECL_VINDEX (tmp))
return true;
return false;
@@ -1730,10 +1730,15 @@ dump_template_types (pretty_printer *buffer, tree types, int spc)
static int
dump_ada_template (pretty_printer *buffer, tree t, int spc)
{
- /* DECL_VINDEX is DECL_TEMPLATE_INSTANTIATIONS in this context. */
- tree inst = DECL_VINDEX (t);
- /* DECL_RESULT_FLD is DECL_TEMPLATE_RESULT in this context. */
- tree result = DECL_RESULT_FLD (t);
+ /* DECL_SIZE_UNIT is DECL_TEMPLATE_INSTANTIATIONS in this context. */
+ tree inst = DECL_SIZE_UNIT (t);
+ /* This emulates DECL_TEMPLATE_RESULT in this context. */
+ struct tree_template_decl {
+ struct tree_decl_common common;
+ tree arguments;
+ tree result;
+ };
+ tree result = ((struct tree_template_decl *) t)->result;
int num_inst = 0;
/* Don't look at template declarations declaring something coming from
@@ -1750,7 +1755,7 @@ dump_ada_template (pretty_printer *buffer, tree t, int spc)
if (TREE_VEC_LENGTH (types) == 0)
break;
- if (!TYPE_P (instance) || !TYPE_METHODS (instance))
+ if (!RECORD_OR_UNION_TYPE_P (instance) || !TYPE_METHODS (instance))
break;
num_inst++;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0ec2c0cb9b8..33d69b01adf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/other/dump-ada-spec-3.C: New test.
+
2015-03-01 Martin Liska <mliska@suse.cz>
* gcc.target/i386/stackalign/longlong-2.c: Omit ICF.
diff --git a/gcc/testsuite/g++.dg/other/dump-ada-spec-3.C b/gcc/testsuite/g++.dg/other/dump-ada-spec-3.C
new file mode 100644
index 00000000000..3d5e3f10dfc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/dump-ada-spec-3.C
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+#include <iostream>
+
+using namespace std;
+
+class Base {
+ public:
+ int My_V;
+ virtual void Primitive ();
+
+ Base ();
+};
+
+void Base::Primitive () {
+ cout << "C++ Primitive " << this->My_V << "\n";
+}
+
+Base::Base () {
+}
+
+void Dispatch (Base * B) {
+ B->Primitive ();
+}
+
+/* { dg-final { cleanup-ada-spec } } */