platform/upstream/llvm.git
6 years ago[flang] Fix bug in adding symbols to parse tree.
Tim Keith [Tue, 19 Jun 2018 21:59:41 +0000 (14:59 -0700)]
[flang] Fix bug in adding symbols to parse tree.

We were collecting symbols in a map of SourceName to Symbol*.
This is wrong because sometimes different occurrences of a name
map to different symbols (e.g. in different scopes).
SourceName::begin() is unique for each occurrence so use that
as the map key instead.

The problem can be reproduced by running:
`f18 -fdebug-resolve-names -fparse-only -fdebug-dump-parse-tree`
on the following source. The two symbols 'i' should have different
types and they were both coming out as INTEGER because they both
pointed to the first symbol for 'i'.

```
module m
  integer :: i
contains
  subroutine s
    real :: i
  end
end
```

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

6 years ago[flang] Merge pull request flang-compiler/f18#106 from ThePortlandGroup/pmk-value
Peter Klausler [Mon, 18 Jun 2018 19:10:35 +0000 (12:10 -0700)]
[flang] Merge pull request flang-compiler/f18#106 from ThePortlandGroup/pmk-value

Rearrange some facilities into a new lib/common.

Original-commit: flang-compiler/f18@12477c3c3090b6cd2db0fa247aab073808a94511
Reviewed-on: https://github.com/flang-compiler/f18/pull/106

6 years ago[flang] Rearrange some facilities into a new lib/common.
peter klausler [Mon, 18 Jun 2018 18:03:43 +0000 (11:03 -0700)]
[flang] Rearrange some facilities into a new lib/common.

Original-commit: flang-compiler/f18@279af1e817b1266dd57689e462272f8e29496798
Reviewed-on: https://github.com/flang-compiler/f18/pull/106

6 years ago[flang] Merge pull request flang-compiler/f18#105 from ThePortlandGroup/tsk2
Tim Keith [Fri, 15 Jun 2018 22:40:33 +0000 (15:40 -0700)]
[flang] Merge pull request flang-compiler/f18#105 from ThePortlandGroup/tsk2

Add name resolution tests

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

6 years ago[flang] Add name resolution tests
Tim Keith [Fri, 15 Jun 2018 21:54:34 +0000 (14:54 -0700)]
[flang] Add name resolution tests

The Fortran source files in test/semantics all contain expected
errors in comments. The script test_errors.sh compiles a file with
'f18 -fdebug-resolve-names -fparse-only' and compares the actual
errors produced against the expected ones.

The change to resolve15.f90 is necessary because test_errors.sh can't
handle two expected errors for the same source line.

A useful command to run these is 'ctest -R f90 --output-on-failure'.
-R means only run tests with f90 in the name
--output-on-failure prints the output of test_errors.sh when a test
fails, showing the expected and actual messages that differ.

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

6 years ago[flang] Merge pull request flang-compiler/f18#101 from ThePortlandGroup/pmk-evaluate
Peter Klausler [Fri, 15 Jun 2018 17:35:45 +0000 (10:35 -0700)]
[flang] Merge pull request flang-compiler/f18#101 from ThePortlandGroup/pmk-evaluate

Basic operation evaluation framework

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

6 years ago[flang] Test 64-bit reals too.
peter klausler [Fri, 15 Jun 2018 17:02:09 +0000 (10:02 -0700)]
[flang] Test 64-bit reals too.

Original-commit: flang-compiler/f18@67fd5514417b2c920be85e0919bf06b06a399e3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/101

6 years ago[flang] Address review comments
peter klausler [Thu, 14 Jun 2018 20:43:02 +0000 (13:43 -0700)]
[flang] Address review comments

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

6 years ago[flang] More rearrangement, and debug an edge case with Underflow flag.
peter klausler [Wed, 13 Jun 2018 23:08:12 +0000 (16:08 -0700)]
[flang] More rearrangement, and debug an edge case with Underflow flag.

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

6 years ago[flang] Move member functions complex.h -> complex.cc
peter klausler [Wed, 13 Jun 2018 17:44:55 +0000 (10:44 -0700)]
[flang] Move member functions complex.h -> complex.cc

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

6 years ago[flang] Remove work-around in resolve-names.cc.
peter klausler [Wed, 13 Jun 2018 17:36:56 +0000 (10:36 -0700)]
[flang] Remove work-around in resolve-names.cc.

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

6 years ago[flang] Cleaning up Real<> for review.
peter klausler [Wed, 13 Jun 2018 17:34:23 +0000 (10:34 -0700)]
[flang] Cleaning up Real<> for review.

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

6 years ago[flang] Prepare for review.
peter klausler [Wed, 13 Jun 2018 16:22:50 +0000 (09:22 -0700)]
[flang] Prepare for review.

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

6 years ago[flang] Less exhaustive REAL testing by default.
peter klausler [Tue, 12 Jun 2018 22:45:52 +0000 (15:45 -0700)]
[flang] Less exhaustive REAL testing by default.

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

6 years ago[flang] COMPLEX
peter klausler [Tue, 12 Jun 2018 22:14:18 +0000 (15:14 -0700)]
[flang] COMPLEX

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

6 years ago[flang] LOGICAL
peter klausler [Tue, 12 Jun 2018 20:33:08 +0000 (13:33 -0700)]
[flang] LOGICAL

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

6 years ago[flang] Revamp type.h, add LOGICAL
peter klausler [Tue, 12 Jun 2018 19:59:31 +0000 (12:59 -0700)]
[flang] Revamp type.h, add LOGICAL

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

6 years ago[flang] All operations now work and match x86, all modes and flags.
peter klausler [Mon, 11 Jun 2018 23:01:54 +0000 (16:01 -0700)]
[flang] All operations now work and match x86, all modes and flags.

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

6 years ago[flang] More real work. All ops, rounding modes, and flags good except for division.
peter klausler [Mon, 11 Jun 2018 18:35:53 +0000 (11:35 -0700)]
[flang] More real work.  All ops, rounding modes, and flags good except for division.

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

6 years ago[flang] Check flag bits.
peter klausler [Fri, 8 Jun 2018 22:49:06 +0000 (15:49 -0700)]
[flang] Check flag bits.

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

6 years ago[flang] Multiplication, more tests.
peter klausler [Fri, 8 Jun 2018 22:18:03 +0000 (15:18 -0700)]
[flang] Multiplication, more tests.

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

6 years ago[flang] Refactor rounding code.
peter klausler [Fri, 8 Jun 2018 17:58:58 +0000 (10:58 -0700)]
[flang] Refactor rounding code.

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

6 years ago[flang] Get real add/subtract working and tested.
peter klausler [Fri, 8 Jun 2018 17:24:15 +0000 (10:24 -0700)]
[flang] Get real add/subtract working and tested.

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

6 years ago[flang] start negative number tests
peter klausler [Wed, 6 Jun 2018 18:48:00 +0000 (11:48 -0700)]
[flang] start negative number tests

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

6 years ago[flang] Get back to passing all tests.
peter klausler [Wed, 6 Jun 2018 18:26:00 +0000 (11:26 -0700)]
[flang] Get back to passing all tests.

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

6 years ago[flang] Use EnumSet<> for real flags
peter klausler [Wed, 6 Jun 2018 18:11:35 +0000 (11:11 -0700)]
[flang] Use EnumSet<> for real flags

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

6 years ago[flang] some real debugging
peter klausler [Tue, 5 Jun 2018 23:55:31 +0000 (16:55 -0700)]
[flang] some real debugging

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

6 years ago[flang] begin testing reals
peter klausler [Tue, 5 Jun 2018 23:29:26 +0000 (16:29 -0700)]
[flang] begin testing reals

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

6 years ago[flang] Convert REAL code to use IEEE encodings.
peter klausler [Tue, 5 Jun 2018 20:55:56 +0000 (13:55 -0700)]
[flang] Convert REAL code to use IEEE encodings.

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

6 years ago[flang] real work
peter klausler [Mon, 4 Jun 2018 23:22:58 +0000 (16:22 -0700)]
[flang] real work

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

6 years ago[flang] More work on reals.
peter klausler [Mon, 4 Jun 2018 22:56:40 +0000 (15:56 -0700)]
[flang] More work on reals.

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

6 years ago[flang] more work on reals
peter klausler [Mon, 4 Jun 2018 16:49:47 +0000 (09:49 -0700)]
[flang] more work on reals

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

6 years ago[flang] begin real.h
peter klausler [Fri, 1 Jun 2018 22:30:31 +0000 (15:30 -0700)]
[flang] begin real.h

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

6 years ago[flang] bugfixing from clang build
peter klausler [Fri, 1 Jun 2018 19:55:32 +0000 (12:55 -0700)]
[flang] bugfixing from clang build

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

6 years ago[flang] Reading numbers from strings.
peter klausler [Fri, 1 Jun 2018 19:37:23 +0000 (12:37 -0700)]
[flang] Reading numbers from strings.

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

6 years ago[flang] Template specializations and more automatic configuration
peter klausler [Fri, 1 Jun 2018 18:48:31 +0000 (11:48 -0700)]
[flang] Template specializations and more automatic configuration

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

6 years ago[flang] Rename fixed-point to integer.
peter klausler [Fri, 1 Jun 2018 17:05:15 +0000 (10:05 -0700)]
[flang] Rename fixed-point to integer.

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

6 years ago[flang] More tests; full build and test cycle.
peter klausler [Fri, 1 Jun 2018 00:00:04 +0000 (17:00 -0700)]
[flang] More tests; full build and test cycle.

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

6 years ago[flang] More tests
peter klausler [Thu, 31 May 2018 23:32:36 +0000 (16:32 -0700)]
[flang] More tests

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

6 years ago[flang] More intrinsics
peter klausler [Thu, 31 May 2018 23:15:18 +0000 (16:15 -0700)]
[flang] More intrinsics

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

6 years ago[flang] Add pop count and parity code and tests.
peter klausler [Thu, 31 May 2018 21:28:49 +0000 (14:28 -0700)]
[flang] Add pop count and parity code and tests.

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

6 years ago[flang] Complete conversion to value semantics
peter klausler [Thu, 31 May 2018 19:25:21 +0000 (12:25 -0700)]
[flang] Complete conversion to value semantics

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

6 years ago[flang] Converted multiplication
peter klausler [Thu, 31 May 2018 18:58:50 +0000 (11:58 -0700)]
[flang] Converted multiplication

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

6 years ago[flang] Converted shift intrinsics.
peter klausler [Thu, 31 May 2018 18:18:14 +0000 (11:18 -0700)]
[flang] Converted shift intrinsics.

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

6 years ago[flang] Continue conversion to value semantics
peter klausler [Thu, 31 May 2018 17:45:41 +0000 (10:45 -0700)]
[flang] Continue conversion to value semantics

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

6 years ago[flang] Begin conversion to value semantics.
peter klausler [Thu, 31 May 2018 16:44:27 +0000 (09:44 -0700)]
[flang] Begin conversion to value semantics.

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

6 years ago[flang] Reformat
peter klausler [Wed, 30 May 2018 23:09:52 +0000 (16:09 -0700)]
[flang] Reformat

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

6 years ago[flang] Testing framework, debugging of fixed-point code.
peter klausler [Wed, 30 May 2018 23:08:42 +0000 (16:08 -0700)]
[flang] Testing framework, debugging of fixed-point code.

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

6 years ago[flang] unit testing for LZBC
peter klausler [Tue, 29 May 2018 21:49:52 +0000 (14:49 -0700)]
[flang] unit testing for LZBC

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

6 years ago[flang] add fixed-point.h
peter klausler [Tue, 29 May 2018 19:42:21 +0000 (12:42 -0700)]
[flang] add fixed-point.h

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

6 years ago[flang] begin work
peter klausler [Sat, 19 May 2018 00:11:04 +0000 (17:11 -0700)]
[flang] begin work

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

6 years ago[flang] Merge pull request flang-compiler/f18#103 from ThePortlandGroup/pmk-issue98
Peter Klausler [Thu, 14 Jun 2018 20:50:06 +0000 (13:50 -0700)]
[flang] Merge pull request flang-compiler/f18#103 from ThePortlandGroup/pmk-issue98

Issue 98, better error recovery for specification-part

Original-commit: flang-compiler/f18@0239a080e0a387aeb0a45e750c82c230d6a1b7c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/103

6 years ago[flang] Issue 98, better error recovery for specification-part
peter klausler [Thu, 14 Jun 2018 17:13:40 +0000 (10:13 -0700)]
[flang] Issue 98, better error recovery for specification-part

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

6 years ago[flang] Merge pull request flang-compiler/f18#102 from ThePortlandGroup/pmk-omp-fix
Peter Klausler [Thu, 14 Jun 2018 17:17:04 +0000 (10:17 -0700)]
[flang] Merge pull request flang-compiler/f18#102 from ThePortlandGroup/pmk-omp-fix

Allow tab in fixed form compiler directives.  Reformat C++.

Original-commit: flang-compiler/f18@1b7519b5a8209a1cb0504fbfcd3d3b124aa2be3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/102

6 years ago[flang] Allow tab in fixed form compiler directives. Reformat C++.
peter klausler [Thu, 14 Jun 2018 16:35:38 +0000 (09:35 -0700)]
[flang] Allow tab in fixed form compiler directives.  Reformat C++.

Original-commit: flang-compiler/f18@59ba17cb2478bd0b0f4ed6084c424677c7b46371
Reviewed-on: https://github.com/flang-compiler/f18/pull/102

6 years ago[flang] Merge pull request flang-compiler/f18#100 from ThePortlandGroup/tsk5
Tim Keith [Wed, 13 Jun 2018 16:58:34 +0000 (09:58 -0700)]
[flang] Merge pull request flang-compiler/f18#100 from ThePortlandGroup/tsk5

Remove extraneous Pre/Post for ProcedureDeclarationStmt

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

6 years ago[flang] Remove extraneous Pre/Post for ProcedureDeclarationStmt
Tim Keith [Wed, 13 Jun 2018 00:46:41 +0000 (17:46 -0700)]
[flang] Remove extraneous Pre/Post for ProcedureDeclarationStmt

clang give a compilation error on resolve-names.cc because there are
two overloadings of Pre(ProcedureDeclarationStmt) available in
ResolveNamesVisitor. One is defined in DeclTypeSpecVisitor and the other
in DeclarationVisitor. They are both brought in to ResolveNamesVisitor
via `using` statements.

The one in DeclarationVisitor is the one that is supposed to be called.
The other should have been removed when this one was added. This is the
one that gcc chooses to call, so this doesn't change any behavior.

The same applies to the Post method as well.

Original-commit: flang-compiler/f18@872f8faf96164a01f18100fc1942f68523be6d76
Reviewed-on: https://github.com/flang-compiler/f18/pull/100

6 years ago[flang] Merge pull request flang-compiler/f18#99 from ThePortlandGroup/tsk7
Tim Keith [Tue, 12 Jun 2018 14:06:11 +0000 (07:06 -0700)]
[flang] Merge pull request flang-compiler/f18#99 from ThePortlandGroup/tsk7

Add Dump() routines for debugging.

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

6 years ago[flang] Add Dump() routines for debugging.
Tim Keith [Mon, 11 Jun 2018 22:40:31 +0000 (15:40 -0700)]
[flang] Add Dump() routines for debugging.

Add Dump() routines based on operator<< for the type so that they are
easy to call from the debugger. Overload for both pointer and reference
types and for dumping to std::cerr or a specific ostream.

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

6 years ago[flang] Merge pull request flang-compiler/f18#97 from ThePortlandGroup/tsk5
Tim Keith [Wed, 6 Jun 2018 18:43:12 +0000 (11:43 -0700)]
[flang] Merge pull request flang-compiler/f18#97 from ThePortlandGroup/tsk5

Process procedure declarations and derived types.

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

6 years ago[flang] Address review comments.
Tim Keith [Wed, 6 Jun 2018 18:41:42 +0000 (11:41 -0700)]
[flang] Address review comments.

Replace operator=(Symbol) and operator=(DeclTypeSpec) with set_symbol()
and set_type() to make it clearer. Eliminate the move constructor as it
is not needed. Make all but the accessor functions out-of-line.

Change HasExplicitType() to NeedsExplicitType(), reversing its sense.
HasExplicitType() returned true for symbols that didn't have or need an
explicit type, which was confusing.

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

6 years ago[flang] Process procedure declarations and derived types.
Tim Keith [Tue, 5 Jun 2018 19:18:35 +0000 (12:18 -0700)]
[flang] Process procedure declarations and derived types.

Add ObjectEntityDetails and ProcEntityDetails to distinguish between an
entity from an object-decl and one from a proc-decl. When we don't know,
it stays as EntityDetails until it is resolved. DeclareEntity() in
DeclarationVisitor creates this kind of symbol.

Add flags to Symbol as a convenient place for boolean flags common to
many kinds of symbols. Use it to mark symbols known to be functions or
subroutines so that we can report errors when they are used incorrectly.
Improve handling of EXTERNAL statement.

Handle ProcDecl nodes and add symbols for them.

Partial processing of derived types. Data component declarations are
processed and added to the derived type. Define TypeBoundProc and
TypeBoundGeneric in type.h. Procedure components, type-bound procedures,
etc. are not handled yet and nothing is done with the derived type once
it is created. Eliminate DerivedTypeDefBuilder in favor of just setting
fields in derivedTypeData_.

Add GetDeclTypeSpec to go with BeginDeclTypeSpec and EndDeclTypeSpec, to
avoid directly access the private variable.

Add tests in resolve20.f90 for errors related to procedure declarations.
Add missing copyrights to other tests.

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

6 years ago[flang] Add MessageHandler::Say2.
Tim Keith [Wed, 30 May 2018 21:49:40 +0000 (14:49 -0700)]
[flang] Add MessageHandler::Say2.

This handles the common case of an error message referring to
a name, and an attached message referring to another name.
For example, reporting an error where a name is already declared
and mentioning the previous declaration.

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

6 years ago[flang] Extract DeclarationVisitor from ResolveNamesVisitor
Tim Keith [Wed, 30 May 2018 21:11:45 +0000 (14:11 -0700)]
[flang] Extract DeclarationVisitor from ResolveNamesVisitor

The is a refactoring to move all handling of declarations from
ResolveNamesVisitor to a new class. No function change.

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

6 years ago[flang] Merge pull request flang-compiler/f18#96 from ThePortlandGroup/omppar
hsuauthai [Fri, 1 Jun 2018 22:08:09 +0000 (15:08 -0700)]
[flang] Merge pull request flang-compiler/f18#96 from ThePortlandGroup/omppar

Omppar

Original-commit: flang-compiler/f18@8c259b93004558b74ae9c771e319c18ab86ea409
Reviewed-on: https://github.com/flang-compiler/f18/pull/96

6 years ago[flang] Fix comment in openmp-grammar.h. Fix unparse of reduction operator.
Hongyon Suauthai [Fri, 1 Jun 2018 21:36:51 +0000 (14:36 -0700)]
[flang] Fix comment in openmp-grammar.h.  Fix unparse of reduction operator.

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

6 years ago[flang] Remove unintended change.
Hongyon Suauthai [Fri, 1 Jun 2018 18:54:43 +0000 (11:54 -0700)]
[flang] Remove unintended change.

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

6 years ago[flang] Fix space in issue unparse.cc between directive and its first clause.
Hongyon Suauthai [Fri, 1 Jun 2018 18:47:24 +0000 (11:47 -0700)]
[flang] Fix space in issue unparse.cc  between directive and its first clause.

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

6 years ago[flang] update unparsing openmp directives and clauses.
Hongyon Suauthai [Fri, 1 Jun 2018 18:15:32 +0000 (11:15 -0700)]
[flang] update unparsing openmp directives and clauses.

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

6 years ago[flang] Update unparse.cc and move declarative directives for now.
Hongyon Suauthai [Fri, 1 Jun 2018 17:40:13 +0000 (10:40 -0700)]
[flang] Update unparse.cc and move declarative directives for now.

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

6 years ago[flang] add more clauses, declarative directives, standalone directives, and directiv...
Hongyon Suauthai [Thu, 31 May 2018 14:38:15 +0000 (07:38 -0700)]
[flang] add more clauses, declarative directives, standalone directives, and directives enclosing do loop.

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

6 years ago[flang] Merge pull request flang-compiler/f18#95 from ThePortlandGroup/tsk3
Tim Keith [Wed, 23 May 2018 00:00:10 +0000 (17:00 -0700)]
[flang] Merge pull request flang-compiler/f18#95 from ThePortlandGroup/tsk3

Improvements to generics.

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

6 years ago[flang] Improvements to generics.
Tim Keith [Tue, 22 May 2018 23:12:56 +0000 (16:12 -0700)]
[flang] Improvements to generics.

When a generic or specific procedure is use-associated, make a copy of
it in the current scope (replacing the symbol that has UseDetails) so
that we can make changes to it. This permits a generic to be defined in
one module and extended with more specific procedures in another.

When a specific procedure has the same name as its generic, it can't be
stored directly in the scope because that is indexed by name and the
generic is already there. So instead we store the specific in the
GenericDetails of the generic symbol.

Enforce the rule that a generic and a procedure can only have the same
name if the procedure is one of the specifics of the generic.

Refactorings done is support of this change:
- Add FindSymbol() and EraseSymbol() as helpers to find or erase a
  symbol in the current scope. Make use of FindSymbol() where appropriate.
- Add SayAlreadyDeclared() to report a common error.

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

6 years ago[flang] Create LICENSE
Steve Scalpone [Fri, 18 May 2018 20:06:22 +0000 (13:06 -0700)]
[flang] Create LICENSE

We expect to adopt the llvm.org license in the near future.

Original-commit: flang-compiler/f18@a1a01e949b389db784127f9ccbddaad460335c3a

6 years ago[flang] Update build instructions (flang-compiler/f18#94)
Steve Scalpone [Fri, 18 May 2018 20:02:58 +0000 (13:02 -0700)]
[flang] Update build instructions (flang-compiler/f18#94)

* Update build instructions

Add an overview and update the build instructions for f18.

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

6 years ago[flang] Merge pull request flang-compiler/f18#93 from ThePortlandGroup/tsk3
Tim Keith [Thu, 17 May 2018 21:17:11 +0000 (14:17 -0700)]
[flang] Merge pull request flang-compiler/f18#93 from ThePortlandGroup/tsk3

Clean up; fix assert and crashes

Original-commit: flang-compiler/f18@1e91e792921023ee2f78a918c3d3229773ea2124
Reviewed-on: https://github.com/flang-compiler/f18/pull/93

6 years ago[flang] Address review comments.
Tim Keith [Thu, 17 May 2018 21:16:15 +0000 (14:16 -0700)]
[flang] Address review comments.

Original-commit: flang-compiler/f18@5361f3c810ad6e161006f43fb8759e36e9497591
Reviewed-on: https://github.com/flang-compiler/f18/pull/93

6 years ago[flang] Clean up; fix assert and crashes
Tim Keith [Thu, 17 May 2018 20:06:38 +0000 (13:06 -0700)]
[flang] Clean up; fix assert and crashes

This is the result of running `f18 -fdebug-resolve-names` on a bunch of
Fortran source and fixing the resulting assertion errors and segmentation
faults.

Most of the problems were with encountering attributes, array specs, or
declaration type specs when we weren't prepared to handle them. Those
were fixed by adding calls to {Begin,End}DeclTypeSpec and {Begin,End}Decl
when encountering certain nodes, though the real work for those nodes is
still to be done.

Extract some common functionality into PostAttrSpec and CheckUseError.

Add missing XOR to GenericSpec.

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

6 years ago[flang] Merge pull request flang-compiler/f18#92 from ThePortlandGroup/pmk-runtime
Peter Klausler [Thu, 17 May 2018 18:41:12 +0000 (11:41 -0700)]
[flang] Merge pull request flang-compiler/f18#92 from ThePortlandGroup/pmk-runtime

Document and initiate development of run time descriptors.

Original-commit: flang-compiler/f18@8dd289d7f5dbd79e13db28766f880d8bddbd545f
Reviewed-on: https://github.com/flang-compiler/f18/pull/92

6 years ago[flang] More descriptor work.
peter klausler [Thu, 17 May 2018 18:32:23 +0000 (11:32 -0700)]
[flang] More descriptor work.

Original-commit: flang-compiler/f18@269cb528764d7d8925ef499be2c906a71f0d0d52
Reviewed-on: https://github.com/flang-compiler/f18/pull/92

6 years ago[flang] Refine type bound define assignment.
peter klausler [Wed, 16 May 2018 23:57:43 +0000 (16:57 -0700)]
[flang] Refine type bound define assignment.

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

6 years ago[flang] Separate generic from specialized parts of derived types and their components.
peter klausler [Wed, 16 May 2018 23:17:09 +0000 (16:17 -0700)]
[flang] Separate generic from specialized parts of derived types and their components.

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

6 years ago[flang] rearrange some TODO comments
peter klausler [Wed, 16 May 2018 21:25:45 +0000 (14:25 -0700)]
[flang] rearrange some TODO comments

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

6 years ago[flang] more review comments
peter klausler [Wed, 16 May 2018 20:55:43 +0000 (13:55 -0700)]
[flang] more review comments

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

6 years ago[flang] more thinking about requirements for defined assignment &c.
peter klausler [Wed, 16 May 2018 20:50:04 +0000 (13:50 -0700)]
[flang] more thinking about requirements for defined assignment &c.

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

6 years ago[flang] review comments
peter klausler [Wed, 16 May 2018 20:49:37 +0000 (13:49 -0700)]
[flang] review comments

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

6 years ago[flang] Add a TODO.
peter klausler [Wed, 16 May 2018 18:32:24 +0000 (11:32 -0700)]
[flang] Add a TODO.

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

6 years ago[flang] Fix clang-only build warning, run clang-format.
peter klausler [Wed, 16 May 2018 17:31:35 +0000 (10:31 -0700)]
[flang] Fix clang-only build warning, run clang-format.

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

6 years ago[flang] Document and initiate development of run time descriptors.
peter klausler [Wed, 16 May 2018 17:22:33 +0000 (10:22 -0700)]
[flang] Document and initiate development of run time descriptors.

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

6 years ago[flang] Merge pull request flang-compiler/f18#90 from ThePortlandGroup/pmk5
Peter Klausler [Wed, 16 May 2018 17:09:46 +0000 (10:09 -0700)]
[flang] Merge pull request flang-compiler/f18#90 from ThePortlandGroup/pmk5

Fix issue flang-compiler/f18#89

Original-commit: flang-compiler/f18@119fa65b2cc0ff3bb57dd4a0b17c08b9ddbaffd4
Reviewed-on: https://github.com/flang-compiler/f18/pull/90

6 years ago[flang] clang-format
peter klausler [Wed, 16 May 2018 17:00:14 +0000 (10:00 -0700)]
[flang] clang-format

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

6 years ago[flang] Fine tuning of space recognition.
peter klausler [Wed, 16 May 2018 16:58:56 +0000 (09:58 -0700)]
[flang] Fine tuning of space recognition.

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

6 years ago[flang] Dodge bogus warning about unused anonymous variable in refactored code.
peter klausler [Tue, 15 May 2018 23:40:22 +0000 (16:40 -0700)]
[flang] Dodge bogus warning about unused anonymous variable in refactored code.

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

6 years ago[flang] Fix tokenization of signed-int-literal-constant, allow internal space.
peter klausler [Tue, 15 May 2018 23:37:47 +0000 (16:37 -0700)]
[flang] Fix tokenization of signed-int-literal-constant, allow internal space.

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

6 years ago[flang] Merge pull request flang-compiler/f18#91 from ThePortlandGroup/omppar
hsuauthai [Wed, 16 May 2018 16:53:43 +0000 (09:53 -0700)]
[flang] Merge pull request flang-compiler/f18#91 from ThePortlandGroup/omppar

Add OpenMP parallel directives and private/firstprivate clauses to pa…

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

6 years ago[flang] Modified directive names and clauses to reflect in OpenMP Spec.
Hongyon Suauthai [Wed, 16 May 2018 16:49:35 +0000 (09:49 -0700)]
[flang] Modified directive names and clauses to reflect in OpenMP Spec.

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

6 years ago[flang] Add OpenMP parallel directives and private/firstprivate clauses to parser.
Hongyon Suauthai [Wed, 16 May 2018 14:28:54 +0000 (07:28 -0700)]
[flang] Add OpenMP parallel directives and private/firstprivate clauses to parser.

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

6 years ago[flang] Merge pull request flang-compiler/f18#88 from ThePortlandGroup/tsk3
Tim Keith [Mon, 14 May 2018 21:32:22 +0000 (14:32 -0700)]
[flang] Merge pull request flang-compiler/f18#88 from ThePortlandGroup/tsk3

Name resolution on interface blocks.

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

6 years ago[flang] Refactor: make some methods out-of-line.
Tim Keith [Mon, 14 May 2018 21:26:39 +0000 (14:26 -0700)]
[flang] Refactor: make some methods out-of-line.

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

6 years ago[flang] Support interface blocks.
Tim Keith [Mon, 14 May 2018 20:51:13 +0000 (13:51 -0700)]
[flang] Support interface blocks.

Add subprogram symbols for each interface-body and set isInterface on
them. Create a symbol with GenericDetails for each generic interface
block and add interface specifications to the specific procedures of
the generic. InterfaceVisitor takes care of this.

Before processing the specification part of modules and subprograms,
collect the names of module subprograms and internal subprograms and add
them to the symbol table with SubprogramNameDetails. This allows us to
reference them from interface blocks in the specification part.
SubprogramNameDetails is converted to SubprogramDetails when the real
subprogram is visited.

This is achieved by setting subpNamesOnly_ and then walking the
ModuleSubprogramPart or InternalSubprogramPart. Creating the symbol and
scope for a module or subprogram now happens when the Module,
SubroutineSubprogram, or FunctionSubprogram node is encountered so
this can happen in the right order.

Add BeginSubprogram and EndSubprogram to handle the parts in common
between subprograms and interface specifications.

Add GenericSpec to type.h to represent all possible generic specs.
Only generic names are resolved so far.

Add tests for new error messages. Change resolve02.f90 to reflect the
new errors reported.

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