+2019-07-05 Yannick Moy <moy@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Cannot inline in quantified
+ expressions.
+ * sem_util.adb, sem_util.ads (In_Quantified_Expression): New
+ function.
+
2019-07-05 Bob Duff <duff@adacore.com>
* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
Cannot_Inline
("cannot inline & (in default expression)?", N, Nam_UA);
+ -- Calls cannot be inlined inside quantified expressions, which
+ -- are left in expression form for GNATprove. Since these
+ -- expressions are only preanalyzed, we need to detect the failure
+ -- to inline outside of the case for Full_Analysis below.
+
+ elsif In_Quantified_Expression (N) then
+ Cannot_Inline
+ ("cannot inline & (in quantified expression)?", N, Nam_UA);
+
-- Inlining should not be performed during preanalysis
elsif Full_Analysis then
end if;
end In_Pre_Post_Condition;
+ ------------------------------
+ -- In_Quantified_Expression --
+ ------------------------------
+
+ function In_Quantified_Expression (N : Node_Id) return Boolean is
+ P : Node_Id;
+ begin
+ P := Parent (N);
+ loop
+ if No (P) then
+ return False;
+ elsif Nkind (P) = N_Quantified_Expression then
+ return True;
+ else
+ P := Parent (P);
+ end if;
+ end loop;
+ end In_Quantified_Expression;
+
-------------------------------------
-- In_Reverse_Storage_Order_Object --
-------------------------------------
-- Returns True if node N appears within a pre/postcondition pragma. Note
-- the pragma Check equivalents are NOT considered.
+ function In_Quantified_Expression (N : Node_Id) return Boolean;
+ -- Returns true if the expression N occurs within a quantified expression
+
function In_Reverse_Storage_Order_Object (N : Node_Id) return Boolean;
-- Returns True if N denotes a component or subcomponent in a record or
-- array that has Reverse_Storage_Order.