Commit graph

423 commits

Author SHA1 Message Date
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
785c31fd2f [flang] Merge pull request flang-compiler/f18#80 from ThePortlandGroup/pmk-ptdump
Clean up dump-parse-tree.h

Original-commit: flang-compiler/f18@c0e3940cb0
Reviewed-on: https://github.com/flang-compiler/f18/pull/80
2018-05-04 10:43:14 -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
b9286e62d6 [flang] Merge pull request flang-compiler/f18#81 from ThePortlandGroup/pmk-nag
Fixes to bugs found by NAG tests, and clangification of error message layout

Original-commit: flang-compiler/f18@2c852cedaa
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
2018-05-04 10:26:36 -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
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