platform/upstream/llvm.git
5 years ago[flang] ctest may require that the path be specified, so add it to the input file...
Eric Schweitz [Wed, 5 Sep 2018 18:37:45 +0000 (11:37 -0700)]
[flang] ctest may require that the path be specified, so add it to the input file name.

Original-commit: flang-compiler/f18@751e88f108ffb06ba736b97ea2359e27a3ca136a
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] remove emacs line
Eric Schweitz [Tue, 4 Sep 2018 18:34:26 +0000 (11:34 -0700)]
[flang] remove emacs line

Original-commit: flang-compiler/f18@64aa22d64491ed986c1c26b1837402ee52cd208d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] Changes per the review comments. The majority of the changes are simply
Eric Schweitz [Fri, 31 Aug 2018 17:26:19 +0000 (10:26 -0700)]
[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@bb15490cc02327773cb680597226346f02cd4dd0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] Use is_same<> templates
Eric Schweitz [Tue, 28 Aug 2018 17:14:43 +0000 (10:14 -0700)]
[flang] Use is_same<> templates

Original-commit: flang-compiler/f18@a47f6bacf09a032c46d9d26d7e3d07c5b96853ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] Make use of is_same<>
Eric Schweitz [Tue, 28 Aug 2018 17:07:48 +0000 (10:07 -0700)]
[flang] Make use of is_same<>

Original-commit: flang-compiler/f18@12cd53086568241e68d7a7b03f024ae746607e6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] Merge up to new Messages interface
Eric Schweitz [Mon, 27 Aug 2018 22:14:41 +0000 (15:14 -0700)]
[flang] Merge up to new Messages interface

Original-commit: flang-compiler/f18@ca45fdd1cbc1cba3a14da52b59616361b1cdd967
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] Add label resolution design document, pass, and tests
Eric Schweitz [Mon, 20 Aug 2018 23:47:18 +0000 (16:47 -0700)]
[flang] Add label resolution design document, pass, and tests

Original-commit: flang-compiler/f18@e0d0df900c4d823b7114a4d511105c2dbd9d2e77
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#178 from flang-compiler/pmk1
Peter Klausler [Mon, 10 Sep 2018 23:25:38 +0000 (16:25 -0700)]
[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@31c258ae68a0fd4fe9413d33edb6be1dae1af482
Reviewed-on: https://github.com/flang-compiler/f18/pull/178

5 years ago[flang] Restore mistakenly deleted call to nonemptyList()
peter klausler [Mon, 10 Sep 2018 21:25:03 +0000 (14:25 -0700)]
[flang] Restore mistakenly deleted call to nonemptyList()

Original-commit: flang-compiler/f18@d40d492fb2230bebd692f15a79d0399041557817
Reviewed-on: https://github.com/flang-compiler/f18/pull/178

5 years ago[flang] Better error recovery and messages for PROCEDURE components
peter klausler [Mon, 10 Sep 2018 21:19:37 +0000 (14:19 -0700)]
[flang] Better error recovery and messages for PROCEDURE components

Original-commit: flang-compiler/f18@19813349aa19222974f7cb92b98a1b38407cdaf7
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#177 from flang-compiler/tsk1
Tim Keith [Mon, 10 Sep 2018 22:37:43 +0000 (15:37 -0700)]
[flang] Merge pull request flang-compiler/f18#177 from flang-compiler/tsk1

Write private symbols to .mod files

Original-commit: flang-compiler/f18@f325e8b765278bca5626def839cfb07d5662f261
Reviewed-on: https://github.com/flang-compiler/f18/pull/177

5 years ago[flang] Miscellaneous name resolution
Tim Keith [Mon, 10 Sep 2018 19:20:42 +0000 (12:20 -0700)]
[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@79ad96b976c495dcc836267bd08276c4a6be8bb4
Reviewed-on: https://github.com/flang-compiler/f18/pull/177

5 years ago[flang] Write private symbols to .mod files
Tim Keith [Fri, 7 Sep 2018 22:39:20 +0000 (15:39 -0700)]
[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@33a10d6238c3b0062c43974114048ccc8cc1f450
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false

5 years ago[flang] Ensure use of ObjectEntityDetails for data objects
Tim Keith [Fri, 7 Sep 2018 16:48:40 +0000 (09:48 -0700)]
[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@0effecd2252488455b1d2f0c86dc3dc00d37f483
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false

5 years ago[flang] Code cleanup
Tim Keith [Thu, 6 Sep 2018 20:44:21 +0000 (13:44 -0700)]
[flang] Code cleanup

Rename stmtFuncsToConvert to stmtFuncsToConvert_.
Make member functions out-of-line.

Original-commit: flang-compiler/f18@3ada89d22f7fb79d7730a7498d89a96dbc9bffab
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false

5 years ago[flang] Fix bug in rewriting function calls
Tim Keith [Thu, 6 Sep 2018 20:31:45 +0000 (13:31 -0700)]
[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@841b37d94bc02f5a8726873fff7182cee053c8c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#175 from flang-compiler/tsk1
Tim Keith [Fri, 7 Sep 2018 16:08:05 +0000 (09:08 -0700)]
[flang] Merge pull request flang-compiler/f18#175 from flang-compiler/tsk1

More name resolution

Original-commit: flang-compiler/f18@804e7359134a6bf724d27085931608cc9297dbe0
Reviewed-on: https://github.com/flang-compiler/f18/pull/175

5 years ago[flang] Address review comments
Tim Keith [Fri, 7 Sep 2018 16:06:27 +0000 (09:06 -0700)]
[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@dd42dcd15a634c629168c5fcb767c09184f000f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/175

5 years ago[flang] Add procedure pointer components for derived types
Tim Keith [Thu, 6 Sep 2018 19:06:32 +0000 (12:06 -0700)]
[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@789960bd95d1a4c24650ff14950cb9faaa13c6aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false

5 years ago[flang] More derived type name resolution
Tim Keith [Thu, 6 Sep 2018 15:01:49 +0000 (08:01 -0700)]
[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@f29d6207140bb818442b2d5cb7de067a34082b61
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false

5 years ago[flang] Improve dumping of enums in parse tree
Tim Keith [Wed, 5 Sep 2018 20:44:22 +0000 (13:44 -0700)]
[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@57bd4f3af945d9416ef8b302fdad7400e76d54b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#173 from flang-compiler/tsk1
Tim Keith [Wed, 5 Sep 2018 23:04:12 +0000 (16:04 -0700)]
[flang] Merge pull request flang-compiler/f18#173 from flang-compiler/tsk1

More name resolution for derived types

Original-commit: flang-compiler/f18@c06230e9cc9a4ad15c2e6dac79db26461489e666
Reviewed-on: https://github.com/flang-compiler/f18/pull/173

5 years ago[flang] Address review comments
Tim Keith [Wed, 5 Sep 2018 23:02:41 +0000 (16:02 -0700)]
[flang] Address review comments

Original-commit: flang-compiler/f18@2ca329b85a3e6113f417dff25ba39898bd8869e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/173

5 years ago[flang] Resolve derived type parameters
Tim Keith [Tue, 4 Sep 2018 17:28:27 +0000 (10:28 -0700)]
[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@c15247bb30311e7166429a34db510cb8c736bd66
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false

5 years ago[flang] Move KindOrLen enum to common/fortran.h
Tim Keith [Tue, 4 Sep 2018 17:26:31 +0000 (10:26 -0700)]
[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@f734d754e49b45c8bcaf246f577b030e77413aa7
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false

5 years ago[flang] Resolve procedure bindings and final procedures in derived types
Tim Keith [Fri, 31 Aug 2018 23:20:00 +0000 (16:20 -0700)]
[flang] Resolve procedure bindings and final procedures in derived types

Add new kinds of symbol details: ProcBindingDetails, FinalProcDetails.
and GenericBindingDetails. The last is not yet implemented.
Write them to the .mod file.

Recognize DEFERRED and NON_OVERRIDABLE attributes. Enforce C783.

Resolve CLASS(t) similarly to resolution of TYPE(t).

Original-commit: flang-compiler/f18@0c0a9ab79eacd725900e4452ca352a46bec226a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false

5 years ago[flang] Change BeginAttrs to return true like BeginDecl
Tim Keith [Fri, 31 Aug 2018 22:15:28 +0000 (15:15 -0700)]
[flang] Change BeginAttrs to return true like BeginDecl

This is just for convenience. Any Pre function that calls BeginAttrs
must return true.

Original-commit: flang-compiler/f18@5a7bc11ba43f0e0d0dbdfe845f06c86274fde8ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false

5 years ago[flang] Small improvements to name resolution
Tim Keith [Wed, 29 Aug 2018 18:38:12 +0000 (11:38 -0700)]
[flang] Small improvements to name resolution

Resolve names and do implicit typing in ArrayElement and LoopBounds.

Fix problem with creation of UseErrorDetails: when a conflict occurs,
record both the original USE and the new one.

Resolve the type name in TypeAttrSpec::Extends. Move CheckUseError to
DeclarationVisitor so that it can be used in ResolveDerivedType.

Report error on unresolved names. I.e. after name resolution, check each
parser::Name and verify we have a Symbol for it. This is on by default
now but it could be an option.

Original-commit: flang-compiler/f18@1c8cbc6e53cc7e1b6909bbedf5370e27fd11572f
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false

5 years ago[flang] Small code cleanups
Tim Keith [Tue, 28 Aug 2018 21:02:53 +0000 (14:02 -0700)]
[flang] Small code cleanups

Use brace-initialization more consistently.
Use std::is_same_v instead of std::is_same and "if constexpr".

Original-commit: flang-compiler/f18@7f461faf9a8df16822a054ec4683f4387c6292e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#172 from flang-compiler/pmk1
Peter Klausler [Tue, 4 Sep 2018 19:05:33 +0000 (12:05 -0700)]
[flang] Merge pull request flang-compiler/f18#172 from flang-compiler/pmk1

Resolve two parsing ambiguities from sscalpone

Original-commit: flang-compiler/f18@17035bb78939da94e131ee55182532cd556eb060
Reviewed-on: https://github.com/flang-compiler/f18/pull/172

5 years ago[flang] Fix parsing ambiguity with pointer assignment statements
peter klausler [Tue, 4 Sep 2018 16:57:54 +0000 (09:57 -0700)]
[flang] Fix parsing ambiguity with pointer assignment statements

Original-commit: flang-compiler/f18@42eb1b140d40389e1ec13bdf87e4ff3a2b21ed2b
Reviewed-on: https://github.com/flang-compiler/f18/pull/172

5 years ago[flang] Fix parsing ambiguity: MODULESUBROUTINEFOO at top level
peter klausler [Tue, 4 Sep 2018 16:28:02 +0000 (09:28 -0700)]
[flang] Fix parsing ambiguity: MODULESUBROUTINEFOO at top level

Original-commit: flang-compiler/f18@cfda0945ea03245fd169d04b3b13ee3a4cbc3bc8
Reviewed-on: https://github.com/flang-compiler/f18/pull/172
Tree-same-pre-rewrite: false

5 years ago[flang] Better error recovery when END TYPE is expected but only END appears.
peter klausler [Tue, 4 Sep 2018 18:42:10 +0000 (11:42 -0700)]
[flang] Better error recovery when END TYPE is expected but only END appears.

Original-commit: flang-compiler/f18@7b70829d41dc2f1bcf28aa9337b077716943f062

5 years ago[flang] improve error recovery for missequenced IMPORT and IMPLICIT
peter klausler [Tue, 4 Sep 2018 18:13:47 +0000 (11:13 -0700)]
[flang] improve error recovery for missequenced IMPORT and IMPLICIT

Original-commit: flang-compiler/f18@a096fc86040ec8147261dc1c7decf5fc48709f69

5 years ago[flang] Merge pull request flang-compiler/f18#169 from flang-compiler/tsk1
Tim Keith [Tue, 28 Aug 2018 18:50:45 +0000 (11:50 -0700)]
[flang] Merge pull request flang-compiler/f18#169 from flang-compiler/tsk1

Add support for BLOCK construct

Original-commit: flang-compiler/f18@e9abdbc993482ceab2cc2831d65f5275bdee264b
Reviewed-on: https://github.com/flang-compiler/f18/pull/169

5 years ago[flang] Improve comments on class ImplicitRules
Tim Keith [Mon, 27 Aug 2018 20:32:10 +0000 (13:32 -0700)]
[flang] Improve comments on class ImplicitRules

Original-commit: flang-compiler/f18@926dc2bed10ebb96e7933e7a0d2a6f88f2541f68
Reviewed-on: https://github.com/flang-compiler/f18/pull/169

5 years ago[flang] Remove unused variable
Tim Keith [Mon, 27 Aug 2018 19:12:03 +0000 (12:12 -0700)]
[flang] Remove unused variable

Original-commit: flang-compiler/f18@05dc053442e7aa2a30f7d92d2a2025534f3935c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false

5 years ago[flang] Add support for BLOCK construct
Tim Keith [Mon, 27 Aug 2018 18:48:49 +0000 (11:48 -0700)]
[flang] Add support for BLOCK construct

A `BLOCK` statement opens a new scope. It is different from other scopes
in that implicitly typed entities are defined in the enclosing non-block
scope, not immediately in the block. This means that `IMPORT` statements
can cause them to be hidden.

Check that blocks can't have `IMPLICIT` statements in them. It is simpler
for the parser not to deal with the different between a
specification-part and a block-specification-part.

Change `ImplicitRules` to have a parent that is consulted when there isn't
an answer in the current one. For an interface body that does not happen
but for all other nested scopes it does. This parent link eliminates the
need for the `implicitRules_` stack. Make `isImplicitNoneType_` and
`isImplicitNoneExternal_` optional: not set means look in parent.
Fixes flang-compiler/f18#71.

Remove `CurrNonTypeScope()` and put the logic in `Symbol::FindSymbol`.

Original-commit: flang-compiler/f18@a153a2ee33ff493df6d4fb5e20d99d302d76ab43
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#171 from flang-compiler/easdd2
Eric Schweitz [Tue, 28 Aug 2018 17:44:20 +0000 (10:44 -0700)]
[flang] Merge pull request flang-compiler/f18#171 from flang-compiler/easdd2

Design document for label resolution pass

Original-commit: flang-compiler/f18@3e97e7922ef059d28381ced326c19813cea356f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/171

5 years ago[flang] Add the detailed design for label resolution
Eric Schweitz [Tue, 28 Aug 2018 17:17:38 +0000 (10:17 -0700)]
[flang] Add the detailed design for label resolution

Original-commit: flang-compiler/f18@89c4b70b55082dc3c6518af4c37a0738bcbcee06
Reviewed-on: https://github.com/flang-compiler/f18/pull/171

5 years ago[flang] Merge pull request flang-compiler/f18#167 from flang-compiler/tsk1
Tim Keith [Thu, 23 Aug 2018 18:59:34 +0000 (11:59 -0700)]
[flang] Merge pull request flang-compiler/f18#167 from flang-compiler/tsk1

Implement host association and import statements

Original-commit: flang-compiler/f18@354a594b0b015e466dcaf7dca6d54151e1d0b144
Reviewed-on: https://github.com/flang-compiler/f18/pull/167

5 years ago[flang] Add common::ImportKind
Tim Keith [Thu, 23 Aug 2018 18:45:49 +0000 (11:45 -0700)]
[flang] Add common::ImportKind

Replace parser::ImportStmt::Kind and semantics::Scope::ImportKind with a
single enum class in common/fortran.h. This eliminates the need to map
between the parser enum and the semantics enum.

Original-commit: flang-compiler/f18@779a99314c69c44e5a76cd9bd3d1833b870ef348
Reviewed-on: https://github.com/flang-compiler/f18/pull/167

5 years ago[flang] Address review comments
Tim Keith [Thu, 23 Aug 2018 18:24:12 +0000 (11:24 -0700)]
[flang] Address review comments

Original-commit: flang-compiler/f18@c30cbc8158c308902293877402554d052cbe2ac4
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Add another host-associate test
Tim Keith [Thu, 23 Aug 2018 14:41:06 +0000 (07:41 -0700)]
[flang] Add another host-associate test

Verify that a derived type component does not hide a type of the same
name in its host.

Original-commit: flang-compiler/f18@212d84cb2f555ae77fae6b5724266ea894250bd1
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Code cleanup
Tim Keith [Wed, 22 Aug 2018 23:56:57 +0000 (16:56 -0700)]
[flang] Code cleanup

`CurrScope()` is now a simple accessor with no logic, so rename to `currScope()`.

`PushScope()` doesn't need to return a `Scope&` and the other functions
with that name do not, so make it consistent.

Original-commit: flang-compiler/f18@c8c341be14b4e72e1787529e354648bef4ca4e0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Add missing copyrights.
Tim Keith [Wed, 22 Aug 2018 23:05:53 +0000 (16:05 -0700)]
[flang] Add missing copyrights.

Original-commit: flang-compiler/f18@a9346a588aa8031e4f74906f33934444503d7747
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Implement host association and import statements
Tim Keith [Wed, 22 Aug 2018 23:05:06 +0000 (16:05 -0700)]
[flang] Implement host association and import statements

Host association is done by search for symbols using `Scope::FindSymbol()`
which looks for the the name in the parent scope if the import rules
permit it.

Import statements are implemented using `importKind_` and `importNames_`
in class `Scope`. Most of the constraints are checked when the
`ImportStmt` is encountered. `CheckImports()` is called at the end of
the `SpecificationPart` to verify the names mentioned in the IMPORT
statement. That has to happen then so that we can detect if an imported
name is hidden by a declaration in the current scope.

Original-commit: flang-compiler/f18@0d50c8a8ba12692e6246c4e1a8a098f2850aba3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Replace scope stack with current scope
Tim Keith [Fri, 10 Aug 2018 00:12:31 +0000 (17:12 -0700)]
[flang] Replace scope stack with current scope

We don't need to manage a stack of scopes: each scope has a reference to
its parent, so popping the scope stack is equivalent to setting the
new current scope to the parent of the old current scope.

Original-commit: flang-compiler/f18@022aa7a7f9d09ee96db6ec9a025afb6bcf99cc55
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Collect names of internal subprograms of a MainProgram
Tim Keith [Thu, 9 Aug 2018 00:28:16 +0000 (17:28 -0700)]
[flang] Collect names of internal subprograms of a MainProgram

... as is done for other internal subprograms.

Original-commit: flang-compiler/f18@079f45d51b64bcee1197c65201dc66d14ee7c08c
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#166 from flang-compiler/pmk1
Peter Klausler [Thu, 9 Aug 2018 21:16:02 +0000 (14:16 -0700)]
[flang] Merge pull request flang-compiler/f18#166 from flang-compiler/pmk1

fix sloppy merge (sorry)

Original-commit: flang-compiler/f18@c3957893cbcfc9e00e9f184b4c9bf3251796f5a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/166

5 years ago[flang] fix sloppy merge (sorry)
peter klausler [Thu, 9 Aug 2018 20:09:33 +0000 (13:09 -0700)]
[flang] fix sloppy merge (sorry)

Original-commit: flang-compiler/f18@b475721e09969cc5ac287159dbb6e342ce89fa9d
Reviewed-on: https://github.com/flang-compiler/f18/pull/166

5 years ago[flang] Merge pull request flang-compiler/f18#165 from flang-compiler/pmk0
Peter Klausler [Thu, 9 Aug 2018 19:50:15 +0000 (12:50 -0700)]
[flang] Merge pull request flang-compiler/f18#165 from flang-compiler/pmk0

Expression analysis and message clean-up

Original-commit: flang-compiler/f18@9fa1c429f164500c83af35b55d89324fd67e7e46
Reviewed-on: https://github.com/flang-compiler/f18/pull/165

5 years ago[flang] Canonicalize nonstandard BOZ literals to avoid spurious parse/unparse/reparse...
peter klausler [Wed, 8 Aug 2018 23:41:44 +0000 (16:41 -0700)]
[flang] Canonicalize nonstandard BOZ literals to avoid spurious parse/unparse/reparse/unparse failures.

Original-commit: flang-compiler/f18@d651990632d1cd52ece98de00689a4bfebeb4af0
Reviewed-on: https://github.com/flang-compiler/f18/pull/165

5 years ago[flang] More expression analysis of literal constants.
peter klausler [Wed, 8 Aug 2018 23:30:58 +0000 (16:30 -0700)]
[flang] More expression analysis of literal constants.

Original-commit: flang-compiler/f18@3c89dace19fe5585d738fe36fa75fea98e541837
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false

5 years ago[flang] Add data to a new formatted message.
peter klausler [Wed, 8 Aug 2018 18:37:40 +0000 (11:37 -0700)]
[flang] Add data to a new formatted message.

Original-commit: flang-compiler/f18@04b1ae9e68cb5e21393e834229bb6964169fee29
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false

5 years ago[flang] Clean up messaging: make Say() member function templates more flexible, hide...
peter klausler [Wed, 8 Aug 2018 18:29:05 +0000 (11:29 -0700)]
[flang] Clean up messaging: make Say() member function templates more flexible, hide MessageFormattedText instances

Original-commit: flang-compiler/f18@59d774382f859acd06341a1d407b4e2fe7c975f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false

5 years ago[flang] Expression analysis
peter klausler [Tue, 7 Aug 2018 19:34:09 +0000 (12:34 -0700)]
[flang] Expression analysis

Original-commit: flang-compiler/f18@6b5e23ba28943f510a23a47daeb43d3a5dff72c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#164 from flang-compiler/tsk9
Tim Keith [Thu, 9 Aug 2018 17:13:13 +0000 (10:13 -0700)]
[flang] Merge pull request flang-compiler/f18#164 from flang-compiler/tsk9

Module file improvements

Original-commit: flang-compiler/f18@61598b59b83125d309eb0db83d32706d64fe785b
Reviewed-on: https://github.com/flang-compiler/f18/pull/164

5 years ago[flang] Address review comments.
Tim Keith [Wed, 8 Aug 2018 21:52:45 +0000 (14:52 -0700)]
[flang] Address review comments.

Original-commit: flang-compiler/f18@797ea41e1772653f3b08f28d00fe4d7c1ff6fc96
Reviewed-on: https://github.com/flang-compiler/f18/pull/164

5 years ago[flang] Module file improvements
Tim Keith [Wed, 8 Aug 2018 18:36:24 +0000 (11:36 -0700)]
[flang] Module file improvements

Verify that checksums are correct when reading a module file.

Don't write a module file if its current contents are correct.

Don't make .mod files read-only. It doesn't do much to prevent
users from editing them, checksum verification will detect when
it happens, and having them read-only causes problems if you then
compile with another compiler (e.g. PGI).

Original-commit: flang-compiler/f18@21d82aef6e8836f4cc0736d4eb2b59abdfa6fbc0
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#162 from flang-compiler/pmk0
Peter Klausler [Mon, 6 Aug 2018 16:54:44 +0000 (09:54 -0700)]
[flang] Merge pull request flang-compiler/f18#162 from flang-compiler/pmk0

Roll up work on folding, descriptors, runtime, RESHAPE

Original-commit: flang-compiler/f18@967a334d72b1dac6107e609bf9130c1dcd4e609d
Reviewed-on: https://github.com/flang-compiler/f18/pull/162

5 years ago[flang] address review comments
peter klausler [Mon, 6 Aug 2018 16:43:43 +0000 (09:43 -0700)]
[flang] address review comments

Original-commit: flang-compiler/f18@a98942e396bc035aa1f1f886a271458b6ad0c63f
Reviewed-on: https://github.com/flang-compiler/f18/pull/162

5 years ago[flang] Remove defined assignments from runtime representation.
peter klausler [Fri, 3 Aug 2018 23:55:36 +0000 (16:55 -0700)]
[flang] Remove defined assignments from runtime representation.

Original-commit: flang-compiler/f18@720e71c5db1fe728ed6f613c2502c4e60516e050
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] Rename some NaNs.
peter klausler [Fri, 3 Aug 2018 23:02:05 +0000 (16:02 -0700)]
[flang] Rename some NaNs.

Original-commit: flang-compiler/f18@34eac17ddc11e83991e80ffe4f4937382ce07674
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] clean up g++ 8.2.0 build warnings
peter klausler [Fri, 3 Aug 2018 22:18:04 +0000 (15:18 -0700)]
[flang] clean up g++ 8.2.0 build warnings

Original-commit: flang-compiler/f18@0c946bef66c2d3d56c55cf700c0eb6335a7ffbad
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] test and debug RESHAPE
peter klausler [Fri, 3 Aug 2018 00:04:31 +0000 (17:04 -0700)]
[flang] test and debug RESHAPE

Original-commit: flang-compiler/f18@c20ce350c1ecd4a41705445395cca50848bc57df
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] Implement and test RESHAPE. Avoid G++ workaround when compiled with GNU...
peter klausler [Thu, 2 Aug 2018 18:45:11 +0000 (11:45 -0700)]
[flang] Implement and test RESHAPE.  Avoid G++ workaround when compiled with GNU 8.2.0.

Original-commit: flang-compiler/f18@80257ee0d2747796675e21975849125b0c0a6f4e
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] Move descriptor flags into addendum.
peter klausler [Wed, 1 Aug 2018 17:55:46 +0000 (10:55 -0700)]
[flang] Move descriptor flags into addendum.

Original-commit: flang-compiler/f18@f5839874efe072cdb6b542f7a156d5d4b0785d08
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] Use a common enum class in evaluate and runtime for type category.
peter klausler [Wed, 1 Aug 2018 16:45:59 +0000 (09:45 -0700)]
[flang] Use a common enum class in evaluate and runtime for type category.

Original-commit: flang-compiler/f18@5012e652af7dd7d053612f9d27069e90e3fb878e
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] break up runtime into multiple headers and source files
peter klausler [Tue, 31 Jul 2018 23:46:30 +0000 (16:46 -0700)]
[flang] break up runtime into multiple headers and source files

Original-commit: flang-compiler/f18@7863350552490d873383c8c7b5877778f28599f6
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] more descriptor work
peter klausler [Fri, 27 Jul 2018 23:52:17 +0000 (16:52 -0700)]
[flang] more descriptor work

Original-commit: flang-compiler/f18@0ab17048ed042b1280729b2995b6140d843dccbe
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] comments
peter klausler [Fri, 27 Jul 2018 16:28:00 +0000 (09:28 -0700)]
[flang] comments

Original-commit: flang-compiler/f18@b4423e3b1c127854a6f391113e21bf32f0f94a30
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] checkpoint work on descriptors
peter klausler [Thu, 26 Jul 2018 23:07:50 +0000 (16:07 -0700)]
[flang] checkpoint work on descriptors

Original-commit: flang-compiler/f18@5e68ebea25c2c1bef73270bf8d43144cd9d59c9f
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] character folding
peter klausler [Wed, 25 Jul 2018 23:02:08 +0000 (16:02 -0700)]
[flang] character folding

Original-commit: flang-compiler/f18@5adc208bf28a10a42b013104309e4f03e854d5cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] complex and character comparisons
peter klausler [Wed, 25 Jul 2018 22:52:58 +0000 (15:52 -0700)]
[flang] complex and character comparisons

Original-commit: flang-compiler/f18@77ed88d24f8d53624abe6587cc1198e63cccb147
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] Use std::nullopt in place of empty braces in return statements.
peter klausler [Wed, 25 Jul 2018 22:13:40 +0000 (15:13 -0700)]
[flang] Use std::nullopt in place of empty braces in return statements.

Original-commit: flang-compiler/f18@90e556301c47c953e13900974dd5175d07bcc8ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] COMPLEX folding
peter klausler [Wed, 25 Jul 2018 22:02:21 +0000 (15:02 -0700)]
[flang] COMPLEX folding

Original-commit: flang-compiler/f18@6f1ef45b2f3172487281f071196c36e8afcf60cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] fold real**int
peter klausler [Wed, 25 Jul 2018 20:46:13 +0000 (13:46 -0700)]
[flang] fold real**int

Original-commit: flang-compiler/f18@2dc2c2a6a52d506d74354664015ae37645f11fa2
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#163 from flang-compiler/pmk1
Peter Klausler [Fri, 3 Aug 2018 23:23:23 +0000 (16:23 -0700)]
[flang] Merge pull request flang-compiler/f18#163 from flang-compiler/pmk1

Restore buildability with clang

Original-commit: flang-compiler/f18@65c88ddf0fca05d5bffd1bee2d4fd29fa5c03a57
Reviewed-on: https://github.com/flang-compiler/f18/pull/163

5 years ago[flang] Update README to reflect buildability with GCC 8.2.0.
peter klausler [Fri, 3 Aug 2018 23:11:29 +0000 (16:11 -0700)]
[flang] Update README to reflect buildability with GCC 8.2.0.

Original-commit: flang-compiler/f18@f64a9f5b824b5fdff886a0f136681b71ab1f21fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/163

5 years ago[flang] Add virtual IntExpr::~IntExpr to silence Clang warning about non-virtual...
peter klausler [Fri, 3 Aug 2018 23:07:58 +0000 (16:07 -0700)]
[flang] Add virtual IntExpr::~IntExpr to silence Clang warning about non-virtual dtor in a class with virtual functions.

Original-commit: flang-compiler/f18@b024ba50e1020c05a1bbf63e997e09a2e20d54b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#161 from flang-compiler/pmk1
Peter Klausler [Fri, 3 Aug 2018 22:29:13 +0000 (15:29 -0700)]
[flang] Merge pull request flang-compiler/f18#161 from flang-compiler/pmk1

issue#159 - better error messages in face of garbled source that resembles Hollerith

Original-commit: flang-compiler/f18@5aedd0d72c5f6352fc40f1a1993f822b4a5f8627
Reviewed-on: https://github.com/flang-compiler/f18/pull/161

5 years ago[flang] Make prescanner tokenization message re: Hollerith truncation a warning,...
peter klausler [Fri, 3 Aug 2018 21:00:36 +0000 (14:00 -0700)]
[flang] Make prescanner tokenization message re: Hollerith truncation a warning, so parser get a shot at it.  Merge messages from failed parsing alternatives more informatively.

Original-commit: flang-compiler/f18@16ed01d8f372c6c64341dd793b454e37581fa83d
Reviewed-on: https://github.com/flang-compiler/f18/pull/161

5 years ago[flang] Merge pull request flang-compiler/f18#160 from flang-compiler/tsk9
Tim Keith [Fri, 3 Aug 2018 18:33:14 +0000 (11:33 -0700)]
[flang] Merge pull request flang-compiler/f18#160 from flang-compiler/tsk9

 Add support for submodules

Original-commit: flang-compiler/f18@79f3632fc2268db4334c79519a81010263c84854
Reviewed-on: https://github.com/flang-compiler/f18/pull/160

5 years ago[flang] Changes based on review comments
Tim Keith [Fri, 3 Aug 2018 18:32:21 +0000 (11:32 -0700)]
[flang] Changes based on review comments

Original-commit: flang-compiler/f18@fc4c0c39d528078afdd777b59a4d13eade08d348
Reviewed-on: https://github.com/flang-compiler/f18/pull/160

5 years ago[flang] Make module files read-only.
Tim Keith [Thu, 2 Aug 2018 23:38:36 +0000 (16:38 -0700)]
[flang] Make module files read-only.

Original-commit: flang-compiler/f18@c7752ab5fb8736991634ee068fdda59f1af28e71
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
Tree-same-pre-rewrite: false

5 years ago[flang] Add support for submodules
Tim Keith [Thu, 2 Aug 2018 23:21:27 +0000 (16:21 -0700)]
[flang] Add support for submodules

Symbols for submodules have `ModuleDetails` with `isSubmodule` set.
Scopes for submodules have `Module` kind and have a parent scope that
is also `Module` kind.

Scopes for modules now contain a mapping of submodule name to scope
so that we can find them without having to search the scope tree or
re-read their `.mod` file.

The module file for submodule `s` with ancestor module `m` is named `m-s.mod`.
The tree structure of scopes means module file writing is now recursive.
Similarly, reading the module file for a submodule may require reading
the module files of its parent and ancestor. `ResolveNames` now requires
the parent scope to be passed in -- it is not always the global scope.

`test_modfiles.sh` now handles an argument that is a filename glob so
that the test can involve multiple files. This allows `modfile09` to
test reading of `.mod` files for modules and submodules.

Original-commit: flang-compiler/f18@2e4424dbc8cc5803d561274dbf70005afe7e65dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
Tree-same-pre-rewrite: false

5 years ago[flang] Refactor to remove move semantics for Details
Tim Keith [Sat, 28 Jul 2018 21:10:34 +0000 (14:10 -0700)]
[flang] Refactor to remove move semantics for Details

The classes in the Details union don't own resources so it makes things
simpler to copy them instead of moving. Same with ProcInterface.

Original-commit: flang-compiler/f18@d9ee19cbc4a8506ab1c34af22a096314782a3354
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#156 from flang-compiler/pmk1
Peter Klausler [Tue, 31 Jul 2018 19:35:42 +0000 (12:35 -0700)]
[flang] Merge pull request flang-compiler/f18#156 from flang-compiler/pmk1

Better program unit END statement error recovery.

Original-commit: flang-compiler/f18@902054b88393d249e1899e932c5111ade1a59862
Reviewed-on: https://github.com/flang-compiler/f18/pull/156

6 years ago[flang] Clean up end-of-statement error recovery. And fix issue#157.
peter klausler [Tue, 31 Jul 2018 19:32:09 +0000 (12:32 -0700)]
[flang] Clean up end-of-statement error recovery.  And fix issue#157.

Original-commit: flang-compiler/f18@23d8368571d0d2caa913d2508d5f6c53306452b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/156

6 years ago[flang] Even better program unit END statement error recovery.
peter klausler [Mon, 30 Jul 2018 23:33:55 +0000 (16:33 -0700)]
[flang] Even better program unit END statement error recovery.

Original-commit: flang-compiler/f18@31f456ebc5c7ec1040776ac234f75c344021193f
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
Tree-same-pre-rewrite: false

6 years ago[flang] better program unit END statement error recovery
peter klausler [Mon, 30 Jul 2018 22:31:06 +0000 (15:31 -0700)]
[flang] better program unit END statement error recovery

Original-commit: flang-compiler/f18@62799c88ff86bfa5d193e8efff20c26d3093a016
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#155 from flang-compiler/pmk1
Peter Klausler [Mon, 30 Jul 2018 22:12:22 +0000 (15:12 -0700)]
[flang] Merge pull request flang-compiler/f18#155 from flang-compiler/pmk1

issue#153

Original-commit: flang-compiler/f18@bcac43a2c134d4900c7e2bf90de3e441a0e02cbd
Reviewed-on: https://github.com/flang-compiler/f18/pull/155

6 years ago[flang] issue#153
peter klausler [Mon, 30 Jul 2018 20:35:01 +0000 (13:35 -0700)]
[flang] issue#153

Original-commit: flang-compiler/f18@64272abddd887d1559f5f8ea53d78c9352fccb24
Reviewed-on: https://github.com/flang-compiler/f18/pull/155

6 years ago[flang] Merge pull request flang-compiler/f18#154 from flang-compiler/pmk2
Peter Klausler [Mon, 30 Jul 2018 20:55:19 +0000 (13:55 -0700)]
[flang] Merge pull request flang-compiler/f18#154 from flang-compiler/pmk2

issue#152 and a little clean-up

Original-commit: flang-compiler/f18@220c6eb2c88cab9a1dc1d2cfe9a01272c4681836
Reviewed-on: https://github.com/flang-compiler/f18/pull/154

6 years ago[flang] issue#152 and a little clean-up
peter klausler [Mon, 30 Jul 2018 19:56:58 +0000 (12:56 -0700)]
[flang] issue#152 and a little clean-up

Original-commit: flang-compiler/f18@54d74dc1e81b1c22c76c47fd245284fbb88fec54
Reviewed-on: https://github.com/flang-compiler/f18/pull/154

6 years ago[flang] Merge pull request flang-compiler/f18#151 from flang-compiler/pmk1
Peter Klausler [Mon, 30 Jul 2018 18:38:54 +0000 (11:38 -0700)]
[flang] Merge pull request flang-compiler/f18#151 from flang-compiler/pmk1

Tweaks to source provenance and messaging in support of module files

Original-commit: flang-compiler/f18@21bb12c9d6712e332939b334caeed9bb0d040c24
Reviewed-on: https://github.com/flang-compiler/f18/pull/151

6 years ago[flang] Use std::nullopt rather than {}.
peter klausler [Mon, 30 Jul 2018 18:08:22 +0000 (11:08 -0700)]
[flang] Use std::nullopt rather than {}.

Original-commit: flang-compiler/f18@9a740acf8346de10c0dda34ba2706980f9643802
Reviewed-on: https://github.com/flang-compiler/f18/pull/151

6 years ago[flang] address review comments
peter klausler [Sat, 28 Jul 2018 00:06:55 +0000 (17:06 -0700)]
[flang] address review comments

Original-commit: flang-compiler/f18@a18aba21fd74fd34debee09a3d566b86d8749f76
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false

6 years ago[flang] add isModuleFile flag to parser::Options, use it
peter klausler [Fri, 27 Jul 2018 22:18:36 +0000 (15:18 -0700)]
[flang] add isModuleFile flag to parser::Options, use it

Original-commit: flang-compiler/f18@0727140f53cadad7740e524fd9300a1ca8b12044
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false