platform/upstream/llvm.git
6 years ago[flang] Merge pull request flang-compiler/f18#114 from flang-compiler/tsk5
Tim Keith [Thu, 5 Jul 2018 21:47:48 +0000 (14:47 -0700)]
[flang] Merge pull request flang-compiler/f18#114 from flang-compiler/tsk5

Check consistency of generic interfaces.

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

6 years ago[flang] Add missing copyright.
Tim Keith [Thu, 5 Jul 2018 17:36:18 +0000 (10:36 -0700)]
[flang] Add missing copyright.

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

6 years ago[flang] Check consistency of generic interfaces.
Tim Keith [Thu, 5 Jul 2018 17:28:34 +0000 (10:28 -0700)]
[flang] Check consistency of generic interfaces.

The specific procedures in a generic interface must be all functions or
all subroutines. If there is a derived type with the same name they can
only be functions.

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

6 years ago[flang] Merge pull request flang-compiler/f18#112 from ThePortlandGroup/tsk5
Tim Keith [Tue, 26 Jun 2018 22:43:01 +0000 (15:43 -0700)]
[flang] Merge pull request flang-compiler/f18#112 from ThePortlandGroup/tsk5

Support unparse with symbol annotations.

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

6 years ago[flang] Add -funparse-with-symbols to enable new behavior
Tim Keith [Tue, 26 Jun 2018 22:40:52 +0000 (15:40 -0700)]
[flang] Add -funparse-with-symbols to enable new behavior

Original-commit: flang-compiler/f18@7ad44e7e33de7020a94378b8f98395e7d5edef51
Reviewed-on: https://github.com/flang-compiler/f18/pull/112

6 years ago[flang] Support unparse with symbol annotations.
Tim Keith [Tue, 26 Jun 2018 22:01:42 +0000 (15:01 -0700)]
[flang] Support unparse with symbol annotations.

When `-fdebug-dump-symbols` is supplied with `-funparse`, include symbol
information in comments in the Fortran output. This will be used for
testing to verify that correct symbols are defined and references in
the right place.

In `UnparseWithSymbols()`, walk the parse tree and collect symbol
definitions and references, organized by statement. When a symbol is
defined across several statement it is associated with the first.
The definition of implicitly defined symbols is associated with the
first reference.

To write out the symbol information, a new optional argument is added to
`Unparse()`: it is a function that is called immediately before each
statement is unparsed. We pass in a function that prints out the symbol
information collected for that statement.

Add `Symbol::GetType()` to make it easier to write the symbol types
and add `Symbol::SetType()` for uniformity.

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

6 years ago[flang] Merge pull request flang-compiler/f18#111 from ThePortlandGroup/pmk-expr
Peter Klausler [Mon, 25 Jun 2018 16:32:14 +0000 (09:32 -0700)]
[flang] Merge pull request flang-compiler/f18#111 from ThePortlandGroup/pmk-expr

Expressions

Original-commit: flang-compiler/f18@802e18cb5ae3dae3d5f8d2e3bce0807cd362660e
Reviewed-on: https://github.com/flang-compiler/f18/pull/111

6 years ago[flang] Incorporate suggestions from code review.
peter klausler [Fri, 22 Jun 2018 23:44:23 +0000 (16:44 -0700)]
[flang] Incorporate suggestions from code review.

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

6 years ago[flang] Begin folding, with simple test, as sanity check on usability.
peter klausler [Fri, 22 Jun 2018 21:51:15 +0000 (14:51 -0700)]
[flang] Begin folding, with simple test, as sanity check on usability.

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

6 years ago[flang] clean up for push
peter klausler [Fri, 22 Jun 2018 20:40:56 +0000 (13:40 -0700)]
[flang] clean up for push

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

6 years ago[flang] Prepare for check-in
peter klausler [Fri, 22 Jun 2018 20:00:13 +0000 (13:00 -0700)]
[flang] Prepare for check-in

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

6 years ago[flang] Operator overloads for expression construction.
peter klausler [Fri, 22 Jun 2018 19:22:50 +0000 (12:22 -0700)]
[flang] Operator overloads for expression construction.

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

6 years ago[flang] clean up clang warnings from master
peter klausler [Fri, 22 Jun 2018 18:22:50 +0000 (11:22 -0700)]
[flang] clean up clang warnings from master

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

6 years ago[flang] More refinement, use const on subexpressions.
peter klausler [Fri, 22 Jun 2018 18:02:54 +0000 (11:02 -0700)]
[flang] More refinement, use const on subexpressions.

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

6 years ago[flang] Simplification
peter klausler [Thu, 21 Jun 2018 22:35:25 +0000 (15:35 -0700)]
[flang] Simplification

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

6 years ago[flang] fix builds, all now clear
peter klausler [Thu, 21 Jun 2018 20:28:31 +0000 (13:28 -0700)]
[flang] fix builds, all now clear

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

6 years ago[flang] Dump complex expressions
peter klausler [Thu, 21 Jun 2018 19:54:46 +0000 (12:54 -0700)]
[flang] Dump complex expressions

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

6 years ago[flang] More dumping code
peter klausler [Thu, 21 Jun 2018 19:47:28 +0000 (12:47 -0700)]
[flang] More dumping code

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

6 years ago[flang] Use unique_ptr for operands. Refactor comparisons.
peter klausler [Thu, 21 Jun 2018 18:03:00 +0000 (11:03 -0700)]
[flang] Use unique_ptr for operands.  Refactor comparisons.

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

6 years ago[flang] Expression formatting
peter klausler [Wed, 20 Jun 2018 23:50:27 +0000 (16:50 -0700)]
[flang] Expression formatting

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

6 years ago[flang] Change memcpy to memmove for overlap case.
peter klausler [Wed, 20 Jun 2018 22:12:13 +0000 (15:12 -0700)]
[flang] Change memcpy to memmove for overlap case.

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

6 years ago[flang] Numeric constant formatting and tests.
peter klausler [Wed, 20 Jun 2018 22:10:34 +0000 (15:10 -0700)]
[flang] Numeric constant formatting and tests.

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

6 years ago[flang] Character LEN, operator overloadings
peter klausler [Wed, 20 Jun 2018 18:55:10 +0000 (11:55 -0700)]
[flang] Character LEN, operator overloadings

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

6 years ago[flang] Finish first cut at expression.h.
peter klausler [Wed, 20 Jun 2018 17:53:49 +0000 (10:53 -0700)]
[flang] Finish first cut at expression.h.

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

6 years ago[flang] Expression work
peter klausler [Tue, 19 Jun 2018 23:26:48 +0000 (16:26 -0700)]
[flang] Expression work

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

6 years ago[flang] reformat c++
peter klausler [Tue, 19 Jun 2018 21:17:14 +0000 (14:17 -0700)]
[flang] reformat c++

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

6 years ago[flang] first cut at expressions
peter klausler [Tue, 19 Jun 2018 21:16:01 +0000 (14:16 -0700)]
[flang] first cut at expressions

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

6 years ago[flang] begin expression representation
peter klausler [Mon, 18 Jun 2018 19:09:56 +0000 (12:09 -0700)]
[flang] begin expression representation

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

6 years ago[flang] Documentation
peter klausler [Mon, 18 Jun 2018 18:26:06 +0000 (11:26 -0700)]
[flang] Documentation

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

6 years ago[flang] Merge pull request flang-compiler/f18#110 from ThePortlandGroup/tsk1
Tim Keith [Fri, 22 Jun 2018 21:45:41 +0000 (14:45 -0700)]
[flang] Merge pull request flang-compiler/f18#110 from ThePortlandGroup/tsk1

Fix problems in PR 109 when compiling with clang.

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

6 years ago[flang] Fix problems in PR 109 when compiling with clang.
Tim Keith [Fri, 22 Jun 2018 21:08:04 +0000 (14:08 -0700)]
[flang] Fix problems in PR 109 when compiling with clang.

This gets the code base back to compiling cleanly with clang after
pull request 109.

There were two overloadings of `Post(const parser::DeclarationTypeSpec::Type &)`.
The one in DeclarationVisitor needed to call the one in DeclTypeSpecVisitor.
This was fixed by introducing a new function, SetDerivedDeclTypeSpec, to do
the equivalent thing.

Original-commit: flang-compiler/f18@81e447bf4ec076f8fa823c0c61c9dd72e1f62fe4
Reviewed-on: https://github.com/flang-compiler/f18/pull/110

6 years ago[flang] Merge pull request flang-compiler/f18#109 from ThePortlandGroup/tsk5
Tim Keith [Fri, 22 Jun 2018 17:29:28 +0000 (10:29 -0700)]
[flang] Merge pull request flang-compiler/f18#109 from ThePortlandGroup/tsk5

Name resolution for derived types.

Original-commit: flang-compiler/f18@5317d4f30ae926ee4f839d3afab68363d1d9c5c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/109

6 years ago[flang] Name resolution for derived types.
Tim Keith [Fri, 22 Jun 2018 15:21:19 +0000 (08:21 -0700)]
[flang] Name resolution for derived types.

This consists of:
- a new kind of symbols to represent them with DerivedTypeDetails
- creating symbols for derived types when they are declared
- creating a new kind of scope for the type to hold component symbols
- resolving entity declarations of objects of derived type
- resolving references to objects of derived type and to components
- handling derived types with same name as generic

Type parameters are not yet implemented.

Refactor DeclTypeSpec to be a value class wrapping an IntrinsicTypeSpec
or a DerivedTypeSpec (or neither in the TypeStar and ClassStar cases).
Store DerivedTypeSpec objects in a new structure the current scope
MakeDerivedTypeSpec so that DeclTypeSpec can just contain a pointer to
them, as it currently does for intrinsic types.

In GenericDetails, add derivedType field to handle case where generic
and derived type have the same name. The generic is in the scope and the
derived type is referenced from the generic, similar to the case where a
generic and specific have the same name. When one of these names is
mis-recognized, we sometimes have to fix up the 'occurrences' lists
of the symbols.

Assign implicit types as soon as an entity is encountered that requires
one. Otherwise implicit derived types won't work. When we see 'x%y' we
have to know the type of x in order to resolve y. Add an Implicit flag
to mark symbols that were implicitly typed

For symbols that introduce a new scope, include a pointer back to that
scope.

Add CurrNonTypeScope() for the times when we want the current scope but
ignoring derived type scopes. For example, that happens when looking for
types or parameters, or creating implicit symbols.

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

6 years ago[flang] Refactor DeclTypeSpec and DerivedTypeSpec classes.
Tim Keith [Thu, 14 Jun 2018 22:34:57 +0000 (15:34 -0700)]
[flang] Refactor DeclTypeSpec and DerivedTypeSpec classes.

Make DerivedTypeSpec a simple wrapper around the name of the type.
Leave out type parameter values until we are ready to resolve them
as well.

Change DeclTypeSpec to be an old-fashioned union with an enum to
indicate what is in it. std::variant doesn't work well here because
we wanted the enum visible in the class' API and there is not a
1-to-1 mapping between enumerators and data stored.

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

6 years ago[flang] Merge pull request flang-compiler/f18#107 from ThePortlandGroup/tsk2
Tim Keith [Wed, 20 Jun 2018 17:13:43 +0000 (10:13 -0700)]
[flang] Merge pull request flang-compiler/f18#107 from ThePortlandGroup/tsk2

Change how memory for Symbol instances is managed.

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

6 years ago[flang] Change how memory for Symbol instances is managed.
Tim Keith [Tue, 19 Jun 2018 23:06:41 +0000 (16:06 -0700)]
[flang] Change how memory for Symbol instances is managed.

With this change, all instances Symbol are stored in class Symbols.
Scope.symbols_, which used to own the symbol memory, now maps names to
Symbol* instead. This causes a bunch of reference-to-pointer changes
because of the change in type of key-value pairs. It also requires a
default constructor for Symbol, which means owner_ can't be a reference.

Symbols manages Symbol instances by allocating a block of them at a time
and returning the next one when needed. They are never freed.

The reason for the change is that there are a few cases where we need
to have a two symbols with the same name, so they can't both live in
the map in Scope. Those are:
1. When there is an erroneous redeclaration of a name we may delete the
   first symbol and replace it with a new one. If we have saved a pointer
   to the first one it is now dangling. This can be seen by running
   `f18 -fdebug-dump-symbols -fparse-only test/semantics/resolve19.f90`
   under valgrind. Subroutine s is declared twice: each results in a
   scope that contains a pointer back to the symbol for the subroutine.
   After the second symbol for s is created the first is gone so the
   pointer in the scope is invalid.
2. A generic and one of its specifics can have the same name. We currently
   handle that by moving the symbol for the specific into a unique_ptr
   in the generic. So in that case the symbol is owned by another symbol
   instead of by the scope. It is simpler if we only have to deal with
   moving the raw pointer around.
3. A generic and a derived type can have the same name. This case isn't
   handled yet, but it can be done like flang-compiler/f18#2 above. It's more complicated
   because the derived type and the generic can be declared in either
   order.

Original-commit: flang-compiler/f18@55a68cf0235c8a3ac855de7dc0e2b08690866be0
Reviewed-on: https://github.com/flang-compiler/f18/pull/107

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