+2015-10-27 Yannick Moy <moy@adacore.com>
+
+ * lib-xref-spark_specific.adb
+ (Enclosing_Subprogram_Or_Library_Package): detect library-level
+ subprograms and handle entries as subprograms, i.e. now both
+ library-level subprograms and entry bodies act as enclosing
+ scopes.
+ (Traverse_Declarations_Or_Statements): process entry bodies just
+ like subprogram bodies.
+ * lib-xref.ads (Enclosing_Subprogram_Or_Library_Package): comment
+ simplified while keeping its the meaning and minor typo fixed
+ ("of" -> "or").
+ * spark_xrefs.ads (Xref Section): fix in description of the ALI
+ line for subprogram calls; such lines start with captial "F"
+ followed by a space.
+
+2015-10-27 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Find_Direct_Name): A parameter association is
+ a legal context for applying an implicit dereference.
+ (Analyze_Expanded_Name): Minor code cleanup.
+
2015-10-27 Arnaud Charlet <charlet@adacore.com>
* sinput.ads, spark_xrefs.ads, lib-xref.adb: Fix typos.
and then Nkind (Parent (N)) in N_Subprogram_Specification
then
Result := Parent (Parent (Parent (N)));
+
+ -- If this was a library-level subprogram then replace Result with
+ -- its Unit, which points to N_Subprogram_* node.
+ if Nkind (Result) = N_Compilation_Unit then
+ Result := Unit (Result);
+ end if;
else
Result := N;
end if;
Result := Parent (Result);
end if;
+ when N_Entry_Body =>
+ Result := Defining_Identifier (Result);
+ exit;
+
when others =>
Result := Parent (Result);
end case;
if Nkind (N) in N_Declaration
or else
Nkind (N) in N_Later_Decl_Item
+ or else
+ Nkind (N) = N_Entry_Body
then
Process (N);
end if;
function Enclosing_Subprogram_Or_Library_Package
(N : Node_Id) return Entity_Id;
- -- Return the closest enclosing subprogram of package. Only return a
- -- library level package. If the package is enclosed in a subprogram,
- -- return the subprogram. This ensures that GNATprove can distinguish
- -- local variables from global variables.
+ -- Return the closest enclosing subprogram or library-level package.
+ -- This ensures that GNATprove can distinguish local variables from
+ -- global variables.
procedure Generate_Dereference
(N : Node_Id;
begin
-- If the entity pointer is already set, this is an internal node, or a
-- node that is analyzed more than once, after a tree modification. In
- -- such a case there is no resolution to perform, just set the type. For
- -- completeness, analyze prefix as well.
+ -- such a case there is no resolution to perform, just set the type.
+ -- In either case, start by analyzing the prefix.
+
+ Analyze (Prefix (N));
if Present (Entity (N)) then
if Is_Type (Entity (N)) then
Set_Etype (N, Etype (Entity (N)));
end if;
- Analyze (Prefix (N));
return;
else
Find_Expanded_Name (N);
Set_Entity_Or_Discriminal (N, E);
-- The name may designate a generalized reference, in which case
- -- the dereference interpretation will be included.
+ -- the dereference interpretation will be included. Context is
+ -- one in which a name is legal.
if Ada_Version >= Ada_2012
and then
(Nkind (Parent (N)) in N_Subexpr
or else Nkind_In (Parent (N), N_Object_Declaration,
+ N_Parameter_Association,
N_Assignment_Statement))
then
Check_Implicit_Dereference (N, Etype (E));
-- entity-number and identity identify a scope entity in FS lines for
-- the file previously identified.
- -- line typ col entity ref*
+ -- F line typ col entity ref*
-- line is the line number of the referenced entity