summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-09-07 16:02:42 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-11-07 09:36:29 +0100
commitffe889d7ffcc7e8150413d4de38e066940fb7881 (patch)
tree7e220ae3e6741624482426e6ec54053c040ed631
parent74056e9411e0457c33ff5546a3563edb9ed09c99 (diff)
downloadgcc-ffe889d7ffcc7e8150413d4de38e066940fb7881.tar.gz
ada: Simplify detection of pragmas in the context items
Code cleanup; semantics is unaffected. gcc/ada/ * sem_prag.adb (Is_In_Context_Clause): Rewrite without negations and inequalities.
-rw-r--r--gcc/ada/sem_prag.adb16
1 files changed, 5 insertions, 11 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 471ef870fa7..f33d858062d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -7315,22 +7315,16 @@ package body Sem_Prag is
Parent_Node : Node_Id;
begin
- if not Is_List_Member (N) then
- return False;
-
- else
+ if Is_List_Member (N) then
Plist := List_Containing (N);
Parent_Node := Parent (Plist);
- if Parent_Node = Empty
- or else Nkind (Parent_Node) /= N_Compilation_Unit
- or else Context_Items (Parent_Node) /= Plist
- then
- return False;
- end if;
+ return Present (Parent_Node)
+ and then Nkind (Parent_Node) = N_Compilation_Unit
+ and then Context_Items (Parent_Node) = Plist;
end if;
- return True;
+ return False;
end Is_In_Context_Clause;
---------------------------------