platform/upstream/llvm.git
5 years ago[flang] Improve detection of default Handle() callback
peter klausler [Wed, 6 Mar 2019 17:11:17 +0000 (09:11 -0800)]
[flang] Improve detection of default Handle() callback

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

5 years ago[flang] some tweaks
peter klausler [Wed, 6 Mar 2019 01:11:05 +0000 (17:11 -0800)]
[flang] some tweaks

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

5 years ago[flang] Add Expression traversal framework, use it to reimplement IsConstantExpr()
peter klausler [Wed, 6 Mar 2019 00:57:18 +0000 (16:57 -0800)]
[flang] Add Expression traversal framework, use it to reimplement IsConstantExpr()

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

5 years ago[flang] Merge pull request flang-compiler/f18#315 from flang-compiler/tsk10
Tim Keith [Thu, 7 Mar 2019 00:11:19 +0000 (16:11 -0800)]
[flang] Merge pull request flang-compiler/f18#315 from flang-compiler/tsk10

Create framework for checking statement semantics

Original-commit: flang-compiler/f18@0fcdb68061b8d008d22e0cc0ff4ccdbb40ab8f44
Reviewed-on: https://github.com/flang-compiler/f18/pull/315

5 years ago[flang] Move ExprChecker into separate pass
Tim Keith [Wed, 6 Mar 2019 22:15:13 +0000 (14:15 -0800)]
[flang] Move ExprChecker into separate pass

DoConcurrentChecker depends on expressions being fully resolved so it
can't be in the same pass as ExprChecker. The same will probably
apply to AssignmentChecker when its finished.

Checks that don't depend on expressions can go in the first pass
with ExprChecker.

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

5 years ago[flang] Add test for AssignmentChecker
Tim Keith [Wed, 6 Mar 2019 22:12:20 +0000 (14:12 -0800)]
[flang] Add test for AssignmentChecker

Add a test to verify that AssignmentChecker is actually running.

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

5 years ago[flang] Create framework for checking statement semantics
Tim Keith [Wed, 6 Mar 2019 00:52:50 +0000 (16:52 -0800)]
[flang] Create framework for checking statement semantics

Add `SemanticsVisitor` as the visitor class to perform statement
semantics checks. Its template parameters are "checker" classes
that perform the checks. They have `Enter` and `Leave` functions
that are called for the corresponding parse tree nodes (`Enter`
before the children, `Leave` after). Unlike `Pre` and `Post` in
visitors they cannot prevent the parse tree walker from visiting
child nodes.

Existing checks have been incorporated into this framework:
- `ExprChecker` replaces `AnalyzeExpressions()`
- `AssignmentChecker` replaces `AnalyzeAssignments()`
- `DoConcurrentChecker` replaces `CheckDoConcurrentConstraints()`

Adding a new checker requires:
- defining the checker class:
  - with BaseChecker as virtual base class
  - constructible from `SemanticsContext`
  - with Enter/Leave functions for nodes of interest
- add the checker class to the template parameters of `StatementSemantics`

Because these checkers and also `ResolveNamesVisitor` require tracking
the current statement source location, that has been moved into
`SemanticsContext`. `ResolveNamesVisitor` and `SemanticsVisitor`
update the location when `Statement` nodes are encountered, making it
available for error messages.

`AnalyzeKindSelector()` now has access to the current statement through
the context and so no longer needs to have it passed in.

Test `assign01.f90` was added to verify that `AssignmentChecker` is
actually doing something.

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

5 years ago[flang] Merge pull request flang-compiler/f18#311 from flang-compiler/pmk-struct...
Peter Klausler [Tue, 5 Mar 2019 22:40:50 +0000 (14:40 -0800)]
[flang] Merge pull request flang-compiler/f18#311 from flang-compiler/pmk-struct-checks

More structure constructor semantics checking

Original-commit: flang-compiler/f18@5561c9012c07c21cd043b0b0b8b2a03d6e42bebe
Reviewed-on: https://github.com/flang-compiler/f18/pull/311

5 years ago[flang] Tweak API per review
peter klausler [Tue, 5 Mar 2019 21:11:57 +0000 (13:11 -0800)]
[flang] Tweak API per review

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

5 years ago[flang] Use value()/has_value() on Indirection class templates instead of operator...
peter klausler [Tue, 5 Mar 2019 20:28:08 +0000 (12:28 -0800)]
[flang] Use value()/has_value() on Indirection class templates instead of operator*/operator->

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

5 years ago[flang] Dodge bogus G++ 8.1.0 build warning
peter klausler [Tue, 5 Mar 2019 01:02:48 +0000 (17:02 -0800)]
[flang] Dodge bogus G++ 8.1.0 build warning

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

5 years ago[flang] Improve error messages
peter klausler [Tue, 5 Mar 2019 00:28:35 +0000 (16:28 -0800)]
[flang] Improve error messages

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

5 years ago[flang] Add lib/semantics/tools.{h,cc}
peter klausler [Mon, 4 Mar 2019 18:13:12 +0000 (10:13 -0800)]
[flang] Add lib/semantics/tools.{h,cc}

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

5 years ago[flang] C1594 constraint checking on pointer components in struct constructors
peter klausler [Sat, 2 Mar 2019 01:33:20 +0000 (17:33 -0800)]
[flang] C1594 constraint checking on pointer components in struct constructors

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

5 years ago[flang] Length conversions in array constructors, and fix their formatting
peter klausler [Fri, 1 Mar 2019 00:30:55 +0000 (16:30 -0800)]
[flang] Length conversions in array constructors, and fix their formatting

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

5 years ago[flang] Character length conversion on structure constructor component assignments
peter klausler [Thu, 28 Feb 2019 21:31:34 +0000 (13:31 -0800)]
[flang] Character length conversion on structure constructor component assignments

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

5 years ago[flang] Add SetLength operator to make character length changes explicit
peter klausler [Wed, 27 Feb 2019 23:51:03 +0000 (15:51 -0800)]
[flang] Add SetLength operator to make character length changes explicit

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

5 years ago[flang] snapshot of work in progress
peter klausler [Thu, 21 Feb 2019 20:10:07 +0000 (12:10 -0800)]
[flang] snapshot of work in progress

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

5 years ago[flang] Represent NULL()
peter klausler [Wed, 20 Feb 2019 01:06:28 +0000 (17:06 -0800)]
[flang] Represent NULL()

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

5 years ago[flang] Type checking on values in structure components
peter klausler [Tue, 19 Feb 2019 23:38:55 +0000 (15:38 -0800)]
[flang] Type checking on values in structure components

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

5 years ago[flang] Merge pull request flang-compiler/f18#314 from flang-compiler/pmk-indirection
Peter Klausler [Tue, 5 Mar 2019 00:29:48 +0000 (16:29 -0800)]
[flang] Merge pull request flang-compiler/f18#314 from flang-compiler/pmk-indirection

Add `ForwardReference<>` class template

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

5 years ago[flang] Add ForwardReference<> + documentation + clean-up
peter klausler [Mon, 4 Mar 2019 23:15:08 +0000 (15:15 -0800)]
[flang] Add ForwardReference<> + documentation + clean-up

Original-commit: flang-compiler/f18@09e9501951499625fdabdc04f3bcf7ae85b37467
Reviewed-on: https://github.com/flang-compiler/f18/pull/314

5 years ago[flang] checkpoint
peter klausler [Mon, 4 Mar 2019 21:42:00 +0000 (13:42 -0800)]
[flang] checkpoint

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

5 years ago[flang] Merge pull request flang-compiler/f18#313 from flang-compiler/pmk-fix312
Peter Klausler [Mon, 4 Mar 2019 21:46:24 +0000 (13:46 -0800)]
[flang] Merge pull request flang-compiler/f18#313 from flang-compiler/pmk-fix312

Fix flang-compiler/f18#312

Original-commit: flang-compiler/f18@74a9426adf29b21a0971f6db224efbd77da989af
Reviewed-on: https://github.com/flang-compiler/f18/pull/313

5 years ago[flang] Fix a typo in documentation
peter klausler [Mon, 4 Mar 2019 21:44:59 +0000 (13:44 -0800)]
[flang] Fix a typo in documentation

Original-commit: flang-compiler/f18@3248ec1cf93a18a7172eaeb90688de9fae4ab753
Reviewed-on: https://github.com/flang-compiler/f18/pull/313

5 years ago[flang] Fix accidentally modified comment
peter klausler [Mon, 4 Mar 2019 21:44:04 +0000 (13:44 -0800)]
[flang] Fix accidentally modified comment

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

5 years ago[flang] check out with all versions
peter klausler [Mon, 4 Mar 2019 19:55:10 +0000 (11:55 -0800)]
[flang] check out with all versions

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

5 years ago[flang] Fix flang-compiler/f18#312
peter klausler [Mon, 4 Mar 2019 19:23:50 +0000 (11:23 -0800)]
[flang] Fix flang-compiler/f18#312

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

5 years ago[flang] Merge pull request flang-compiler/f18#310 from flang-compiler/psteinfeld
psteinfeld [Fri, 1 Mar 2019 19:06:20 +0000 (11:06 -0800)]
[flang] Merge pull request flang-compiler/f18#310 from flang-compiler/psteinfeld

Fixed reference to a header file

Original-commit: flang-compiler/f18@658bc758d7c4bcea7ffbf06968a2faa3f4c8a124
Reviewed-on: https://github.com/flang-compiler/f18/pull/310

5 years ago[flang] Fixed reference to a header file
Peter Steinfeld [Fri, 1 Mar 2019 18:28:17 +0000 (10:28 -0800)]
[flang] Fixed reference to a header file

Original-commit: flang-compiler/f18@22f93f0b307384ebe022aa300771fef40039c11e
Reviewed-on: https://github.com/flang-compiler/f18/pull/310

5 years ago[flang] Merge pull request flang-compiler/f18#308 from flang-compiler/pmk-cleanups
Peter Klausler [Thu, 28 Feb 2019 20:04:50 +0000 (12:04 -0800)]
[flang] Merge pull request flang-compiler/f18#308 from flang-compiler/pmk-cleanups

Rename to Fortran.h, update style guide, run clang-format on everything

Original-commit: flang-compiler/f18@0cf07c3ace6b713f8ec0fb348af99a4ef04dd9e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/308

5 years ago[flang] Missed a fortran.h instance
peter klausler [Thu, 28 Feb 2019 19:47:33 +0000 (11:47 -0800)]
[flang] Missed a fortran.h instance

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

5 years ago[flang] Rename to Fortran.h, update style guide, run clang-format
peter klausler [Thu, 28 Feb 2019 18:48:41 +0000 (10:48 -0800)]
[flang] Rename to Fortran.h, update style guide, run clang-format

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

5 years ago[flang] Merge pull request flang-compiler/f18#309 from flang-compiler/tsk2c
Tim Keith [Thu, 28 Feb 2019 19:06:32 +0000 (11:06 -0800)]
[flang] Merge pull request flang-compiler/f18#309 from flang-compiler/tsk2c

Fix bug in test_modfile.sh

Original-commit: flang-compiler/f18@6e95724f0e2efda36c0efc16d7f6bfde90975a00
Reviewed-on: https://github.com/flang-compiler/f18/pull/309

5 years ago[flang] Fix bug in test_modfile.sh
Tim Keith [Thu, 28 Feb 2019 19:05:49 +0000 (11:05 -0800)]
[flang] Fix bug in test_modfile.sh

The expected mod files specified in the test do not necessarily
appear in sorted order, and the desired order depends on what the
`comm` command expects. So sort them to be sure it is right.

Original-commit: flang-compiler/f18@730d0d0562dd0a4eabfde020fef9fe371d401ff5
Reviewed-on: https://github.com/flang-compiler/f18/pull/309

5 years ago[flang] Merge pull request flang-compiler/f18#305 from flang-compiler/tsk2
Tim Keith [Thu, 28 Feb 2019 18:38:17 +0000 (10:38 -0800)]
[flang] Merge pull request flang-compiler/f18#305 from flang-compiler/tsk2

Various name resolution bug fixes

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

5 years ago[flang] Fix bug handling function prefix type
Tim Keith [Thu, 28 Feb 2019 17:53:49 +0000 (09:53 -0800)]
[flang] Fix bug handling function prefix type

This showed up in procinterface01. A function can have more than one
PrefixSpec (e.g. `real elemental f()`). We need to ignore that ones
that aren't types.

Also, process the type after the ImplicitPart rather than after the
SpecificationPart. The type of the function result variable could
be accessed between those places.

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

5 years ago[flang] Fix bug with host-association in module procedure interface body
Tim Keith [Tue, 26 Feb 2019 22:52:39 +0000 (14:52 -0800)]
[flang] Fix bug with host-association in module procedure interface body

A module procedure interface body can access entities in its host
without an IMPORT statement. So the `ImportKind` of the scope created
for such an interface body should be `Default`, not `None` as it is
for other interface bodies.

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

5 years ago[flang] Allow module procedure and generic with same name
Tim Keith [Tue, 26 Feb 2019 21:28:53 +0000 (13:28 -0800)]
[flang] Allow module procedure and generic with same name

The `GenericDetails::CheckSpecific()` check was happening too early.
We have to wait until all procedures of the generic have been seen.
The generic can have the same name as a module procedure only if that
module procedure is a specific procedure of the generic.

Improve the `SayAlreadyDeclared` error message when the previous
declaration is a use-association

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

5 years ago[flang] Fix .mod file for symbols with same name as generic
Tim Keith [Tue, 26 Feb 2019 21:08:59 +0000 (13:08 -0800)]
[flang] Fix .mod file for symbols with same name as generic

When a generic has the same name as a module procedure or derived type,
the latter weren't being written to the `.mod` file. Fix that by calling
`PutSymbol()` on those symbols from the generic. Change `PutSymbol()` to
accept `Symbol *` to make that more convenient.

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

5 years ago[flang] Fix resolution of function prefix type
Tim Keith [Sun, 24 Feb 2019 18:05:43 +0000 (10:05 -0800)]
[flang] Fix resolution of function prefix type

When a function-stmt has a type in the prefix (`type(t) function f()`),
the type cannot be resolve until after processing the USE and IMPLICIT
statements. So save the parse-tree of the type and process it at the
end of the specification section.

Add `ProcessTypeSpec()` to handle the process of setting up to walk
a type spec, walking it, restoring the state, and returning the type
spec. We do this several other places too.

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

5 years ago[flang] Fix bug determining type of statement entity
Tim Keith [Fri, 22 Feb 2019 23:56:39 +0000 (15:56 -0800)]
[flang] Fix bug determining type of statement entity

A statement entity (`data-i-do-variable` or `ac-do-variable`) that
doesn't have a type specified gets the type it would have in the
enclosing scope. That means if there is a visible variable with the
same name, the statement entity gets its type. We were failing to
do that and just applying the implicit rules.

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

5 years ago[flang] Handle subprogram declaration after call
Tim Keith [Fri, 22 Feb 2019 19:38:43 +0000 (11:38 -0800)]
[flang] Handle subprogram declaration after call

If an external subprogram is called and then declared, we have to
replace the `ProcEntityDetails` with `SubprogramDetails` in the symbol.
While doing so we can also check that the call was consistent with the
declaration for function vs. subprogram.

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

5 years ago[flang] Fix bug determining function vs. subroutine
Tim Keith [Thu, 21 Feb 2019 23:01:39 +0000 (15:01 -0800)]
[flang] Fix bug determining function vs. subroutine

We were setting `expectedProcFlag_` to indicate if a `ProcedureDesignator`
was used in a function or subroutine context. That didn't work if they
were nested, for example: `call f(g())`.

Instead, at the point we know function vs. subroutine (i.e. in the
`CallStmt` and `FunctionReference` nodes), explicitly walk the children,
passing in the flag.

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

5 years ago[flang] Merge pull request flang-compiler/f18#307 from flang-compiler/pmk-fixes
Peter Klausler [Thu, 28 Feb 2019 17:48:50 +0000 (09:48 -0800)]
[flang] Merge pull request flang-compiler/f18#307 from flang-compiler/pmk-fixes

fix flang-compiler/f18#303, better error recovery for misplaced type parameter declarat…

Original-commit: flang-compiler/f18@79684ed2ebd3d1a3670fad87de69f104305116cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/307

5 years ago[flang] fix flang-compiler/f18#303, better error recovery for misplaced type paramete...
peter klausler [Thu, 28 Feb 2019 01:03:40 +0000 (17:03 -0800)]
[flang] fix flang-compiler/f18#303, better error recovery for misplaced type parameter declarations

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

5 years ago[flang] Merge pull request flang-compiler/f18#306 from flang-compiler/pmk-documentation
Peter Klausler [Thu, 28 Feb 2019 17:30:27 +0000 (09:30 -0800)]
[flang] Merge pull request flang-compiler/f18#306 from flang-compiler/pmk-documentation

Small edits to C++17 usage notes

Original-commit: flang-compiler/f18@0e51862dd2646ee763d8f31628ba61f0621072ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/306

5 years ago[flang] Small edits to C++17 usage notes
peter klausler [Thu, 28 Feb 2019 00:00:37 +0000 (16:00 -0800)]
[flang] Small edits to C++17 usage notes

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

5 years ago[flang] Merge pull request flang-compiler/f18#294 from flang-compiler/ir2
Eric Schweitz [Thu, 28 Feb 2019 17:15:05 +0000 (09:15 -0800)]
[flang] Merge pull request flang-compiler/f18#294 from flang-compiler/ir2

Fortran IR: part 2, lowest layer of the IR hierarchy. Specifically, Basic Blocks

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

5 years ago[flang] address review comments
Eric Schweitz [Fri, 22 Feb 2019 23:38:57 +0000 (15:38 -0800)]
[flang] address review comments

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

5 years ago[flang] respond to review comments - part 2
Eric Schweitz [Thu, 21 Feb 2019 19:58:59 +0000 (11:58 -0800)]
[flang] respond to review comments - part 2

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

5 years ago[flang] Fortran IR: lowest layer of the IR hierarchy. Specifically, Basic Blocks
Eric Schweitz [Wed, 20 Feb 2019 20:12:17 +0000 (12:12 -0800)]
[flang] Fortran IR: lowest layer of the IR hierarchy. Specifically, Basic Blocks
contain Statements.  This layer is still evolving as the IR takes better
shape and other code in the compiler is written.

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

5 years ago[flang] Merge pull request flang-compiler/f18#293 from flang-compiler/ir1
Eric Schweitz [Thu, 28 Feb 2019 17:14:41 +0000 (09:14 -0800)]
[flang] Merge pull request flang-compiler/f18#293 from flang-compiler/ir1

Fortran IR: part 1. staged pull request for the "upper layers" of the IR.  The

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

5 years ago[flang] code review comments
Eric Schweitz [Fri, 22 Feb 2019 23:17:57 +0000 (15:17 -0800)]
[flang] code review comments

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

5 years ago[flang] Address review comments on part 1
Eric Schweitz [Thu, 21 Feb 2019 19:49:51 +0000 (11:49 -0800)]
[flang] Address review comments on part 1

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

5 years ago[flang] Fortran IR: staged pull request for the "upper layers" of the IR. The
Eric Schweitz [Wed, 20 Feb 2019 19:46:41 +0000 (11:46 -0800)]
[flang] Fortran IR: staged pull request for the "upper layers" of the IR.  The
Fortran IR is hierarchical: A Program contains Procedures.  Procedures
contain Basic Blocks. Groups of Basic Blocks can be grouped as Regions.
This structure follows those one finds in SIL and LLVM IR, etc.

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

5 years ago[flang] Merge pull request flang-compiler/f18#297 from flang-compiler/ir5
Eric Schweitz [Thu, 28 Feb 2019 16:57:09 +0000 (08:57 -0800)]
[flang] Merge pull request flang-compiler/f18#297 from flang-compiler/ir5

Fotran IR: part 5. Afforestation is the lowering of concrete parse trees

Original-commit: flang-compiler/f18@20da0d93e9c8d18ee44b4dfa4dff43c96576df45
Reviewed-on: https://github.com/flang-compiler/f18/pull/297

5 years ago[flang] changes per review comments
Eric Schweitz [Fri, 22 Feb 2019 23:51:44 +0000 (15:51 -0800)]
[flang] changes per review comments

Original-commit: flang-compiler/f18@3868f0c934d8ca8c19d567e011bdcc7c652a7ad9
Reviewed-on: https://github.com/flang-compiler/f18/pull/297

5 years ago[flang] address code review for part 5
Eric Schweitz [Thu, 21 Feb 2019 21:13:16 +0000 (13:13 -0800)]
[flang] address code review for part 5

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

5 years ago[flang] Fotran IR: part 5. Afforestation is the lowering of concrete parse trees
Eric Schweitz [Wed, 20 Feb 2019 21:10:38 +0000 (13:10 -0800)]
[flang] Fotran IR: part 5. Afforestation is the lowering of concrete parse trees
and semantics information into the Fortran IR.

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

5 years ago[flang] Merge pull request flang-compiler/f18#296 from flang-compiler/ir4
Eric Schweitz [Thu, 28 Feb 2019 16:52:37 +0000 (08:52 -0800)]
[flang] Merge pull request flang-compiler/f18#296 from flang-compiler/ir4

Fortran IR: part 4. Dotty graph visualization and other miscellaneous

Original-commit: flang-compiler/f18@6277e67c2770f26e288707bbaddf17aa022872b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/296

5 years ago[flang] address review comments
Eric Schweitz [Fri, 22 Feb 2019 23:48:45 +0000 (15:48 -0800)]
[flang] address review comments

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

5 years ago[flang] address review comments from part 4
Eric Schweitz [Thu, 21 Feb 2019 20:51:54 +0000 (12:51 -0800)]
[flang] address review comments from part 4

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

5 years ago[flang] Fortran IR: part 4. Dotty graph visualization and other miscellaneous
Eric Schweitz [Wed, 20 Feb 2019 21:07:49 +0000 (13:07 -0800)]
[flang] Fortran IR: part 4. Dotty graph visualization and other miscellaneous
headers.

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

5 years ago[flang] Merge pull request flang-compiler/f18#295 from flang-compiler/ir3
Eric Schweitz [Thu, 28 Feb 2019 16:36:31 +0000 (08:36 -0800)]
[flang] Merge pull request flang-compiler/f18#295 from flang-compiler/ir3

Fortran IR: part 3, the FIR builder.  This is a factory class for

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

5 years ago[flang] address review comments
Eric Schweitz [Fri, 22 Feb 2019 23:43:03 +0000 (15:43 -0800)]
[flang] address review comments

Original-commit: flang-compiler/f18@4dd4766f4d52319b6da47288134dd1b80aa425eb
Reviewed-on: https://github.com/flang-compiler/f18/pull/295

5 years ago[flang] respond to review comments for part 3
Eric Schweitz [Thu, 21 Feb 2019 20:05:26 +0000 (12:05 -0800)]
[flang] respond to review comments for part 3

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

5 years ago[flang] Fortran IR: part 3, the FIR builder. This is a factory class for
Eric Schweitz [Wed, 20 Feb 2019 20:18:04 +0000 (12:18 -0800)]
[flang] Fortran IR: part 3, the FIR builder.  This is a factory class for
helping to build a FIR representation.

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

5 years ago[flang] Merge pull request flang-compiler/f18#304 from flang-compiler/pmk-proc-interface
Peter Klausler [Wed, 27 Feb 2019 21:14:18 +0000 (13:14 -0800)]
[flang] Merge pull request flang-compiler/f18#304 from flang-compiler/pmk-proc-interface

Procedure(id) semantics

Original-commit: flang-compiler/f18@19151264445524e311b3b7734dae334697932e7d
Reviewed-on: https://github.com/flang-compiler/f18/pull/304

5 years ago[flang] unparse interfaces as PROCEDURE(TYPE(REAL)) to avoid ambiguity
peter klausler [Wed, 27 Feb 2019 20:30:57 +0000 (12:30 -0800)]
[flang] unparse interfaces as PROCEDURE(TYPE(REAL)) to avoid ambiguity

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

5 years ago[flang] address review comments
peter klausler [Wed, 27 Feb 2019 19:12:16 +0000 (11:12 -0800)]
[flang] address review comments

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

5 years ago[flang] prep for review
peter klausler [Wed, 27 Feb 2019 00:12:10 +0000 (16:12 -0800)]
[flang] prep for review

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

5 years ago[flang] rebasing
peter klausler [Wed, 27 Feb 2019 00:02:34 +0000 (16:02 -0800)]
[flang] rebasing

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

5 years ago[flang] Clean up DynamicType, link it to symbol table character length
peter klausler [Tue, 26 Feb 2019 23:59:25 +0000 (15:59 -0800)]
[flang] Clean up DynamicType, link it to symbol table character length

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

5 years ago[flang] checkpoint
peter klausler [Tue, 26 Feb 2019 22:26:28 +0000 (14:26 -0800)]
[flang] checkpoint

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

5 years ago[flang] checkpoint
peter klausler [Fri, 22 Feb 2019 23:45:30 +0000 (15:45 -0800)]
[flang] checkpoint

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

5 years ago[flang] checkpoint
peter klausler [Fri, 22 Feb 2019 01:05:46 +0000 (17:05 -0800)]
[flang] checkpoint

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

5 years ago[flang] Merge pull request flang-compiler/f18#301 from flang-compiler/psteinfeld
psteinfeld [Tue, 26 Feb 2019 21:56:05 +0000 (13:56 -0800)]
[flang] Merge pull request flang-compiler/f18#301 from flang-compiler/psteinfeld

Cleanup of the documentation directory

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

5 years ago[flang] Update ControlFlowGraph.md
psteinfeld [Mon, 25 Feb 2019 18:47:17 +0000 (10:47 -0800)]
[flang] Update ControlFlowGraph.md

Original-commit: flang-compiler/f18@50ce01185f708c3d80fd87579d28adc72dcf1555
Reviewed-on: https://github.com/flang-compiler/f18/pull/301

5 years ago[flang] Update C++style.md
psteinfeld [Mon, 25 Feb 2019 18:45:08 +0000 (10:45 -0800)]
[flang] Update C++style.md

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

5 years ago[flang] Update Overview.md
psteinfeld [Mon, 25 Feb 2019 18:38:55 +0000 (10:38 -0800)]
[flang] Update Overview.md

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

5 years ago[flang] Rename Mod-files.md to ModFiles.md
psteinfeld [Mon, 25 Feb 2019 18:27:50 +0000 (10:27 -0800)]
[flang] Rename Mod-files.md to ModFiles.md

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

5 years ago[flang] Update and rename Fortran-ir.md to FortranIR.md
psteinfeld [Mon, 25 Feb 2019 18:23:55 +0000 (10:23 -0800)]
[flang] Update and rename Fortran-ir.md to FortranIR.md

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

5 years ago[flang] Update README.md
psteinfeld [Mon, 25 Feb 2019 17:39:27 +0000 (09:39 -0800)]
[flang] Update README.md

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

5 years ago[flang] Rename semantics.md to Semantics.md
psteinfeld [Mon, 25 Feb 2019 16:10:47 +0000 (08:10 -0800)]
[flang] Rename semantics.md to Semantics.md

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

5 years ago[flang] Rename preprocessing.md to Preprocessing.md
psteinfeld [Mon, 25 Feb 2019 16:10:14 +0000 (08:10 -0800)]
[flang] Rename preprocessing.md to Preprocessing.md

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

5 years ago[flang] Rename parsing.md to Parsing.md
psteinfeld [Mon, 25 Feb 2019 16:09:46 +0000 (08:09 -0800)]
[flang] Rename parsing.md to Parsing.md

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

5 years ago[flang] Rename mod-files.md to Mod-files.md
psteinfeld [Mon, 25 Feb 2019 16:09:12 +0000 (08:09 -0800)]
[flang] Rename mod-files.md to Mod-files.md

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

5 years ago[flang] Rename intrinsics.md to Intrinsics.md
psteinfeld [Mon, 25 Feb 2019 16:08:43 +0000 (08:08 -0800)]
[flang] Rename intrinsics.md to Intrinsics.md

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

5 years ago[flang] Rename fortran-ir.md to Fortran-ir.md
psteinfeld [Mon, 25 Feb 2019 16:08:11 +0000 (08:08 -0800)]
[flang] Rename fortran-ir.md to Fortran-ir.md

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

5 years ago[flang] Rename extensions.md to Extensions.md
psteinfeld [Mon, 25 Feb 2019 16:07:27 +0000 (08:07 -0800)]
[flang] Rename extensions.md to Extensions.md

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

5 years ago[flang] Rename directives.md to Directives.md
psteinfeld [Mon, 25 Feb 2019 16:06:04 +0000 (08:06 -0800)]
[flang] Rename directives.md to Directives.md

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

5 years ago[flang] Merge pull request flang-compiler/f18#299 from flang-compiler/tsk1
Tim Keith [Fri, 22 Feb 2019 03:15:40 +0000 (19:15 -0800)]
[flang] Merge pull request flang-compiler/f18#299 from flang-compiler/tsk1

Fix build problem with clang

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

5 years ago[flang] Fix build problem with clang
Tim Keith [Fri, 22 Feb 2019 03:14:28 +0000 (19:14 -0800)]
[flang] Fix build problem with clang

Moving one of the `Pre(ImplicitStmt)` functions up to
`DeclarationVisitor` seemed to cause clang to complain that the `Pre`
call from the `Walk` function was ambiguous. So this change moves
it back to `ResolveNameVisitor`.

Also, remove an unused variable that was causing a warning.

Original-commit: flang-compiler/f18@766d000e2507d92b7774ad2c37732bafccc7cbcb
Reviewed-on: https://github.com/flang-compiler/f18/pull/299

5 years ago[flang] Merge pull request flang-compiler/f18#298 from flang-compiler/tsk2b
Tim Keith [Thu, 21 Feb 2019 22:52:24 +0000 (14:52 -0800)]
[flang] Merge pull request flang-compiler/f18#298 from flang-compiler/tsk2b

Implement SAVE, more work on COMMON and BIND

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

5 years ago[flang] Handle SAVE attribute and statement
Tim Keith [Thu, 21 Feb 2019 01:45:39 +0000 (17:45 -0800)]
[flang] Handle SAVE attribute and statement

As with COMMON blocks, we can't completely check SAVE statements and
attributes until the end of the specification part when we have seen
full declarations of entities. So when SAVE is specified, add it to one
of the two sets in `saveInfo_`. At the end of the specification part,
check that those entities can have SAVE applied and set it if it is
not already implicitly set (e.g. due to being in a module). Also apply
the "global" SAVE if present (i.e. setting it on every applicable
entity).

Add `IsDummy()` and `IsFuncResult()` to `Symbol` to simplify some of
the checks. Also detect attempts to put a function result in a common
block.

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

5 years ago[flang] Remove TODO for saved-entity
Tim Keith [Wed, 20 Feb 2019 19:39:11 +0000 (11:39 -0800)]
[flang] Remove TODO for saved-entity

The parser can't distinguish `saved-entity -> object-name` from
`saved-entity -> proc-pointer-name`. So just use `kind` == `Entity`
for those cases. Name resolution will verify it is the right kind
of entity name.

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

5 years ago[flang] More work on COMMON blocks
Tim Keith [Mon, 18 Feb 2019 19:39:46 +0000 (11:39 -0800)]
[flang] More work on COMMON blocks

Common block names can't clash with other names, so add `commonBlocks_`
to `Scope` to record the common blocks of a scoping unit. This requires
changes to how scopes are dumped and written to `.mod` files.

Support common blocks in BIND statements. Add optional bind-name to
`CommonBlockDetails`.

Add `CheckNotInBlock()` for checking statements that are not allowed in
block constructs.

In `rewrite-parse-tree.cc`, no longer skip check for resolved names in
common statements. But do skip the checks in compiler directives.

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

5 years ago[flang] Change handling of BIND attributes
Tim Keith [Fri, 15 Feb 2019 18:16:25 +0000 (10:16 -0800)]
[flang] Change handling of BIND attributes

Previously `BIND(C, NAME="...")` caused `bindName` to be set but not
the `BIND` attribute. This made writing the `.mod` file easier, but it
makes it hard to ask: does this symbol have a C binding.

This change causes the `BIND` attribute to be set whenever there is
`BIND(C)` in the source, regardless of whether there is a name or not.
`bindName` is only set when the `BIND` attribute is also set.

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

5 years ago[flang] Merge pull request flang-compiler/f18#291 from flang-compiler/pmk-recursive...
Peter Klausler [Tue, 19 Feb 2019 18:08:42 +0000 (10:08 -0800)]
[flang] Merge pull request flang-compiler/f18#291 from flang-compiler/pmk-recursive-type

Fix recursive use of parameterized derived types (issue flang-compiler/f18#283)

Original-commit: flang-compiler/f18@4da7f01f077167da2a4734d019b6b15e260adac3
Reviewed-on: https://github.com/flang-compiler/f18/pull/291