diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-12-09 07:18:23 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-12-09 07:22:35 -0800 |
commit | 0b37233152b55fb256d7537d7e76067edc52cb88 (patch) | |
tree | 06c922f186b65e8ac0eed9733da3651498d23bd4 /gcc/cp/module.cc | |
parent | fe70679b80f5e6193a0976be41b68d590c7cb2f3 (diff) | |
download | gcc-0b37233152b55fb256d7537d7e76067edc52cb88.zip gcc-0b37233152b55fb256d7537d7e76067edc52cb88.tar.gz gcc-0b37233152b55fb256d7537d7e76067edc52cb88.tar.bz2 |
c++: Module parsing
This adds the module-declaration parsing and other logic. We have two
new kinds of declaration -- module and import. Plus the ability to
export other declarations. The module processing can also divide the
TU into several portions -- GMF, Purview and PMF.
There are restrictions that some declarations must or mustnot appear
in a #include, so I needed to add a bit to indicate whether a token
came from the main source or not. This seemed the least unpleasant
way of implementing such a check.
gcc/cp/
* parser.h (struct cp_token): Add main_source_p field.
* parser.c (cp_lexer_new_main): Pass thought module token filter.
Check macros.
(cp_lexer_get_preprocessor_token): Set main_source_p.
(enum module_parse): New.
(cp_parser_diagnose_invalid_type_name): Deal with unrecognized
module-directives.
(cp_parser_skip_to_closing_parenthesize_1): Skip module-directivres.
(cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_skiup_to_end_of_block_or_statement): Likewise.
(cp_parser_translation_unit): Add module parsing calls.
(cp_parser_module_name, cp_parser_module_declaration): New.
(cp_parser_import_declaration, cp_parser_module_export): New.
(cp_parser_declaration): Add module export detection.
(cp_parser_template_declaration): Adjust 'export' error message.
(cp_parser_function_definition_after_declarator): Add
module-specific logic.
* module.cc (import_module, declare_module)
(maybe_check_all_macros): Stubs.
Diffstat (limited to 'gcc/cp/module.cc')
-rw-r--r-- | gcc/cp/module.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index a961e3b..3587dfc 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -123,6 +123,16 @@ set_originating_module (tree, bool) { } +void +import_module (module_state *, location_t, bool, tree, cpp_reader *) +{ +} + +void +declare_module (module_state *, location_t, bool, tree, cpp_reader *) +{ +} + module_state * preprocess_module (module_state *, unsigned, bool, bool, bool, cpp_reader *) { @@ -144,6 +154,11 @@ init_modules (cpp_reader *) } void +maybe_check_all_macros (cpp_reader *) +{ +} + +void fini_modules () { } |