Commit graph

320 commits

Author SHA1 Message Date
Peter Klausler
63b549bf36 [flang] Merge pull request flang-compiler/f18#26 from ThePortlandGroup/pmk-f90
More fixes for bugs found by running f90_correct tests.

Original-commit: flang-compiler/f18@5e27ec4ab9
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
2018-03-20 10:17:05 -07:00
peter klausler
92bcb7ceb2 [flang] Make unreadable code less so, per review comments.
Original-commit: flang-compiler/f18@78073c15a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
2018-03-19 16:17:23 -07:00
peter klausler
554a5641c4 [flang] Improve preprocessor error message provenances, pass f90_correct test pre21.
Original-commit: flang-compiler/f18@af5943e3bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-19 11:48:49 -07:00
peter klausler
2bde61360e [flang] Pass as much of f90_correct as I think we can.
Original-commit: flang-compiler/f18@6d101d3ec8
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-16 16:58:35 -07:00
peter klausler
0983fbc3d6 [flang] More f90_correct work.
Original-commit: flang-compiler/f18@92b68f705f
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-16 16:13:49 -07:00
peter klausler
ad4adc2d28 [flang] More f90_correct work.
Original-commit: flang-compiler/f18@442771db3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-15 17:09:27 -07:00
peter klausler
4e02b9e4b0 [flang] Make previous commit more precise.
Original-commit: flang-compiler/f18@543da95754
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-15 16:28:37 -07:00
peter klausler
2e5300ce4e [flang] Never emit :: when /-bracketed initializers appear on a type declaration stmt.
Original-commit: flang-compiler/f18@2ed327a4f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-15 16:22:38 -07:00
peter klausler
dcd094234c [flang] Unparsing fixes, PGF90 bug work-arounds.
Original-commit: flang-compiler/f18@c9c98c0e5c
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-15 16:03:28 -07:00
peter klausler
4933243d3a [flang] Remove excess newlines from cooked source, no longer needed.
Original-commit: flang-compiler/f18@9330b0d7fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
2018-03-15 13:25:37 -07:00
Peter Klausler
d96d2c4837 [flang] Merge pull request flang-compiler/f18#27 from ThePortlandGroup/pmk-doc
New documentation

Original-commit: flang-compiler/f18@e3886bac53
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
2018-03-20 10:07:39 -07:00
peter klausler
393c441767 [flang] Extend documentation.
Original-commit: flang-compiler/f18@f090167356
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
2018-03-20 09:58:45 -07:00
peter klausler
1a4662d6be [flang] Write documentation/preprocessing.md
Original-commit: flang-compiler/f18@4c8f4a97ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
Tree-same-pre-rewrite: false
2018-03-19 17:10:53 -07:00
peter klausler
f123105c7a [flang] More typing into documentation/parsing.md
Original-commit: flang-compiler/f18@73f68d0ea1
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
Tree-same-pre-rewrite: false
2018-03-19 15:30:32 -07:00
peter klausler
6e83386c78 [flang] Initial cut at documentation/parsing.md
Original-commit: flang-compiler/f18@5484515b09
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
Tree-same-pre-rewrite: false
2018-03-19 15:17:32 -07:00
Peter Klausler
cd99b3b048 [flang] Merge pull request flang-compiler/f18#25 from ThePortlandGroup/pmk-walk-unparse
Take flang-compiler/f18#2 on unparsing, now using the new parse tree walker.

Original-commit: flang-compiler/f18@1f6c2c390e
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
2018-03-15 12:25:20 -07:00
peter klausler
cbf39d56d4 [flang] Do not forget to run the linker even if there was nothing to compile.
Original-commit: flang-compiler/f18@4f4f853e5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
2018-03-15 12:22:41 -07:00
peter klausler
42b72c46d1 [flang] Get clean parse-unparse-reparse-unparse on f90_correct too.
Original-commit: flang-compiler/f18@901a9e462c
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-15 10:59:46 -07:00
peter klausler
ed5a6c9faf [flang] Fix regression from last commit on STAT=/ERRMSG=.
Original-commit: flang-compiler/f18@f031d07c30
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-14 17:07:15 -07:00
peter klausler
62d9cdd15c [flang] More f90 unparsing.
Original-commit: flang-compiler/f18@b9991c1a04
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-14 17:02:21 -07:00
peter klausler
d71f3cf532 [flang] More unparsing.
Original-commit: flang-compiler/f18@a3ef9de518
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-14 16:31:41 -07:00
peter klausler
b7cf512e0d [flang] Incorporate more code review comments, fix more f90.
Original-commit: flang-compiler/f18@2428121ab4
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-14 15:31:16 -07:00
peter klausler
b28ea527b4 [flang] Address review comments. Add note to style guide condemning if((x=y)).
Original-commit: flang-compiler/f18@4ca8b8e514
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-13 17:20:40 -07:00
peter klausler
46c3538c7a [flang] Fix some F90 unparsings; address review comments.
Original-commit: flang-compiler/f18@af33f37600
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-13 17:11:26 -07:00
peter klausler
d39a33f80c [flang] Start on f90_correct. Incorporate review comments.
Original-commit: flang-compiler/f18@3f8cecef8e
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-13 16:59:30 -07:00
peter klausler
47dbbda25d [flang] Bugfixing and review comments.
Original-commit: flang-compiler/f18@29cabc7100
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-13 16:47:48 -07:00
peter klausler
79d044e9b5 [flang] Take flang-compiler/f18#2 on unparsing, now using the new parse tree walker.
Clean out old data structure formatter.

Create stand-alone Parsing class to compose parts of the parser together.

Hello, world!

Better error recovery on command line errors.

Fix bugs from initial run at f77_correct.

Allow parentheses on PROGRAM statement.

Fix Hollerith scanning.

Remove REDIMENSION with good error recovery.

Fix new "spaces" parser, clean up calls to it.

Fix bugs exposed by in38.f90.

Escaped \a is not special to pgf90; get slashes around STRUCTURE name right.

Better multi-byte source encoding support in Hollerith.

Reformat C++.

More work on multi-byte source encoding.

Pass 219 tests in f77_correct, with good excuses for the rest.

Original-commit: flang-compiler/f18@8a1a0aa2dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-13 16:32:09 -07:00
Tim Keith
6fab60d6db [flang] Merge pull request flang-compiler/f18#23 from ThePortlandGroup/tsk4
Add MakeTypes to build types using visitor.

Original-commit: flang-compiler/f18@30a4b46d4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
2018-03-01 18:09:18 -08:00
Tim Keith
01580dd19a [flang] Replace raw pointers with std::unique_ptr.
This simplifies the "delete and set to null" pattern to just a call to
reset(), and "assign and set to null" to a call to std::move.

The ideal would be a custom deleter that throws an error when an
implicit delete happens but not when reset() is called, but I'm not sure
that's possible.

Original-commit: flang-compiler/f18@f618fc729a
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
2018-03-01 18:04:05 -08:00
Tim Keith
600788e5f7 [flang] Add MakeTypes to build types using visitor.
This replaces the manual walking code in test-type.cc. It walks the
parse tree and constructs DeclTypeSpec and DerivedTypeDef objects for
each type encountered. It's in a new file, make-types.cc, so that
failing compilations complete faster.

Handle more parts of derived type definitions.

Also some minor cleanups in type.h and type.cc.

Original-commit: flang-compiler/f18@859e7e2665
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
Tree-same-pre-rewrite: false
2018-03-01 15:24:35 -08:00
Peter Klausler
801378a5f0 [flang] Merge pull request flang-compiler/f18#22 from ThePortlandGroup/pmk-fix2
Ensure that the parse tree visitation Walk template works on FORMAT.

Original-commit: flang-compiler/f18@e693dd320d
Reviewed-on: https://github.com/flang-compiler/f18/pull/22
2018-03-01 14:47:28 -08:00
peter klausler
20364f0351 [flang] Ensure that the parse tree visitation Walk template works on FORMAT.
The classes that were segregated into format-specification.h have
also been grouped into a new Fortran::format namespace.
Code added to tools/f18/f18.cc to run a minimal visitor over
the parse trees resulting from successful parses so that any
future build problems with Walk() will be caught earlier.

Rearrange Walk instances, keep format:: ones together.

Original-commit: flang-compiler/f18@685ddb91ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/22
2018-03-01 13:35:58 -08:00
Peter Klausler
c88b23e04e [flang] Merge pull request flang-compiler/f18#21 from ThePortlandGroup/pmk-fix
Fix parsing error on PROCEDURE statement in derived type definition.

Original-commit: flang-compiler/f18@e9c218df42
Reviewed-on: https://github.com/flang-compiler/f18/pull/21
2018-03-01 13:34:48 -08:00
peter klausler
1b0705ca0f [flang] Fix parsing error on PROCEDURE statement in derived type definition.
Improve error recovery in that context.

Original-commit: flang-compiler/f18@b9e48504e6
Reviewed-on: https://github.com/flang-compiler/f18/pull/21
2018-03-01 11:28:13 -08:00
Peter Klausler
a4a355940c [flang] Merge pull request flang-compiler/f18#20 from ThePortlandGroup/pmk-traits
Trait-based parse tree traversal.

Original-commit: flang-compiler/f18@0f8a4aaf07
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
2018-02-28 14:59:03 -08:00
peter klausler
aa3aad34ea [flang] Follow own new style rule about returns and elses.
Original-commit: flang-compiler/f18@665fdf72d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
2018-02-28 14:55:45 -08:00
peter klausler
65ed9e1dae [flang] Run clang-format.
Original-commit: flang-compiler/f18@cd52d99f21
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
2018-02-28 14:53:04 -08:00
peter klausler
601e0acdeb [flang] Improvements suggested by Tim.
Original-commit: flang-compiler/f18@c3d2e3e745
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
2018-02-28 14:51:45 -08:00
peter klausler
07a028098f [flang] Trait-based parse tree traversal.
Add a CLASS_TRAIT macro to idioms.h to define template metaprogramming
based on definable traits of user-defined classes.  Tweak the boilerplate
macros in parse-tree.h to add traits to the empty, wrapper, union, and
tuple classes in the parse tree.  Replace the macros in parse-tree-visitor.h
with trait-driven templates.

Original-commit: flang-compiler/f18@02400146fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/20
Tree-same-pre-rewrite: false
2018-02-28 13:24:01 -08:00
Tim Keith
848bf57051 [flang] Merge pull request flang-compiler/f18#18 from ThePortlandGroup/tsk1
Use macros to reduce boilerplate.

Original-commit: flang-compiler/f18@b9f25364a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/18
2018-02-27 16:52:29 -08:00
Tim Keith
de65ddbae0 [flang] Use macros to reduce boilerplate.
The common cases of wrapper, tuple, and union classes can be further
reduced by using macros to define the Walk functions.

Original-commit: flang-compiler/f18@29e02c4886
Reviewed-on: https://github.com/flang-compiler/f18/pull/18
2018-02-27 16:52:29 -08:00
Peter Klausler
c986245a85 [flang] Merge pull request flang-compiler/f18#19 from ThePortlandGroup/pmk-fix-master
Fix some bugs that I noticed while running regression tests.

Original-commit: flang-compiler/f18@0d6c927f8f
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
2018-02-27 16:35:08 -08:00
peter klausler
48f7c6f0fd [flang] Fix test: do not allow & as continuation marker in fixed form if in a character literal.
Original-commit: flang-compiler/f18@26c07eb2e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
2018-02-27 16:33:10 -08:00
peter klausler
f4a85288db [flang] Fix some bugs that I noticed while running regression tests.
Add characters.h to consolidate all per-character functions
and reduce dependence on <cctype>.
Add omitted DIRECT= and UNFORMATTED= specifiers to INQUIRE statement.
Add Interval<>, rebase ProvenanceRange upon it, rebase CharPointerWithLength
and rename it ContiguousChars.
Reformat C++.

Original-commit: flang-compiler/f18@78c73c62ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/19
Tree-same-pre-rewrite: false
2018-02-27 15:55:10 -08:00
Peter Klausler
089796d643 [flang] Merge pull request flang-compiler/f18#16 from ThePortlandGroup/pmk-minor
Preserve some minor changes...

Original-commit: flang-compiler/f18@7b3e4908bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/16
2018-02-26 16:00:43 -08:00
peter klausler
03aecfc336 [flang] Preserve some minor changes that accumulated as I was implementing
an unparsing feature.

Enum classes in parse tree node class types are now defined with
a macro so that the names of the enumerations can be captured for
formatting purposes.

Add a TODO comment.

Rebase to new master with parse tree traversal code.

Original-commit: flang-compiler/f18@d6bfcfd526
Reviewed-on: https://github.com/flang-compiler/f18/pull/16
2018-02-26 15:31:46 -08:00
Tim Keith
c36ac6b185 [flang] Merge pull request flang-compiler/f18#17 from ThePortlandGroup/tsk1
Fix classes with variant and other fields

Original-commit: flang-compiler/f18@1c2f9e8e8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/17
2018-02-26 15:12:10 -08:00
Tim Keith
66c9a69a61 [flang] Fix classes with variant and other fields
Fortran::FormatItem and UseStmt have both normal fields and a variant
named 'u'. The Walk calls for the normal fields were missing.
These were the only two classes I found where this occurs.

Original-commit: flang-compiler/f18@23b8695a74
Reviewed-on: https://github.com/flang-compiler/f18/pull/17
2018-02-26 15:07:24 -08:00
Tim Keith
c2c6e28cec [flang] Merge pull request flang-compiler/f18#15 from ThePortlandGroup/tsk1
First implementation of a parse tree visitor

Original-commit: flang-compiler/f18@b9a9d249f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
2018-02-26 14:52:27 -08:00
Tim Keith
2af29bc1e2 [flang] Add Unparse function.
Unparse takes a parse tree and converts it back to Fortran.
class UnparseVisitor implements a parse tree visitor that emits
the appropriate Fortran source for each node that it visits.
It is only partially implemented so far.

Change f18 to dump the parse tree using Unparse.

Original-commit: flang-compiler/f18@e80c13ec88
Reviewed-on: https://github.com/flang-compiler/f18/pull/15
2018-02-26 14:52:27 -08:00