diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2018-05-03 14:43:54 +0200 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-05-07 19:19:10 +0200 |
commit | ea3a41bcf894511695bf6118390577f4fe609742 (patch) | |
tree | 8c8044931f9af7ea894b9b16878766038764f71a /powerpc/SelectLong.vp | |
parent | 2e2d3430436ba1102504ccf175e8bd12c326fc85 (diff) | |
download | compcert-ea3a41bcf894511695bf6118390577f4fe609742.tar.gz compcert-ea3a41bcf894511695bf6118390577f4fe609742.zip |
Revised elaboration of function definitions, part 2
Change elab_type_declarator and elab_fundef_name so that the latter
returns two environments: the first one takes into account
struct/union definitions from the function return type,
while the second one also contains bindings for function
parameters and struct/union definitions from the function parameter list.
To this end the "kr_ok" bool argument of elab_type_declarator is
repurposed and renamed "fundef". It controls not just whether
K&R function declarators are supported, but also which bindings
the returned environment contains.
Change elab_fundef to adapt to the changes in elab_fundef_name
and to maintain two environments:
- the global environment, enriched with struct/union definitions from
the function return type, and with the function binding itself;
- the local environment, used for elaborating the body of the
function, which also contains bindings for function parameters
and struct/union definitions from the function parameter list.
Change elab_funbody so that it does not open a new scope for elaborating
the body, even though the body is represented as a block in the AST.
The standard says that the function body is processed in the same
scope where function parameters are declared, so that the following
is illegal:
int f(int x) { double x; ... }
Introduce a variant enter_or_refine_function of enter_or_refine_ident
where the fresh identifier to use (if no earlier declaration is found)
is created in advance in an earlier scope. This helps implement the
proper scoping of function names.
Diffstat (limited to 'powerpc/SelectLong.vp')
0 files changed, 0 insertions, 0 deletions