aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-03-23 21:00:54 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-26 09:29:18 +0200
commit34c71b0472f8d3d681adffc100b054be0cb14a15 (patch)
treece64671d8e382cd5814952d2e35c6a309a6d52c7 /gcc
parent4a555bfee36bf0ce7513c37e9d4fb1f23405a064 (diff)
downloadgcc-34c71b0472f8d3d681adffc100b054be0cb14a15.zip
gcc-34c71b0472f8d3d681adffc100b054be0cb14a15.tar.gz
gcc-34c71b0472f8d3d681adffc100b054be0cb14a15.tar.bz2
ada: Cleanup expansion of membership operators into attribute Valid
Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch4.adb (Is_OK_Object_Reference): Replace loop with a call to Unqual_Conv; consequently, change object from variable to constant; replace an IF statement with an AND THEN expression.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch4.adb26
1 files changed, 4 insertions, 22 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 48692c0..438cd45 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -6492,34 +6492,16 @@ package body Exp_Ch4 is
----------------------------
function Is_OK_Object_Reference (Nod : Node_Id) return Boolean is
- Obj_Ref : Node_Id;
+ Obj_Ref : constant Node_Id := Original_Node (Nod);
+ -- The original operand
begin
- -- Inspect the original operand
-
- Obj_Ref := Original_Node (Nod);
-
-- The object reference must be a source construct, otherwise the
-- codefix suggestion may refer to nonexistent code from a user
-- perspective.
- if Comes_From_Source (Obj_Ref) then
- loop
- if Nkind (Obj_Ref) in
- N_Type_Conversion |
- N_Unchecked_Type_Conversion |
- N_Qualified_Expression
- then
- Obj_Ref := Expression (Obj_Ref);
- else
- exit;
- end if;
- end loop;
-
- return Is_Object_Reference (Obj_Ref);
- end if;
-
- return False;
+ return Comes_From_Source (Obj_Ref)
+ and then Is_Object_Reference (Unqual_Conv (Obj_Ref));
end Is_OK_Object_Reference;
-- Start of processing for Substitute_Valid_Test