aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_attr.adb
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2008-07-31 14:46:23 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-07-31 14:46:23 +0200
commite84e11ba0a57e5a319504d4f0197aad385f85e80 (patch)
treeb4e0ed9b5b4d45488eacbfd965b03a06d5e5e2ed /gcc/ada/exp_attr.adb
parent67d7b0ab5ffd3d67e804732cdb74299300db18b6 (diff)
downloadgcc-e84e11ba0a57e5a319504d4f0197aad385f85e80.zip
gcc-e84e11ba0a57e5a319504d4f0197aad385f85e80.tar.gz
gcc-e84e11ba0a57e5a319504d4f0197aad385f85e80.tar.bz2
checks.ads (Apply_Accessibility_Check): Add parameter Insert_Node.
2008-07-31 Gary Dismukes <dismukes@adacore.com> * checks.ads (Apply_Accessibility_Check): Add parameter Insert_Node. * checks.adb (Apply_Accessibility_Check): Insert the check on Insert_Node. * exp_attr.adb: (Expand_N_Attribute_Refernce, Attribute_Access): Pass attribute node to new parameter Insert_Node on call to Apply_Accessibility_Check. Necessary to distinguish the insertion node because the dereferenced formal may come from a rename, but the check must be inserted in front of the attribute. * exp_ch4.adb: (Expand_N_Allocator): Pass actual for new Insert_Node parameter on call to Apply_Accessibility_Check. (Expand_N_Type_Conversion): Pass actual for new Insert_Node parameter on call to Apply_Accessibility_Check. Minor reformatting From-SVN: r138399
Diffstat (limited to 'gcc/ada/exp_attr.adb')
-rw-r--r--gcc/ada/exp_attr.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 6ad5568..84bc808 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -840,7 +840,10 @@ package body Exp_Attr is
-- attribute was the dereference, and didn't handle cases where
-- the attribute is applied to a subcomponent of the dereference,
-- since there's generally no available, appropriate access type
- -- to convert to in that case.
+ -- to convert to in that case. The attribute is passed as the
+ -- point to insert the check, because the access parameter may
+ -- come from a renaming, possibly in a different scope, and the
+ -- check must be associated with the attribute itself.
elsif Id = Attribute_Access
and then Nkind (Enc_Object) = N_Explicit_Dereference
@@ -852,7 +855,7 @@ package body Exp_Attr is
and then Present (Extra_Accessibility
(Entity (Prefix (Enc_Object))))
then
- Apply_Accessibility_Check (Prefix (Enc_Object), Typ);
+ Apply_Accessibility_Check (Prefix (Enc_Object), Typ, N);
-- Ada 2005 (AI-251): If the designated type is an interface we
-- add an implicit conversion to force the displacement of the