-- is a byproduct of the parser. Such a null statement should be
-- excluded from the early call region because it carries the
-- source location of the "end" keyword, and may lead to confusing
- -- diagnistics.
+ -- diagnostics.
if Nkind (N) = N_Null_Statement
and then not Comes_From_Source (N)
and then Nkind (Context) = N_Handled_Sequence_Of_Statements
then
return False;
+
+ -- Similarly, internally-generated objects and types may have
+ -- out-of-order source locations that confuse diagnostics, e.g.
+ -- source locations in the body for objects/types generated in
+ -- the spec.
+
+ elsif Nkind (N) in N_Full_Type_Declaration | N_Object_Declaration
+ and then not Comes_From_Source (N)
+ then
+ return False;
end if;
-- Otherwise only constructs which correspond to pure Ada