[Ada] Minor reuse Is_Protected_Component
authorPiotr Trojanek <trojanek@adacore.com>
Sat, 14 Nov 2020 22:26:05 +0000 (23:26 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 Nov 2020 14:16:20 +0000 (09:16 -0500)
gcc/ada/

* lib-xref.adb (Generate_Reference): Fix reference to
Analyze_Assignment.
* sem_ch5.adb (Diagnose_Non_Variable_Lhs): Reuse existing
utility function.

gcc/ada/lib-xref.adb
gcc/ada/sem_ch5.adb

index 64b9683a784000e084890fc118aabf41d9d86d23..08699060aa3c5b7ecda895cd591133a26c9d9dfa 100644 (file)
@@ -819,7 +819,7 @@ package body Lib.Xref is
                end if;
 
             --  For the left hand of an assignment case, we do nothing here.
-            --  The processing for Analyze_Assignment_Statement will set the
+            --  The processing for Analyze_Assignment will set the
             --  Referenced_As_LHS flag.
 
             else
index 2afe18b122f1213b51964c4d33ebe5bf4c7861da..df412bd4714280db2e9b53132aa5a76e0900b777 100644 (file)
@@ -192,9 +192,7 @@ package body Sem_Ch5 is
                --  directly.
 
                elsif (Is_Prival (Ent) and then Within_Function)
-                   or else
-                     (Ekind (Ent) = E_Component
-                       and then Is_Protected_Type (Scope (Ent)))
+                   or else Is_Protected_Component (Ent)
                then
                   Error_Msg_N
                     ("protected function cannot modify protected object", N);