Commit graph

553 commits

Author SHA1 Message Date
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
3718554d07 [flang] Merge pull request flang-compiler/f18#79 from ThePortlandGroup/tsk3
Implement USE statements.

Original-commit: flang-compiler/f18@053461f6de
Reviewed-on: https://github.com/flang-compiler/f18/pull/79
2018-05-04 07:24:35 -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
f0573b2a3a [flang] Merge pull request flang-compiler/f18#78 from ThePortlandGroup/sch_llvm2
Add dependency to LLVM & Clang libraries (backport)

Original-commit: flang-compiler/f18@c0d84e4ae3
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
2018-05-04 11:20:37 +02: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
bbc3b413b8 [flang] Merge pull request flang-compiler/f18#77 from ThePortlandGroup/tsk4
Source code cleanup

Original-commit: flang-compiler/f18@63b5a0e133
Reviewed-on: https://github.com/flang-compiler/f18/pull/77
2018-05-02 15:32:16 -07: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
c783acc024 [flang] Merge pull request flang-compiler/f18#76 from ThePortlandGroup/sjs-os1
Remove unused code; rename dump-parse-tree

Original-commit: flang-compiler/f18@e46b5087b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/76
2018-05-02 11:05:34 -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
a9ed8e7eee [flang] Merge pull request flang-compiler/f18#75 from ThePortlandGroup/tsk4
Cleanup

Original-commit: flang-compiler/f18@d1545693d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/75
2018-05-01 14:44:40 -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
98cb77a0cf [flang] Merge pull request flang-compiler/f18#74 from ThePortlandGroup/tsk4
Add copyright notices.

Original-commit: flang-compiler/f18@20f64da9d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/74
2018-05-01 13:24:54 -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
dd02ee1216 [flang] Merge pull request flang-compiler/f18#73 from ThePortlandGroup/pmk-scrub3
More clean-up & build with Clang

Original-commit: flang-compiler/f18@c809062f11
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
2018-04-27 15:32:12 -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
0ceb4abf1a [flang] Merge pull request flang-compiler/f18#70 from ThePortlandGroup/tsk2
Initial support for name resolution in modules.

Original-commit: flang-compiler/f18@1c318fe9f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/70
2018-04-25 12:52:06 -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
1e3af84738 [flang] Merge pull request flang-compiler/f18#69 from ThePortlandGroup/pmk3
Make `construct<T>(...)` calls span more accurate source ranges.

Original-commit: flang-compiler/f18@e332daec7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/69
2018-04-24 16:34:01 -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
4859bf7db8 [flang] Merge pull request flang-compiler/f18#67 from ThePortlandGroup/tsk3
Create Message instances with provenance range.

Original-commit: flang-compiler/f18@6e473cd029
Reviewed-on: https://github.com/flang-compiler/f18/pull/67
2018-04-24 12:30:09 -07:00