Commit graph

10 commits

Author SHA1 Message Date
peter klausler
b23701f7d0 [flang] Rearrange some facilities into a new lib/common.
Original-commit: flang-compiler/f18@279af1e817
Reviewed-on: https://github.com/flang-compiler/f18/pull/106
2018-06-18 11:05:17 -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
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
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
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