[gcc r11-5303] [Ada] Simplify Is_Loop_Pragma

Pierre-Marie de Rodat pmderodat@gcc.gnu.org
Tue Nov 24 10:18:54 GMT 2020


https://gcc.gnu.org/g:45ce2307851e8e7fc653137253c8782f734c5697

commit r11-5303-g45ce2307851e8e7fc653137253c8782f734c5697
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Oct 7 22:12:45 2020 +0200

    [Ada] Simplify Is_Loop_Pragma
    
    gcc/ada/
    
            * sem_prag.adb (Is_Loop_Pragma): Avoid repeated calls to
            Original_Node; remove unnecessary IF statement.

Diff:
---
 gcc/ada/sem_prag.adb | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

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;
 
          ---------------------


More information about the Gcc-cvs mailing list