Commit graph

971 commits

Author SHA1 Message Date
peter klausler c75c9f0a54 [flang] Refactoring and renaming
Original-commit: flang-compiler/f18@29fc0bee8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:46 -07:00
peter klausler 94540975f3 [flang] clean up naming in expressions and types
Original-commit: flang-compiler/f18@ab17ef4d4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:46 -07:00
peter klausler 8b9efa289c [flang] checkpoint
Original-commit: flang-compiler/f18@3fae716c44
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:44 -07:00
peter klausler 2e68aff3fd [flang] Expression analysis checkpoint
Original-commit: flang-compiler/f18@f740cab641
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:43 -07:00
Tim Keith 21fbc5fcfe [flang] Merge pull request flang-compiler/f18#179 from flang-compiler/tsk1
Improve error message for "type already declared"

Original-commit: flang-compiler/f18@46b6892153
Reviewed-on: https://github.com/flang-compiler/f18/pull/179
2018-09-12 15:56:55 -07:00
Tim Keith db88ddf74e [flang] Improve error message for "type already declared"
Add reference to the statement where the type was first set.

Original-commit: flang-compiler/f18@911c90e99e
Reviewed-on: https://github.com/flang-compiler/f18/pull/179
2018-09-11 07:26:54 -07:00
Tim Keith 6f1195fd9d [flang] Merge pull request flang-compiler/f18#182 from flang-compiler/tsk2
Simplify representation of intrinsic types

Original-commit: flang-compiler/f18@a6afb59d42
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
2018-09-12 11:38:26 -07:00
Tim Keith 97355ddd2d [flang] The default kind of complex is the same as that of real.
Original-commit: flang-compiler/f18@16080c0674
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
2018-09-12 11:37:29 -07:00
Tim Keith ae3b96456f [flang] Simplify representation of intrinsic types
Intrinsic types are now just a TypeCategory and a int kind. If no kind
is specified the default is used so that every type has an explicit
kind. This caused changes in the expected results of some of the tests.

Add support for "double precision" and "double complex".

Intrinsic types are now stored as values in DeclTypeSpec so none of the
KindedTypeHelper machinery is needed any more.

Eliminate DerivedTypeDef, DataComponentDef, ProcComponentDef,
TypeBoundProc. The components and bindings of a derived type are now
represented by the corresponding Scope.

Original-commit: flang-compiler/f18@4ad8ffb187
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
Tree-same-pre-rewrite: false
2018-09-11 17:33:42 -07:00
Eric Schweitz 0639ed447d [flang] Merge pull request flang-compiler/f18#181 from flang-compiler/eas6
Issue flang-compiler/f18#180 - Label vs. IntLiteralConstant

Original-commit: flang-compiler/f18@2350ed9128
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
2018-09-12 08:30:43 -07:00
Eric Schweitz bb361924ff [flang] Clean up dangling spaces
Original-commit: flang-compiler/f18@7a29dc617a
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
2018-09-11 16:30:49 -07:00
Eric Schweitz dba93d3fbe [flang] Fixes the Label vs. IntLiteralConstant issue flang-compiler/f18#180
Original-commit: flang-compiler/f18@40387158dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Tree-same-pre-rewrite: false
2018-09-11 16:26:19 -07:00
Eric Schweitz 2e44efeea2 [flang] Merge pull request flang-compiler/f18#170 from flang-compiler/easddd
Add label resolution initial pass implementation and tests

Original-commit: flang-compiler/f18@92a20cbdc9
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
2018-09-11 14:01:25 -07:00
Eric Schweitz 6e38e225a4 [flang] tweak Legality
Original-commit: flang-compiler/f18@19834c65d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
2018-09-11 14:01:25 -07:00
Eric Schweitz 412393babb [flang] clang-format doesn't
Original-commit: flang-compiler/f18@0114db6ced
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz e12f6121b9 [flang] Remove the strict F18 checking flag. Always check that program is
strictly conforming to F18, but demote errors to warnings when the
Fortran is legal under pre-F18 standards. If the Fortran is illegal
under F18 _and_ previous standards, then emit an error.

Original-commit: flang-compiler/f18@6d1f37683a
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 6265aed20e [flang] convert name to lowercase
Original-commit: flang-compiler/f18@f591d31ab4
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz b3a87d4e27 [flang] More renaming
Original-commit: flang-compiler/f18@9ef9ef4479
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz facd02405f [flang] Fix a couple other spots clang-format missed
Original-commit: flang-compiler/f18@1a4b12e1b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 51a48e542a [flang] clang-format didn't clean up some of the code. delete std::make_pair call.
Original-commit: flang-compiler/f18@4defccc50d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 20cc4d5134 [flang] Simplify some of the if-return-else-return expansions while possibly
keeping things readable.

Original-commit: flang-compiler/f18@55b7e18763
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 57eb3cd6f9 [flang] Fix globbing bug and return variable not being set
Original-commit: flang-compiler/f18@238349048b
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 8ad03ecf87 [flang] Per review:
Change initializer lists to use curlies.
Change uses of std::tuple to PODs & add ctors per compiler complaining.

Original-commit: flang-compiler/f18@42c5cdcaab
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 38ec0d0fce [flang] More review comment actions.
Original-commit: flang-compiler/f18@eb7ab3452d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 603353d2ef [flang] Changes for the latest round of syntax change requests per the review.
Original-commit: flang-compiler/f18@0df221aeda
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 17b5530fb2 [flang] ctest may require that the path be specified, so add it to the input file name.
Original-commit: flang-compiler/f18@751e88f108
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 466e5df90d [flang] remove emacs line
Original-commit: flang-compiler/f18@64aa22d644
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 715a1ed493 [flang] Changes per the review comments. The majority of the changes are simply
to rename identifiers to meet the project (not LLVM) coding standard.
Includes a home brew of FileCheck for testing.

Original-commit: flang-compiler/f18@bb15490cc0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 7bdf04b695 [flang] Use is_same<> templates
Original-commit: flang-compiler/f18@a47f6bacf0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 44aa9f1ce7 [flang] Make use of is_same<>
Original-commit: flang-compiler/f18@12cd530865
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz 69dc2e446f [flang] Merge up to new Messages interface
Original-commit: flang-compiler/f18@ca45fdd1cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz df4575f6b9 [flang] Add label resolution design document, pass, and tests
Original-commit: flang-compiler/f18@e0d0df900c
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Peter Klausler ed048fb3f8 [flang] Merge pull request flang-compiler/f18#178 from flang-compiler/pmk1
Better error recovery and messages for PROCEDURE components (issue#174)

Original-commit: flang-compiler/f18@31c258ae68
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
2018-09-10 16:25:38 -07:00
peter klausler 72075b659e [flang] Restore mistakenly deleted call to nonemptyList()
Original-commit: flang-compiler/f18@d40d492fb2
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
2018-09-10 14:25:03 -07:00
peter klausler 9a94a23482 [flang] Better error recovery and messages for PROCEDURE components
Original-commit: flang-compiler/f18@19813349aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
Tree-same-pre-rewrite: false
2018-09-10 14:20:35 -07:00
Tim Keith b45531e559 [flang] Merge pull request flang-compiler/f18#177 from flang-compiler/tsk1
Write private symbols to .mod files

Original-commit: flang-compiler/f18@f325e8b765
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
2018-09-10 15:37:43 -07:00
Tim Keith 7227cfe026 [flang] Miscellaneous name resolution
Handle BIND statement and PARAMETER statement. They are different from
other attribute-setting statements so some refactoring of
HandleAttributeStmt is required. And for PARAMETER, SetType needs to
report an error if the implicitly determined type is changed later. This
requires operator== on DeclTypeSpec.

Resolve names in allocate statements, pointer assignment statements,
substring expressions, and type parameter values.

Original-commit: flang-compiler/f18@79ad96b976
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
2018-09-10 12:20:42 -07:00
Tim Keith 7ebbe7dca4 [flang] Write private symbols to .mod files
We were trying to write only symbols that are part of the public API of
a module to the .mod file. The problem with that is that submodules need
access to the private symbols in their ancestor modules and submodules.

For now, just write out all of the symbols, private or otherwise.
We could be more precise by omitting some private symbols for modules
that don't have separate module procedures and so can't have submodules.

Also, the old implementation went into an infinite loop for recursive
derived types.

This makes CollectSymbols simpler, so have it do both the collecting and
sorting. Make it static so that the types don't have to be defined in
mod-file.h.

Original-commit: flang-compiler/f18@33a10d6238
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-10 11:39:03 -07:00
Tim Keith 78c62eaf02 [flang] Ensure use of ObjectEntityDetails for data objects
A symbol is created with EntityDetails if we don't know whether it is a
procedure or data object. At the end of the specification part, if we
don't know it's a procedure then it must be an object, so convert it
then. So after name resolution there should be no symbols with
EntityDetails.

Also, a couple of small fixes:
- need to visit sub-nodes of shape specs so that any names get resolved
- don't report an error for an array element mis-parsed as a call

Original-commit: flang-compiler/f18@0effecd225
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-07 09:57:14 -07:00
Tim Keith f14e3030e8 [flang] Code cleanup
Rename stmtFuncsToConvert to stmtFuncsToConvert_.
Make member functions out-of-line.

Original-commit: flang-compiler/f18@3ada89d22f
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-07 09:31:02 -07:00
Tim Keith 6bf633b7bd [flang] Fix bug in rewriting function calls
Arrays are now represented with ObjectEntityDetails, not EntityDetails.
So that's what we have to look for when rewriting function calls to
array element references.

Original-commit: flang-compiler/f18@841b37d94b
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-07 09:31:02 -07:00
Tim Keith c4b0f8b26d [flang] Merge pull request flang-compiler/f18#175 from flang-compiler/tsk1
More name resolution

Original-commit: flang-compiler/f18@804e735913
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
2018-09-07 09:08:05 -07:00
Tim Keith a1fff9af07 [flang] Address review comments
Change IsModule to a member function of Scope.

Make multiple PRIVATE statements in a derived type be a non-fatal error.

Original-commit: flang-compiler/f18@dd42dcd15a
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
2018-09-07 09:06:27 -07:00
Tim Keith b168cc0b83 [flang] Add procedure pointer components for derived types
Also eliminate `derivedTypeData_`. Information about derived types needed
during name resolution is in `derivedTypeInfo_` and the permanent record
is the symbol table.

Original-commit: flang-compiler/f18@789960bd95
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
2018-09-06 12:06:32 -07:00
Tim Keith a26fea27db [flang] More derived type name resolution
Track PRIVATE statement in derived type components and in procedure
bindings. These are recorded in derivedTypeInfo_ (along with the name
appearing in EXTENDS) and used to modify the accessibility attributes of
components and bindings. Also track SEQUENCE statement.

Detect erroneous PRIVATE in derived types that aren't in modules.
Detect incompatible SEQUENCE types.

Save EXTENDS symbol and SEQUENCE in DerivedTypeDetails and write them to
the .mod file.

Original-commit: flang-compiler/f18@f29d620714
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
2018-09-06 08:01:49 -07:00
Tim Keith 8fddf6b34f [flang] Improve dumping of enums in parse tree
Change dump-parse-tree.h to dump enumerator names rather than just type
names for data members whose types are defined with ENUM_CLASS.

Original-commit: flang-compiler/f18@57bd4f3af9
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
2018-09-05 16:18:34 -07:00
Tim Keith 47d3e5d0a1 [flang] Merge pull request flang-compiler/f18#173 from flang-compiler/tsk1
More name resolution for derived types

Original-commit: flang-compiler/f18@c06230e9cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
2018-09-05 16:04:12 -07:00
Tim Keith 903730721a [flang] Address review comments
Original-commit: flang-compiler/f18@2ca329b85a
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
2018-09-05 16:02:41 -07:00
Tim Keith 91168ff9be [flang] Resolve derived type parameters
Add TypeParamDetails for symbols that represent type parameters.
Create such symbols when a type-param-def-stmt is encountered.

At the end of the derived-type-def, check the parameters named
in the type-param-name-list against those encountered in each
type-param-def-stmt.

Original-commit: flang-compiler/f18@c15247bb30
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-09-04 10:28:27 -07:00
Tim Keith 1b50885a3f [flang] Move KindOrLen enum to common/fortran.h
This is so that it can more easily be used in semantics in the
representation of type parameters.

Original-commit: flang-compiler/f18@f734d754e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-09-04 10:26:31 -07:00