[flang] Implement writing of .mod files.
authorTim Keith <tkeith@nvidia.com>
Mon, 16 Jul 2018 23:23:18 +0000 (16:23 -0700)
committerTim Keith <tkeith@nvidia.com>
Mon, 16 Jul 2018 23:23:18 +0000 (16:23 -0700)
commit0c575ed5484b28c716ba50b39276b38eb095aff6
treeb585bbd6dd25d69c7daf5a68493093f761d5343d
parent9f13edf8bade489e360c40fbd6db7fa3733e5b01
[flang] Implement writing of .mod files.

Module file writing is implemented in mod-file.cc. They need to be
written after all semantic checking. Until then, for testing, write
them out whenever names are resolved.

There is a header comment in the .mod files but it is mostly a
placeholder until we can read them in and do something with it.

Rename `Symbol::details<D>` to `Symbol::get<D>`. This asserts that the
details of the symbol match D and returns that type. But we need a way
to access the details as a variant as well (not just one of its types).
`details()` is the best name for that, especially as we already have
`set_details()`. Renaming the old `details` to `get` also better matches
`has` which is used to check which variant is present.

Original-commit: flang-compiler/f18@8d14be1a1633ab2e8ee700a3709989769fbc1f14
Reviewed-on: https://github.com/flang-compiler/f18/pull/126
Tree-same-pre-rewrite: false
flang/lib/semantics/CMakeLists.txt
flang/lib/semantics/attr.cc
flang/lib/semantics/attr.h
flang/lib/semantics/mod-file.cc [new file with mode: 0644]
flang/lib/semantics/mod-file.h [new file with mode: 0644]
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/symbol.h
flang/test/semantics/symbol01.f90
flang/tools/f18/f18.cc