For some time the Repinfo unit has been able to output the representation information in the JSON data interchange format in addition to the usual text and binary formats.
The new Repinfo.Input unit makes it possible to read back this information under this format and make it available to clients, the main one being ASIS.
The big advantage of using this approach over manipulating a binary blob is that the writer and the reader of the JSON representation need not be binary compatible, i.e. in practice need not be the same version of the compiler or ASIS for the same target.
The patch also adds a -gnatd_j switch to read back the information in the compiler itself, which makes it easy to keep the writer and the reader in sync using only one tool, namely the compiler. The typical usage is:
gcc -c p.ads -gnatR4js gcc -c p.ads -gnatd_j
to exercise respectively the writer and the reader from the compiler.
2019-07-11 Eric Botcazou
- alloc.ads (Rep_JSON_Table_Initial): New constant. (Rep_JSON_Table_Increment): Likewise.
- debug.adb: Document -gnatd_j switch.
- gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add repinfo-input.o.
- gnat1drv.adb: Add with clause for Repinfo.Input. Add with and use clauses for Sinput. (Read_JSON_Files_For_Repinfo): New procedure. (Gnat1drv1): Deal with -gnatd_j switch.
- repinfo-input.ad[sb]: New unit.
- snames.ads-tmpl (Name_Discriminant): New constant. (Name_Operands): Likewise.
5dc190e5b80 [Ada] New Repinfo.Input unit to read back JSON representation info.
gcc/ada/ChangeLog | 15 +
gcc/ada/alloc.ads | 3 +
gcc/ada/debug.adb | 6 +-
gcc/ada/gcc-interface/Make-lang.in | 1 +
gcc/ada/gnat1drv.adb | 47 +-
gcc/ada/repinfo-input.adb | 1350 ++++++++++++++++++++++++++++++++++++
gcc/ada/repinfo-input.ads | 78 +++
gcc/ada/snames.ads-tmpl | 5 +
8 files changed, 1503 insertions(+), 2 deletions(-)