Commit graph

412 commits

Author SHA1 Message Date
peter klausler
c8415cec4d [flang] Update README with g++ 8.1.
Original-commit: flang-compiler/f18@a047f116da
Reviewed-on: https://github.com/flang-compiler/f18/pull/84
Tree-same-pre-rewrite: false
2018-05-08 11:01:47 -07:00
peter klausler
eef68291aa [flang] Build with g++ 8.1.0 compiler and headers.
Original-commit: flang-compiler/f18@53d80fc854
Reviewed-on: https://github.com/flang-compiler/f18/pull/84
Tree-same-pre-rewrite: false
2018-05-08 10:32:58 -07:00
peter klausler
1e036b2111 [flang] Copyediting of README.md.
Original-commit: flang-compiler/f18@32ffc711b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/84
Tree-same-pre-rewrite: false
2018-05-07 14:39:36 -07:00
peter klausler
e2d10c079b [flang] Make sure that fixed form compiler directive line is not a continuation.
Original-commit: flang-compiler/f18@32994064f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
2018-05-07 13:26:40 -07:00
peter klausler
f76d2073de [flang] Fix bug noticed in code review.
Original-commit: flang-compiler/f18@7fc497064e
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-07 13:11:08 -07:00
peter klausler
fea41dc1e0 [flang] Improve error messages on bad escaped characters.
Original-commit: flang-compiler/f18@fb64849d6a
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-07 12:57:08 -07:00
peter klausler
4a56ad333f [flang] fix bug that could lose nonstandard usage warning messages
Original-commit: flang-compiler/f18@ff48aa95fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-07 12:37:10 -07:00
peter klausler
a6da97cb6f [flang] Use attachments to messages in resolve-names.cc
Original-commit: flang-compiler/f18@d24674f4ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 15:40:40 -07:00
peter klausler
bb7d39497d [flang] Use attachment for context.
Original-commit: flang-compiler/f18@e92cf73cf9
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 15:03:10 -07:00
peter klausler
04b8f48d86 [flang] Allow attachments to Messages.
Original-commit: flang-compiler/f18@08785977ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 14:39:29 -07:00
peter klausler
8f27198cd3 [flang] More clean-up.
Original-commit: flang-compiler/f18@ed60db3708
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 13:59:56 -07:00
peter klausler
b00fa16ce4 [flang] Some initial clean-up in messages, use std::variant to make component possibilities clearer.
Original-commit: flang-compiler/f18@9b7eeb2354
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 13:00:35 -07:00
peter klausler
67fc4f647f [flang] incorporate review comment
Original-commit: flang-compiler/f18@15bb84470d
Reviewed-on: https://github.com/flang-compiler/f18/pull/80
2018-05-04 10:32:54 -07:00
peter klausler
2a68453d7b [flang] reformat
Original-commit: flang-compiler/f18@d809458bb3
Reviewed-on: https://github.com/flang-compiler/f18/pull/80
Tree-same-pre-rewrite: false
2018-05-04 10:30:37 -07:00
peter klausler
e8490cdc60 [flang] Clean up dump-parse-tree.h
Original-commit: flang-compiler/f18@5024116397
Reviewed-on: https://github.com/flang-compiler/f18/pull/80
Tree-same-pre-rewrite: false
2018-05-04 10:30:34 -07:00
peter klausler
3689fe7015 [flang] fix building with clang after merge
Original-commit: flang-compiler/f18@7b53bf2a16
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
2018-05-04 10:19:50 -07:00
peter klausler
ca8d718f64 [flang] Do not sort messages by location for now.
Original-commit: flang-compiler/f18@8a92dad973
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:41:33 -07:00
peter klausler
da846e6bd9 [flang] reformat for merge
Original-commit: flang-compiler/f18@ccf265dad5
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:12 -07:00
peter klausler
35aef1025e [flang] Improve error message location.
Original-commit: flang-compiler/f18@5efd011d18
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:11 -07:00
peter klausler
1de02ee11c [flang] Add TODO comment.
Original-commit: flang-compiler/f18@1a82940ca8
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:11 -07:00
peter klausler
f9941a20b7 [flang] Fix preprocessor tokenization of .NE. style operators.
Original-commit: flang-compiler/f18@ab547b89e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:10 -07:00
peter klausler
bdd68813ca [flang] Allow conditional compilation directives to affect continuation lines (again).
Original-commit: flang-compiler/f18@9b9fd356dd
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:09 -07:00
peter klausler
45b6e41494 [flang] Ignore spaces in FORMAT specifications, even in free form.
Original-commit: flang-compiler/f18@3f65d35b1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:09 -07:00
peter klausler
82294af9c9 [flang] Fix two cosubscript parsing problems with lookahead.
Original-commit: flang-compiler/f18@b490c60fb0
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:08 -07:00
peter klausler
95c44cb55d [flang] Fix comment recognition in print *, "..."!comment
Original-commit: flang-compiler/f18@d647b8ed2f
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:07 -07:00
peter klausler
5e69a7507d [flang] Make messages more like clang's.
Original-commit: flang-compiler/f18@176cdf8e6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:06 -07:00
peter klausler
b867921eb8 [flang] Clean up message output a little; remove unused APIs.
Original-commit: flang-compiler/f18@64298b8d74
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:05 -07:00
peter klausler
795df00209 [flang] Don't process preprocessor directives amid continuation lines any more.
Original-commit: flang-compiler/f18@4a3dbb5d3e
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:04 -07:00
peter klausler
d9ff8df5db [flang] Allow $ and @ in defined operator names.
Original-commit: flang-compiler/f18@3cf7533a3b
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:03 -07:00
Tim Keith
9727b06813 [flang] Support for USE statements.
When a USE statement is encountered, find the scope corresponding to the
module. This is now stored in the ModuleDetails of the module symbol.
useModuleScope_ tracks this while processing the USE. Currently only
modules defined in the same file work because we don't have module files.

At the end of a USE that isn't a use-only, add all public names that
were not renamed.

AddUse() handles recording of a USE by creating a local symbol with
UseDetails that tracks the use-symbol in the module and the location of
the USE (for error messages). If an ambiguous USE is detected, the
UseDetails are replaced by UseErrorDetails. This tracks the locations of
all the uses so that they can be referenced in a diagnostic.

Detect attempts to re-declare use-associated symbols as well as changing
their attributes (except for ASYNCHRONOUS and VOLATILE).

Add missing checks for access-stmt in scoping units other than modules.

Add tests for the new errors.

Reorganize the MessageHandler::Say() overloadings to prevent them from
becoming too numerous.

Original-commit: flang-compiler/f18@cc0523134c
Reviewed-on: https://github.com/flang-compiler/f18/pull/79
2018-05-03 15:57:56 -07:00
Tim Keith
be1a9990a8 [flang] resolve-names.cc reorganization and cleanup.
Add ScopeHandle class to manage the stack of scopes and MakeSymbol(), which
makes a symbol in the current scope. Move the call to ApplyImplicitScopes()
into PopScope() as it must be done for each scope.

Add ModuleVisitor class to manage module-related resolution. Currently that
consists of beginning and ending modules and access statements. This is
preparation for further module work.

Replace references to parser::CharBlock with SourceName.

Original-commit: flang-compiler/f18@913df85e48
Reviewed-on: https://github.com/flang-compiler/f18/pull/79
Tree-same-pre-rewrite: false
2018-05-02 15:32:32 -07:00
Stephane Chauveau
4c36c0f950 [flang] misc changes in response to pul-request comments
Original-commit: flang-compiler/f18@1b3332d2ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
2018-05-04 11:18:34 +02:00
Stephane Chauveau
300cff4fa6 [flang] fix typo in comment
Original-commit: flang-compiler/f18@477e852903
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
Tree-same-pre-rewrite: false
2018-05-03 17:30:02 +02:00
Stephane Chauveau
5390d8a90b [flang] Add missing underscore to private members
Original-commit: flang-compiler/f18@7247cf4c3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
Tree-same-pre-rewrite: false
2018-05-03 16:32:43 +02:00
Stephane Chauveau
dc704bfe6f [flang] Fix duplicate copyright message
Original-commit: flang-compiler/f18@65e3e86440
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
Tree-same-pre-rewrite: false
2018-05-03 16:26:17 +02:00
Stephane Chauveau
63141a0739 [flang] Manual backport of sch_llvm branch
Original-commit: flang-compiler/f18@17ee2d8e3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
Tree-same-pre-rewrite: false
2018-05-03 14:54:53 +02:00
Tim Keith
b8ec1fd041 [flang] Run clang-format on all .h and .cc files.
Original-commit: flang-compiler/f18@b7f02808a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/77
2018-05-02 14:06:02 -07:00
Tim Keith
7f66c0ae72 [flang] Normalize namespace definitions.
Replace `namespace Fortran { namespace parser { ... } }` with
`namespace Fortran::parser { ... }` and similarly for semantics.

Original-commit: flang-compiler/f18@838c9539b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/77
Tree-same-pre-rewrite: false
2018-05-02 13:52:36 -07:00
Steve Scalpone
ead68854e1 [flang] Update CMakefiles and #include paths.
Original-commit: flang-compiler/f18@1b7b8259b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/76
2018-05-02 09:21:03 -07:00
Steve Scalpone
209afdcea2 [flang] Removed unused files and declarations.
Renamed ParseTreeDump to dump-parse-tree.

Original-commit: flang-compiler/f18@9de97328f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/76
Tree-same-pre-rewrite: false
2018-05-02 09:15:33 -07:00
Tim Keith
4008e3e5d7 [flang] Make include guards consistent.
The include guard symbol is `FORTRAN_$dir_$file_H_` where $dir is the
subdirectory of `lib` and $file is the basename of the header file.
Those names are mapped to uppercase and hyphens are replaced by
underscores.

Original-commit: flang-compiler/f18@ac9c0e7106
Reviewed-on: https://github.com/flang-compiler/f18/pull/75
2018-05-01 14:07:52 -07:00
Tim Keith
ad129874a9 [flang] Remove unused files.
Original-commit: flang-compiler/f18@856315fd43
Reviewed-on: https://github.com/flang-compiler/f18/pull/75
Tree-same-pre-rewrite: false
2018-05-01 13:29:10 -07:00
Tim Keith
18cee3e8e6 [flang] Add copyright notices.
For source files (C++, Fortran, CMake) add copyright and license.
For documentation files add just copyright.

Original-commit: flang-compiler/f18@38381aed83
Reviewed-on: https://github.com/flang-compiler/f18/pull/74
2018-05-01 12:50:34 -07:00
peter klausler
681b59f282 [flang] Clean out the PGI stuff from CMakeLists.txt.
Original-commit: flang-compiler/f18@806db179ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
2018-04-27 15:03:28 -07:00
peter klausler
20fe058749 [flang] Fix a static_assert and a message location bug in first().
Original-commit: flang-compiler/f18@cd85bff31b
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-27 13:37:51 -07:00
peter klausler
3ed22efb75 [flang] silence a warning
Original-commit: flang-compiler/f18@dc91727ac4
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-27 12:43:16 -07:00
peter klausler
9702fcaf97 [flang] More Clang work.
Original-commit: flang-compiler/f18@7ff98ad778
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-27 12:37:47 -07:00
peter klausler
3fd2c17cf2 [flang] Use libc++ with clang.
Original-commit: flang-compiler/f18@d81b8d87f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 17:03:54 -07:00
peter klausler
b9ee2fc6ae [flang] Use first() to define operator|| when compiling with clang.
Original-commit: flang-compiler/f18@7bf98d683c
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 16:52:11 -07:00
peter klausler
c3e406eb27 [flang] Remove excess space at end of line.
Original-commit: flang-compiler/f18@900dc4e254
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 16:27:07 -07:00
peter klausler
dd57a6e695 [flang] Refine CMakeLists.txt tweaks.
Original-commit: flang-compiler/f18@b40c68f9ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 16:16:01 -07:00
peter klausler
ba4ee64c9d [flang] Package clang build settings.
Original-commit: flang-compiler/f18@775b42598d
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 16:03:01 -07:00
peter klausler
022a91b637 [flang] Patches to permit building with Clang without notes or warnings.
Original-commit: flang-compiler/f18@0e74b10603
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 15:44:29 -07:00
peter klausler
8fa4baa5e8 [flang] Use first() more.
Original-commit: flang-compiler/f18@a2f2fdf869
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:15 -07:00
peter klausler
6a0acd8505 [flang] Implement first(...) as attempt at a faster set of alternatives.
Original-commit: flang-compiler/f18@9f6a26cee6
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:15 -07:00
peter klausler
9e94216abe [flang] Attempt to build f18 with clang.
Original-commit: flang-compiler/f18@0480837234
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:15 -07:00
peter klausler
016fa9cf17 [flang] Attempt to build f18 with clang.
Original-commit: flang-compiler/f18@86fec97e41
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:14 -07:00
peter klausler
66c98ee4ca [flang] Resolve an old TODO by flattening a std::optional<std::optional<>>.
Original-commit: flang-compiler/f18@05f47831fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:14 -07:00
peter klausler
69e3842d60 [flang] Resolve old TODO about needless Indirection<>.
Original-commit: flang-compiler/f18@5f289209c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:12 -07:00
Tim Keith
5b7fb2aa3a [flang] Improve comment.
Original-commit: flang-compiler/f18@270514a30b
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
2018-04-25 11:49:29 -07:00
Tim Keith
dd0f1ff81d [flang] Remove unnecessary defaults in switches.
Original-commit: flang-compiler/f18@f4835e3831
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
Tree-same-pre-rewrite: false
2018-04-25 11:44:12 -07:00
Tim Keith
cb37c3625a [flang] Non-fatal error for repeated access spec
When an access statement repeats the same attribute, make it a non-fatal
diagnostic. Also, include the previous specification in the message.

resolve11.f90 now illustrates both cases, fatal and non-fatal.

Original-commit: flang-compiler/f18@1f567c740a
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
Tree-same-pre-rewrite: false
2018-04-25 10:46:39 -07:00
Tim Keith
94fa0fd890 [flang] Initial support for name resolution in modules.
Recognize modules and open and close the corresponding scope.
Handle PUBLIC and PRIVATE statements and set the corresponding
attributes on entity declarations in the module.

Refactoring (no functional changes): Make CheckImplicitSymbol() and
GetVariableName() overloadings private and out-of-line.

Add missing option to f18 help.

Original-commit: flang-compiler/f18@d01cacca63
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
Tree-same-pre-rewrite: false
2018-04-24 17:07:15 -07:00
peter klausler
e1ac262cc0 [flang] Remove dead code, reformat.
Original-commit: flang-compiler/f18@c87fdd8cd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
2018-04-24 16:27:01 -07:00
peter klausler
2a61c691e8 [flang] Reformat.
Original-commit: flang-compiler/f18@047de95439
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 15:26:50 -07:00
peter klausler
29a6c1a83c [flang] Allow construct<T>("TOKEN"_tok)" with unvalued parser argument.
Original-commit: flang-compiler/f18@19d2a4a849
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 15:02:41 -07:00
peter klausler
817163f9f5 [flang] Add constructIf<>(); complete pass over grammar.
Original-commit: flang-compiler/f18@4d5b4055bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 12:41:34 -07:00
peter klausler
fb1397ba57 [flang] Adjust productions in grammar.h so that construct<> invocations span what they cover (more to come)
Original-commit: flang-compiler/f18@ba5c2368d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
Tree-same-pre-rewrite: false
2018-04-24 12:41:33 -07:00
Tim Keith
511af19d41 [flang] Create Message instances with provenance range.
This allows the message to point to the full name or statement
rather than just the first character.

Original-commit: flang-compiler/f18@9cf41b1335
Reviewed-on: https://github.com/flang-compiler/f18/pull/67
2018-04-23 16:18:48 -07:00
peter klausler
925cadcddc [flang] Remove needless empty braces from construct<>() calls.
Original-commit: flang-compiler/f18@f9c4a27034
Reviewed-on: https://github.com/flang-compiler/f18/pull/68
2018-04-23 16:53:16 -07:00
peter klausler
64e64e6747 [flang] Delete more dead code.
Original-commit: flang-compiler/f18@e38e411ccf
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
2018-04-23 15:44:30 -07:00
peter klausler
e42168a903 [flang] Remove dead code.
Original-commit: flang-compiler/f18@a85e16c704
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:29 -07:00
peter klausler
e6b1f1f45e [flang] Use ranges of provenances in messages.
Original-commit: flang-compiler/f18@67d4f878a4
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:29 -07:00
peter klausler
d3c1a08e68 [flang] Extend Message representation to cover ranges.
Original-commit: flang-compiler/f18@314819c87f
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:28 -07:00
peter klausler
30f337a36d [flang] Finish cleaning up debug-parser.
Original-commit: flang-compiler/f18@0ef551025a
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:28 -07:00
peter klausler
cc589b2e8e [flang] Split debug-parser.h, put code into debug-parser.cc.
Original-commit: flang-compiler/f18@b34d15ef6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:27 -07:00
peter klausler
d2306759fc [flang] Finish moving user state action parsers into user-state.{h,cc}.
Original-commit: flang-compiler/f18@79c8a4cefe
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:27 -07:00
peter klausler
4412cb03c4 [flang] More clean-up.
Original-commit: flang-compiler/f18@96dda92286
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:26 -07:00
peter klausler
8800ae5e08 [flang] Begin moving UserState action parsers into user-state.{h,cc}.
Original-commit: flang-compiler/f18@5c31402146
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:25 -07:00
peter klausler
8c110e0af1 [flang] Fix header file name.
Original-commit: flang-compiler/f18@8abfeaed45
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:24 -07:00
peter klausler
48704ef940 [flang] Move Parser<> to its own header.
Original-commit: flang-compiler/f18@c43e8ba138
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:23 -07:00
peter klausler
c387b6d4e4 [flang] Use references for ParseState arguments to parsers. Other minor clean-up.
Original-commit: flang-compiler/f18@5b18b799e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:23 -07:00
Tim Keith
dfd2bcbd3c [flang] Undo previous commit.
`name` depends on the template type, so we have to explicitly say
that `has` is a template with the `template` keyword.
Rather than do that I'm putting back the explicit type for name.

Original-commit: flang-compiler/f18@0cde87f2fe
Reviewed-on: https://github.com/flang-compiler/f18/pull/65
2018-04-23 15:33:59 -07:00
Tim Keith
30af7449d9 [flang] Address review comment.
Original-commit: flang-compiler/f18@cb3904761b
Reviewed-on: https://github.com/flang-compiler/f18/pull/65
Tree-same-pre-rewrite: false
2018-04-23 13:10:33 -07:00
Tim Keith
744427238c [flang] Rewrite function calls to array element references
parse-tree.h, parse-tree.cc:
Add FunctionReference::ConvertToArrayElementRef() to convert a function
reference to an array element reference.
Factor out MakeArrayElementRef() to use in ConvertToArrayElementRef()
and also in converting statement functions to array element assignments.

resolve-names.cc:
Recognize references to functions and subroutines and add symbols for them.
Detect declaration conflicts from these and check `IMPLICIT NONE(EXTERNAL)`.

rewrite-parse-tree.cc:
Find function references that need to be converted and rewrite them.

Original-commit: flang-compiler/f18@e5a1e0aaef
Reviewed-on: https://github.com/flang-compiler/f18/pull/65
2018-04-23 12:46:56 -07:00
peter klausler
7335482d98 [flang] Complete parser instrumentation and caching of failures.
Original-commit: flang-compiler/f18@9843dbf211
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
2018-04-19 17:02:12 -07:00
peter klausler
56b09e08eb [flang] Parser instrumentation and fail-fast experiment begun.
Original-commit: flang-compiler/f18@ab46163d6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
Tree-same-pre-rewrite: false
2018-04-19 15:46:02 -07:00
peter klausler
2c06be3fb8 [flang] First cut at parser instrumentation with pass/fail counters.
Original-commit: flang-compiler/f18@21ed700afa
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
Tree-same-pre-rewrite: false
2018-04-19 13:58:02 -07:00
peter klausler
086a7f3596 [flang] Address review comments.
Original-commit: flang-compiler/f18@dbeba37322
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
2018-04-19 13:51:25 -07:00
peter klausler
0acda77554 [flang] Finish repackaging SetOfChars
Original-commit: flang-compiler/f18@37085c0cdd
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:08 -07:00
peter klausler
107aa28930 [flang] More repackaging
Original-commit: flang-compiler/f18@55f4f0505e
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:07 -07:00
peter klausler
376d8f96d4 [flang] repackage SetOfChars as a class type
Original-commit: flang-compiler/f18@bae9199f62
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:06 -07:00
peter klausler
075fe789da [flang] Combine expected character sets of messages ending at same point from two alternatives.
Original-commit: flang-compiler/f18@a006ceef1d
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:04 -07:00
peter klausler
f6accb372b [flang] debugging
Original-commit: flang-compiler/f18@02718dd6ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:04 -07:00
peter klausler
1730085e1b [flang] Define sets of characters; use them in parsing and messages.
Original-commit: flang-compiler/f18@d3ca565b59
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:03 -07:00
Tim Keith
3d2120989a [flang] Move ConvertToAssignment into class StmtFunctionStmt.
Original-commit: flang-compiler/f18@e3eaca38fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/60
2018-04-19 07:07:47 -07:00
Tim Keith
06f9d7901a [flang] Merge parse-tree-mutator.h into parse-tree-visitor.h
Use the latter for visiting and mutating and delete the former.

Original-commit: flang-compiler/f18@ac5a098ca7
Reviewed-on: https://github.com/flang-compiler/f18/pull/60
Tree-same-pre-rewrite: false
2018-04-18 16:49:42 -07:00
Tim Keith
6746a18e6b [flang] Address review comments.
Original-commit: flang-compiler/f18@d3a363d6cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/60
Tree-same-pre-rewrite: false
2018-04-18 15:50:36 -07:00
Tim Keith
1c291436f5 [flang] Implement parse tree rewriting.
Add parse-tree-mutator.h like parse-tree-visitor.h except that the Walk
functions take non-const references to parse tree nodes so the Pre and
Post methods of the mutator that are passed around can make changes to
the parse tree.

Change ExecutionPart to be a class that wraps a list so that it can be
identified during parse tree walking.

Add Symbol* field to parser::Name for the result of symbol resolution.
In parse tree dumper, dump symbol when it is there instead of just name.

Add RewriteParseTree to walk the parse tree, fill in resolved symbols in
Name nodes, and make necessary changes to the structure. Currently that
consists of rewriting statement functions as array assignments when
appropriate.

In ResolveNames, call RewriteParseTree if the resolution was successful.
Recognize a statement function that comes after a mis-identified
statement function and report an error. resolve08.f90 tests this case.

Add -fdebug-dump-symbols to dump the scope tree and symbols in each scope.
This is implemented by DumpSymbols in resolve-names.cc. Add an optional
symbol to scopes that correspond to symbols (e.g. subprograms). Remove
debug output from ResolveNamesVisitor as this option can be used instead.

Original-commit: flang-compiler/f18@9cd3372265
Reviewed-on: https://github.com/flang-compiler/f18/pull/60
Tree-same-pre-rewrite: false
2018-04-18 15:06:35 -07:00
peter klausler
43c64d215a [flang] Defer message accumulation until it is known that messages will be produced.
Original-commit: flang-compiler/f18@8485d44efd
Reviewed-on: https://github.com/flang-compiler/f18/pull/59
2018-04-17 16:58:18 -07:00