aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-08-24 23:58:40 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-10-04 08:45:06 +0000
commit263e2936305cb3b995db8f86ce8c60579caeeda3 (patch)
tree0d7e9642b615a825d2adfcc4c5cd0cbfa766e500
parent6c30bccd6897e84465fff147f12133c282c02eae (diff)
downloadgcc-263e2936305cb3b995db8f86ce8c60579caeeda3.zip
gcc-263e2936305cb3b995db8f86ce8c60579caeeda3.tar.gz
gcc-263e2936305cb3b995db8f86ce8c60579caeeda3.tar.bz2
[Ada] Fix handling of 'Image acting as a prefix of a slice in CodePeer
gcc/ada/ * sem_res.adb (Resolve_Slice): Add custom handling of attribute Image and similar in CodePeer mode. This complements the existing custom handling of these attributes in Expand_N_Attribute_Reference.
-rw-r--r--gcc/ada/sem_res.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 0d013ba..c493d5d 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -11275,10 +11275,20 @@ package body Sem_Res is
end;
end if;
+ -- In CodePeer mode the attribute Image is not expanded, so when it
+ -- acts as a prefix of a slice, we handle it like a call to function
+ -- returning an unconstrained string. Same for the Wide variants of
+ -- attribute Image.
+
elsif Is_Entity_Name (Name)
or else Nkind (Name) = N_Explicit_Dereference
or else (Nkind (Name) = N_Function_Call
and then not Is_Constrained (Etype (Name)))
+ or else (CodePeer_Mode
+ and then Nkind (Name) = N_Attribute_Reference
+ and then Attribute_Name (Name) in Name_Image
+ | Name_Wide_Image
+ | Name_Wide_Wide_Image)
then
Array_Type := Get_Actual_Subtype (Name);