From: Piotr Trojanek Date: Wed, 7 Oct 2020 20:12:45 +0000 (+0200) Subject: [Ada] Simplify Is_Loop_Pragma X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=45ce2307851e8e7fc653137253c8782f734c5697;p=gcc.git [Ada] Simplify Is_Loop_Pragma gcc/ada/ * sem_prag.adb (Is_Loop_Pragma): Avoid repeated calls to Original_Node; remove unnecessary IF statement. --- diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b5212017146..590da5574e9 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -6194,17 +6194,15 @@ package body Sem_Prag is -------------------- function Is_Loop_Pragma (Stmt : Node_Id) return Boolean is + Original_Stmt : constant Node_Id := Original_Node (Stmt); + begin -- Inspect the original node as Loop_Invariant and Loop_Variant -- pragmas are rewritten to null when assertions are disabled. - if Nkind (Original_Node (Stmt)) = N_Pragma then - return - Pragma_Name_Unmapped (Original_Node (Stmt)) + return Nkind (Original_Stmt) = N_Pragma + and then Pragma_Name_Unmapped (Original_Stmt) in Name_Loop_Invariant | Name_Loop_Variant; - else - return False; - end if; end Is_Loop_Pragma; ---------------------