Commit graph

37 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Tim Keith
c9d838e8a7 [flang] Add -fdebug-dump-parse-tree and -fdebug-resolve-names
"f18 -fdebug-resolve-names -fparse-only ..." is equivalent to what
test-type used to do, so the test-type executable can be eliminated.

-fdebug-dump-parse-tree does the parse-tree dumping that test-sema
does, but test-sema does more so I have left it alone.

Original-commit: flang-compiler/f18@8b3816528e
Reviewed-on: https://github.com/flang-compiler/f18/pull/55
2018-04-12 20:01:40 -07:00
Tim Keith
6c772ac40b [flang] Improve include file sorting.
Includes like "../dir/file.h" should sort after local includes.
This change fixes that and applies the new formatting.

Now the order (in reverse) is:
- system includes
- includes from llvm or clang (this is from the default IncludeCategories)
- includes of ../something
- everything else

Original-commit: flang-compiler/f18@324643d63a
Reviewed-on: https://github.com/flang-compiler/f18/pull/52
2018-04-12 12:23:20 -07:00
peter klausler
1e1ea723c5 [flang] Better error recovery, some debugging.
Original-commit: flang-compiler/f18@b7509f0e5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 16:06:18 -07:00
peter klausler
af22e07f71 [flang] Revamp messaging. Add ""_err_en_US to denote fatal error messages.
Original-commit: flang-compiler/f18@7ddc807a1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 15:51:04 -07:00
peter klausler
1f3c41b521 [flang] Emit warnings in free form when a required space is missing.
Original-commit: flang-compiler/f18@e41917d144
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
2018-03-29 16:06:31 -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
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
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
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
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
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
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
peter klausler
7af9dd8736 [flang] Remove old character "cooking" parser combinators that handled Fortran
comments, continuations, &c. that have become obsolete with the use
of the new C++-coded prescanner module.  Clean out members from
ParseState that were used only by cookedNextChar and its sub-parsers.

Original-commit: flang-compiler/f18@41717531e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/11
Tree-same-pre-rewrite: false
2018-02-16 10:41:16 -08:00
peter klausler
fcb6b2a558 [flang] Remove a temporary #include <iostream> and auto-detect -Mfixed from a .f suffix.
Original-commit: flang-compiler/f18@962c7ed0ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/10
2018-02-15 17:12:50 -08:00
peter klausler
edbec459fb [flang] Complete provenance tracking through macro calls.
Original-commit: flang-compiler/f18@8c05a6543b
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
67d916f8ba [flang] More precise source locations on error messages. Anticipate module file scanning.
Original-commit: flang-compiler/f18@f4faadd389
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
10a36336df [flang] Implement a directory search path for INCLUDE lines.
Original-commit: flang-compiler/f18@62129e5600
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
fe04c3a02f [flang] Implement Fortran INCLUDE lines.
Original-commit: flang-compiler/f18@d01af89506
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
5b61beaa12 [flang] Preparatory work for file inclusion.
Original-commit: flang-compiler/f18@1cbbd4a357
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
97a7c501dc [flang] Forge provenances for compiler-inserted text.
Original-commit: flang-compiler/f18@dbdd01aa25
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
3bca5d088e [flang] Restructure inter-class references for clarity.
Original-commit: flang-compiler/f18@1836cd5d06
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
90c3cad9a7 [flang] Debugging new provenance support.
Original-commit: flang-compiler/f18@1233f666da
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
09865ffe7b [flang] Replace Position with Provenance everywhere.
Original-commit: flang-compiler/f18@8c2da3f8cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
14322536e3 [flang] Tweaked .clang-format, then ran it.
Original-commit: flang-compiler/f18@e10e43b691
Reviewed-on: https://github.com/flang-compiler/f18/pull/4
2018-02-07 12:27:36 -08:00
peter klausler
0ba1a14be2 [flang] Impose a directory structure. Move files around. Introduce
an intermediate "parser" namespace.

Original-commit: flang-compiler/f18@690b6f0d1e
Reviewed-on: https://github.com/flang-compiler/f18/pull/4
Tree-same-pre-rewrite: false
2018-02-07 12:04:42 -08:00
Renamed from flang/f2018-demo.cc (Browse further)