aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-10-01 09:39:28 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-10-01 09:39:28 +0000
commit6cc430c19a9c94835d31f171065f32f5b1863183 (patch)
treefc1e0dbddc786697cedbe4808602a6f79b19738e
parente04108c7274d5066fcc791ec254f843a3ff694aa (diff)
downloadgcc-6cc430c19a9c94835d31f171065f32f5b1863183.zip
gcc-6cc430c19a9c94835d31f171065f32f5b1863183.tar.gz
gcc-6cc430c19a9c94835d31f171065f32f5b1863183.tar.bz2
c-ada-spec.c (get_underlying_decl): Get to the main type variant.
* c-ada-spec.c (get_underlying_decl): Get to the main type variant. (dump_ada_node): Add const keyword. From-SVN: r264738
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-ada-spec.c19
2 files changed, 17 insertions, 7 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 3b3b987..015ca8a 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-ada-spec.c (get_underlying_decl): Get to the main type variant.
+ (dump_ada_node): Add const keyword.
+
2018-09-25 Martin Liska <mliska@suse.cz>
* c-common.c (c_common_truthvalue_conversion):
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index eae741e..2e1b91e 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -1020,13 +1020,18 @@ get_underlying_decl (tree type)
if (DECL_P (type))
return type;
- /* type is a typedef. */
- if (TYPE_P (type) && TYPE_NAME (type) && DECL_P (TYPE_NAME (type)))
- return TYPE_NAME (type);
+ if (TYPE_P (type))
+ {
+ type = TYPE_MAIN_VARIANT (type);
+
+ /* type is a typedef. */
+ if (TYPE_NAME (type) && DECL_P (TYPE_NAME (type)))
+ return TYPE_NAME (type);
- /* TYPE_STUB_DECL has been set for type. */
- if (TYPE_P (type) && TYPE_STUB_DECL (type))
- return TYPE_STUB_DECL (type);
+ /* TYPE_STUB_DECL has been set for type. */
+ if (TYPE_STUB_DECL (type))
+ return TYPE_STUB_DECL (type);
+ }
return NULL_TREE;
}
@@ -2143,8 +2148,8 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
}
else
{
+ const unsigned int quals = TYPE_QUALS (TREE_TYPE (node));
bool is_access = false;
- unsigned int quals = TYPE_QUALS (TREE_TYPE (node));
if (VOID_TYPE_P (TREE_TYPE (node)))
{