platform/upstream/llvm.git
6 years ago[flang] Merge pull request flang-compiler/f18#144 from flang-compiler/pmk0
Peter Klausler [Wed, 25 Jul 2018 16:33:37 +0000 (09:33 -0700)]
[flang] Merge pull request flang-compiler/f18#144 from flang-compiler/pmk0

Checkpoint development of expression analysis

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

6 years ago[flang] Fix typo
peter klausler [Tue, 24 Jul 2018 22:50:38 +0000 (15:50 -0700)]
[flang] Fix typo

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

6 years ago[flang] real expression folding
peter klausler [Tue, 24 Jul 2018 19:58:29 +0000 (12:58 -0700)]
[flang] real expression folding

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

6 years ago[flang] checkpoint
peter klausler [Mon, 23 Jul 2018 22:04:08 +0000 (15:04 -0700)]
[flang] checkpoint

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

6 years ago[flang] Real->Integer conversion folding
peter klausler [Fri, 20 Jul 2018 20:52:52 +0000 (13:52 -0700)]
[flang] Real->Integer conversion folding

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

6 years ago[flang] Parameterize Expr on a type, not category+kind
peter klausler [Fri, 20 Jul 2018 19:46:13 +0000 (12:46 -0700)]
[flang] Parameterize Expr on a type, not category+kind

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

6 years ago[flang] Better folding infrastructure checkpoint
peter klausler [Fri, 20 Jul 2018 19:19:09 +0000 (12:19 -0700)]
[flang] Better folding infrastructure checkpoint

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

6 years ago[flang] Be more clear that constants in expressions are scalars now.
peter klausler [Thu, 19 Jul 2018 20:30:17 +0000 (13:30 -0700)]
[flang] Be more clear that constants in expressions are scalars now.

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

6 years ago[flang] reformat
peter klausler [Thu, 19 Jul 2018 17:12:25 +0000 (10:12 -0700)]
[flang] reformat

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

6 years ago[flang] checkpoint
peter klausler [Thu, 19 Jul 2018 16:53:42 +0000 (09:53 -0700)]
[flang] checkpoint

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

6 years ago[flang] Begin semantic analysis of expressions.
peter klausler [Fri, 13 Jul 2018 23:55:11 +0000 (16:55 -0700)]
[flang] Begin semantic analysis of expressions.

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

6 years ago[flang] Use const_cast instead of static_cast for clarity.
peter klausler [Fri, 13 Jul 2018 22:55:51 +0000 (15:55 -0700)]
[flang] Use const_cast instead of static_cast for clarity.

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

6 years ago[flang] More comments about 0**0.
peter klausler [Fri, 13 Jul 2018 22:45:53 +0000 (15:45 -0700)]
[flang] More comments about 0**0.

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

6 years ago[flang] 0**0 case
peter klausler [Fri, 13 Jul 2018 22:24:22 +0000 (15:24 -0700)]
[flang] 0**0 case

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

6 years ago[flang] Fold integer powers
peter klausler [Fri, 13 Jul 2018 22:04:13 +0000 (15:04 -0700)]
[flang] Fold integer powers

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

6 years ago[flang] Better folding.
peter klausler [Fri, 13 Jul 2018 18:35:30 +0000 (11:35 -0700)]
[flang] Better folding.

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

6 years ago[flang] Finish data hiding in variable.h.
peter klausler [Thu, 12 Jul 2018 23:58:21 +0000 (16:58 -0700)]
[flang] Finish data hiding in variable.h.

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

6 years ago[flang] more data hiding
peter klausler [Thu, 12 Jul 2018 23:07:43 +0000 (16:07 -0700)]
[flang] more data hiding

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

6 years ago[flang] Pull indirection into some constructors.
peter klausler [Thu, 12 Jul 2018 16:40:18 +0000 (09:40 -0700)]
[flang] Pull indirection into some constructors.

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

6 years ago[flang] Data hiding
peter klausler [Wed, 11 Jul 2018 23:36:43 +0000 (16:36 -0700)]
[flang] Data hiding

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

6 years ago[flang] checkpoint once everything builds again
peter klausler [Wed, 11 Jul 2018 21:50:08 +0000 (14:50 -0700)]
[flang] checkpoint once everything builds again

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

6 years ago[flang] issue#134
peter klausler [Fri, 20 Jul 2018 20:06:23 +0000 (13:06 -0700)]
[flang] issue#134

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

6 years ago[flang] Merge pull request flang-compiler/f18#143 from flang-compiler/pmk1
Peter Klausler [Tue, 24 Jul 2018 21:30:29 +0000 (14:30 -0700)]
[flang] Merge pull request flang-compiler/f18#143 from flang-compiler/pmk1

issue#142 fix

Original-commit: flang-compiler/f18@69c72ac9551b219044f89ab657d51575bdc4415e
Reviewed-on: https://github.com/flang-compiler/f18/pull/143

6 years ago[flang] issue#142, some refactoring of common patterns in basic-parsers.h, and reform...
peter klausler [Tue, 24 Jul 2018 20:51:27 +0000 (13:51 -0700)]
[flang] issue#142, some refactoring of common patterns in basic-parsers.h, and reformatting

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

6 years ago[flang] Merge pull request flang-compiler/f18#140 from flang-compiler/omppar
hsuauthai [Mon, 23 Jul 2018 18:22:30 +0000 (11:22 -0700)]
[flang] Merge pull request flang-compiler/f18#140 from flang-compiler/omppar

Add predefined macro _OPENMP to 201511  - yyyymm of the OpenMP 4.5 Spec.

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

6 years ago[flang] Add predefined macro _OPENMP to 201511 - yyyymm of the OpenMP Spec.
Hongyon Suauthai [Mon, 23 Jul 2018 17:43:44 +0000 (10:43 -0700)]
[flang] Add predefined macro _OPENMP to 201511  - yyyymm of the OpenMP Spec.

Original-commit: flang-compiler/f18@859912b54ed795e063c31ab11d4c1ce45724421b
Reviewed-on: https://github.com/flang-compiler/f18/pull/140

6 years ago[flang] Merge pull request flang-compiler/f18#137 from flang-compiler/omppar
hsuauthai [Fri, 20 Jul 2018 22:49:19 +0000 (15:49 -0700)]
[flang] Merge pull request flang-compiler/f18#137 from flang-compiler/omppar

Omppar

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

Due to a conflicting rebase during the linearizing of flang-compiler/f18, this commit squashes a number of other commits:

flang-compiler/f18@cfbc8bd16b1c63da4f8cb5f501766f52e7f862d5 Add OpenMP Block directives and some declarative directive(TBD:declare reduction and declare target)
flang-compiler/f18@d198352f840ad51aa6ab944043e8879239ff5d15 Removed extra code from resolveing conflict of the merge.
flang-compiler/f18@85911a0e80b81913f9372456b7fdd0875777915c fix some grammar and unparsing.
flang-compiler/f18@43bcfb7cd3efb80ad15b5b853af6527981ef8182 OpenMP declartive directive can be after function declaration line. OpenMP Loop construct will be treated as if statement instead of block because currently parser cannot construct the loop if loop end with Label [Continue] Use DefinedOperator and ProcedureDesignator instead of create a new Parser and postpone the validity of operator in semantic.
flang-compiler/f18@5d83b50ad344c889afffa26552827433489b63da Merge branch 'master' into omppar
flang-compiler/f18@8c666436a5d29785a6480d4741d374fd0a5b3227 remove "HEAD" code and resolve conflict.

6 years ago[flang] Merge pull request flang-compiler/f18#132 from flang-compiler/tsk5
Tim Keith [Fri, 20 Jul 2018 17:58:56 +0000 (10:58 -0700)]
[flang] Merge pull request flang-compiler/f18#132 from flang-compiler/tsk5

Support writing interfaces in module files.

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

6 years ago[flang] Correctly resolve generics with forward references
Tim Keith [Fri, 20 Jul 2018 17:46:11 +0000 (10:46 -0700)]
[flang] Correctly resolve generics with forward references

When a procedure is included by name in a generic (either with a
procedure statement in a generic interface or with a generic statement)
we can't immediately resolve it to a subprogram symbol. That is because
the subprogram may be defined later in the specification part. Instead,
collect the names (and whether they should be module procedures) and
resolve them to symbols at the end of the specification part. Also
detect duplicate names then.

This is needed for module file reading as these forward references can
occur there.

Write generics to module file using generic statements. This allows us to
include the access-spec.

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

6 years ago[flang] Support writing interfaces in module files.
Tim Keith [Thu, 19 Jul 2018 20:28:24 +0000 (13:28 -0700)]
[flang] Support writing interfaces in module files.

Write symbols for external subprogram interfaces as interface-stmts.
Those go in the decls part of the module file, as opposed to contained
subprograms which go in the contains part. See modfile06.f90.

Write symbols with GenericDetails to module files. The specific
procedures of a generic interface are always written as procedure-stmts.
If they also have specific interfaces those are written in a separate
interface-stmt. See modfile07.f90.

Fix a bug where `real, external :: f` was not written like
`real f; external f`. We have to notice the EXTERNAL attribute on the
type-declaration-stmt and convert the entity to a procedure entity.
See modfile08.f90.

Fix a bug where a use-associated symbol is referenced in a
procedure-designator. We were not resolving that correctly.

Change ModFileWriter::PutEntity to include the kind of Details when
it reports an internal error due to a kind it can't handle.
Make DetailsToString public to support that.

Change test_errors.sh to fail if the f18 command exits due to a signal.
We were missing bugs where the correct errors were written out but then
module file writing crashed (due to failure to handle generics mentioned
above). Non-zero exit status is okay because we are expecting
compilation errors.

Change test_modfile.sh to allow for the expected module file contents to
be indented so the tests are easier to read.

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

6 years ago[flang] Merge pull request flang-compiler/f18#133 from flang-compiler/pmk1
Peter Klausler [Fri, 20 Jul 2018 16:33:15 +0000 (09:33 -0700)]
[flang] Merge pull request flang-compiler/f18#133 from flang-compiler/pmk1

Fix remaining bugs with backslash escapes in character literals

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

6 years ago[flang] Pass -Mnobackslash to pgf90 unless f18 -fbackslash is used.
peter klausler [Thu, 19 Jul 2018 22:50:39 +0000 (15:50 -0700)]
[flang] Pass -Mnobackslash to pgf90 unless f18 -fbackslash is used.

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

6 years ago[flang] prep for merge
peter klausler [Thu, 19 Jul 2018 22:42:00 +0000 (15:42 -0700)]
[flang] prep for merge

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

6 years ago[flang] Really fix backslash escapes.
peter klausler [Thu, 19 Jul 2018 22:35:55 +0000 (15:35 -0700)]
[flang] Really fix backslash escapes.

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

6 years ago[flang] Merge pull request flang-compiler/f18#130 from flang-compiler/pmk1
Peter Klausler [Thu, 19 Jul 2018 16:55:24 +0000 (09:55 -0700)]
[flang] Merge pull request flang-compiler/f18#130 from flang-compiler/pmk1

Roll up parsing changes for several topics

Original-commit: flang-compiler/f18@57e051eafa1088e83c7d1cef565add6903aed20a
Reviewed-on: https://github.com/flang-compiler/f18/pull/130

6 years ago[flang] Ready for merge.
peter klausler [Wed, 18 Jul 2018 19:54:30 +0000 (12:54 -0700)]
[flang] Ready for merge.

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

6 years ago[flang] Do not enable OpenMP by default, oops.
peter klausler [Wed, 18 Jul 2018 18:37:15 +0000 (11:37 -0700)]
[flang] Do not enable OpenMP by default, oops.

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

6 years ago[flang] Define LanguageFeatureControl, use it everywhere.
peter klausler [Wed, 18 Jul 2018 18:19:21 +0000 (11:19 -0700)]
[flang] Define LanguageFeatureControl, use it everywhere.

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

6 years ago[flang] Better language feature enablement and warnings.
peter klausler [Tue, 17 Jul 2018 23:58:21 +0000 (16:58 -0700)]
[flang] Better language feature enablement and warnings.

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

6 years ago[flang] Another SUBMODULE unparsing tweak, and restore buildability with gcc < 8.1
peter klausler [Tue, 17 Jul 2018 20:35:41 +0000 (13:35 -0700)]
[flang] Another SUBMODULE unparsing tweak, and restore buildability with gcc < 8.1

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

6 years ago[flang] Fix clang build warning in mod-file.cc
peter klausler [Tue, 17 Jul 2018 19:51:54 +0000 (12:51 -0700)]
[flang] Fix clang build warning in mod-file.cc

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

6 years ago[flang] Address issue#125, flang-compiler/f18#115, and improve error recovery on...
peter klausler [Tue, 17 Jul 2018 19:34:07 +0000 (12:34 -0700)]
[flang] Address issue#125, flang-compiler/f18#115, and improve error recovery on previous issues.

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

6 years ago[flang] Merge pull request flang-compiler/f18#131 from flang-compiler/tsk2
Tim Keith [Thu, 19 Jul 2018 14:52:34 +0000 (07:52 -0700)]
[flang] Merge pull request flang-compiler/f18#131 from flang-compiler/tsk2

Update module file documentation

Original-commit: flang-compiler/f18@8981007d1c2093320cf671648ea139b20fefe9ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/131

6 years ago[flang] Update module file documentation
Tim Keith [Wed, 18 Jul 2018 19:39:34 +0000 (12:39 -0700)]
[flang] Update module file documentation

Address some review comments, add more information.

Original-commit: flang-compiler/f18@75c97b6f9bf6a5274e0e2398312587d92d3e0064
Reviewed-on: https://github.com/flang-compiler/f18/pull/131

6 years ago[flang] Merge pull request flang-compiler/f18#127 from flang-compiler/tsk5
Tim Keith [Wed, 18 Jul 2018 13:58:33 +0000 (06:58 -0700)]
[flang] Merge pull request flang-compiler/f18#127 from flang-compiler/tsk5

Use brace initialization with auto

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

6 years ago[flang] Use brace initialization in tools/f18
Tim Keith [Tue, 17 Jul 2018 14:05:35 +0000 (07:05 -0700)]
[flang] Use brace initialization in tools/f18

Also reformat dump.cc.

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

6 years ago[flang] Use brace initialization in lib/semantics
Tim Keith [Tue, 17 Jul 2018 14:02:30 +0000 (07:02 -0700)]
[flang] Use brace initialization in lib/semantics

Syntax only, no functional changes.

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

6 years ago[flang] Merge pull request flang-compiler/f18#129 from flang-compiler/tsk2
Tim Keith [Wed, 18 Jul 2018 00:21:55 +0000 (17:21 -0700)]
[flang] Merge pull request flang-compiler/f18#129 from flang-compiler/tsk2

Fix test script portability problems.

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

6 years ago[flang] Fix test script portability problems.
Tim Keith [Tue, 17 Jul 2018 23:43:20 +0000 (16:43 -0700)]
[flang] Fix test script portability problems.

Allow for bash anywhere on path.

Allow for utilites to be in /bin as well as /usr/bin.

Don't count on sed understanding '\t'.

The options to mktemp aren't portable. Instead just create a per-test
temp directory in the working directory (i.e. <build-dir>/test/semantics).
Setting the KEEP environment variable causes them all to be kept to help
in investigating failures.

Fixes flang-compiler/f18#128.

Original-commit: flang-compiler/f18@3736ceeca83965e3c9e282e92ddb6323523b9e5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/129

6 years ago[flang] Merge pull request flang-compiler/f18#126 from flang-compiler/tsk5
Tim Keith [Tue, 17 Jul 2018 13:41:59 +0000 (06:41 -0700)]
[flang] Merge pull request flang-compiler/f18#126 from flang-compiler/tsk5

Implement writing of .mod files.

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

6 years ago[flang] Handle VOLATILE or ASYNCHRONOUS added to use-associated entity
Tim Keith [Tue, 17 Jul 2018 13:39:38 +0000 (06:39 -0700)]
[flang] Handle VOLATILE or ASYNCHRONOUS added to use-associated entity

When a symbol is use-associated, the VOLATILE and ASYNCHRONOUS
attributes can be added. When that happens it must be recorded
in the .mod file.

Original-commit: flang-compiler/f18@44fa9e5ba4172f75abe4194e7f58b26a99646cdc
Reviewed-on: https://github.com/flang-compiler/f18/pull/126

6 years ago[flang] Fix typo
Tim Keith [Mon, 16 Jul 2018 23:45:58 +0000 (16:45 -0700)]
[flang] Fix typo

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

6 years ago[flang] Add a .mod file test with subprograms
Tim Keith [Mon, 16 Jul 2018 23:44:07 +0000 (16:44 -0700)]
[flang] Add a .mod file test with subprograms

The .mod file just contains the API. Test that prefixes and suffixes
on the declaration get correctly persisted.

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

6 years ago[flang] Initial documentation for .mod files
Tim Keith [Mon, 16 Jul 2018 23:26:14 +0000 (16:26 -0700)]
[flang] Initial documentation for .mod files

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

6 years ago[flang] Add tests for .mod file writing
Tim Keith [Mon, 16 Jul 2018 23:24:14 +0000 (16:24 -0700)]
[flang] Add tests for .mod file writing

The source files contain the expected contents of generated .mod files.
`test_modfile.sh` compiles the source file and verifies that the correct
.mod files are generated.

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

6 years ago[flang] Implement writing of .mod files.
Tim Keith [Mon, 16 Jul 2018 23:23:18 +0000 (16:23 -0700)]
[flang] Implement writing of .mod files.

Module file writing is implemented in mod-file.cc. They need to be
written after all semantic checking. Until then, for testing, write
them out whenever names are resolved.

There is a header comment in the .mod files but it is mostly a
placeholder until we can read them in and do something with it.

Rename `Symbol::details<D>` to `Symbol::get<D>`. This asserts that the
details of the symbol match D and returns that type. But we need a way
to access the details as a variant as well (not just one of its types).
`details()` is the best name for that, especially as we already have
`set_details()`. Renaming the old `details` to `get` also better matches
`has` which is used to check which variant is present.

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

6 years ago[flang] Merge pull request flang-compiler/f18#123 from flang-compiler/pmk1
Peter Klausler [Thu, 12 Jul 2018 23:43:17 +0000 (16:43 -0700)]
[flang] Merge pull request flang-compiler/f18#123 from flang-compiler/pmk1

Improve error recovery further, using a test case from Tim.

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

6 years ago[flang] Improve error recovery further, using a test case from Tim.
peter klausler [Thu, 12 Jul 2018 23:23:25 +0000 (16:23 -0700)]
[flang] Improve error recovery further, using a test case from Tim.

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

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

Fix two problems described in issue#121

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

6 years ago[flang] Extend documentation on extensions.
peter klausler [Thu, 12 Jul 2018 22:32:31 +0000 (15:32 -0700)]
[flang] Extend documentation on extensions.

Original-commit: flang-compiler/f18@672e468252b221d53e5b87aad805b42820b2bfff
Reviewed-on: https://github.com/flang-compiler/f18/pull/122

6 years ago[flang] Tweak code for readability and maybe better performance.
peter klausler [Thu, 12 Jul 2018 22:05:34 +0000 (15:05 -0700)]
[flang] Tweak code for readability and maybe better performance.

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

6 years ago[flang] More documentation. These changes fix two bugs noted in f18 issue#121.
peter klausler [Thu, 12 Jul 2018 21:58:06 +0000 (14:58 -0700)]
[flang] More documentation.  These changes fix two bugs noted in f18 issue#121.

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

6 years ago[flang] Allow empty statements and improve error recovery error messages.
peter klausler [Thu, 12 Jul 2018 21:46:23 +0000 (14:46 -0700)]
[flang] Allow empty statements and improve error recovery error messages.

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

6 years ago[flang] Merge pull request flang-compiler/f18#120 from flang-compiler/tsk1
Tim Keith [Thu, 12 Jul 2018 17:15:46 +0000 (10:15 -0700)]
[flang] Merge pull request flang-compiler/f18#120 from flang-compiler/tsk1

Support intent-stmt and resolve subprogram prefixes and suffixes.

Original-commit: flang-compiler/f18@2206d453e1e7554f09ab01cfb5da8d48b5691cfd
Reviewed-on: https://github.com/flang-compiler/f18/pull/120

6 years ago[flang] Sort enumerators in `enum class Attr`.
Tim Keith [Thu, 12 Jul 2018 17:14:58 +0000 (10:14 -0700)]
[flang] Sort enumerators in `enum class Attr`.

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

6 years ago[flang] Support intent-stmt and resolve subprogram prefixes and suffixes.
Tim Keith [Thu, 12 Jul 2018 00:45:13 +0000 (17:45 -0700)]
[flang] Support intent-stmt and resolve subprogram prefixes and suffixes.

Recognize `IntentStmt` and use `HandleAttributeStmt()` to implement it
as is done with other attribute statements. Add `Attr::INTENT_INOUT` as
a separate attribute for `INTENT(INOUT)`.

Collect attributes from the prefix and suffix of `FunctionStmt` and
`SubroutineStmt` (including `BIND(C)`) and set them on the subprogram
symbol.

Create a test for this using `test_symbol.sh`. It compiles with
`-funparse-with-symbols` and compares the output with the symbols in
comments in the input.

Change `test_errors.sh` to be similar to `test_symbol.sh`: check usage
and allow `F18` environment variable to override the path to the
compiler.

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

6 years ago[flang] Merge pull request flang-compiler/f18#119 from flang-compiler/pmk1
Peter Klausler [Wed, 11 Jul 2018 21:50:59 +0000 (14:50 -0700)]
[flang] Merge pull request flang-compiler/f18#119 from flang-compiler/pmk1

Use braces in `auto` initializers in lib/{parser,common,evaluate}

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

6 years ago[flang] Documentation
peter klausler [Wed, 11 Jul 2018 17:26:53 +0000 (10:26 -0700)]
[flang] Documentation

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

6 years ago[flang] merge and reformat
peter klausler [Wed, 11 Jul 2018 17:22:05 +0000 (10:22 -0700)]
[flang] merge and reformat

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

6 years ago[flang] correct typo in unparse.cc found in test
peter klausler [Wed, 11 Jul 2018 15:35:18 +0000 (08:35 -0700)]
[flang] correct typo in unparse.cc found in test

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

6 years ago[flang] Use braces for auto initialization in lib/common and lib/evaluate
peter klausler [Wed, 11 Jul 2018 00:11:12 +0000 (17:11 -0700)]
[flang] Use braces for auto initialization in lib/common and lib/evaluate

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

6 years ago[flang] Use braces in auto initializers.
peter klausler [Wed, 11 Jul 2018 00:09:07 +0000 (17:09 -0700)]
[flang] Use braces in auto initializers.

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

6 years ago[flang] Merge pull request flang-compiler/f18#118 from flang-compiler/pmk2
Peter Klausler [Wed, 11 Jul 2018 17:18:49 +0000 (10:18 -0700)]
[flang] Merge pull request flang-compiler/f18#118 from flang-compiler/pmk2

Better error recovery in the face of input that's not Fortran at all

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

6 years ago[flang] Better error recovery (for a case from Tim) and fix a problem where context...
peter klausler [Tue, 10 Jul 2018 23:09:21 +0000 (16:09 -0700)]
[flang] Better error recovery (for a case from Tim) and fix a problem where context is lost.

Original-commit: flang-compiler/f18@522822fd5a44aee41998e25f0691e44cbaaa202c
Reviewed-on: https://github.com/flang-compiler/f18/pull/118

6 years ago[flang] Merge pull request flang-compiler/f18#117 from flang-compiler/pmk1
Peter Klausler [Tue, 10 Jul 2018 17:58:34 +0000 (10:58 -0700)]
[flang] Merge pull request flang-compiler/f18#117 from flang-compiler/pmk1

Variables

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

6 years ago[flang] Extend documentation
peter klausler [Tue, 10 Jul 2018 17:56:55 +0000 (10:56 -0700)]
[flang] Extend documentation

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

6 years ago[flang] Address review comments
peter klausler [Tue, 10 Jul 2018 17:18:34 +0000 (10:18 -0700)]
[flang] Address review comments

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

6 years ago[flang] Resolve build issues with older compilers.
peter klausler [Mon, 9 Jul 2018 23:23:12 +0000 (16:23 -0700)]
[flang] Resolve build issues with older compilers.

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

6 years ago[flang] Refine variable structure definitions, add references to Standard.
peter klausler [Mon, 9 Jul 2018 19:46:51 +0000 (12:46 -0700)]
[flang] Refine variable structure definitions, add references to Standard.

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

6 years ago[flang] Start cleaning up for merging.
peter klausler [Fri, 6 Jul 2018 23:59:05 +0000 (16:59 -0700)]
[flang] Start cleaning up for merging.

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

6 years ago[flang] Use Indirection. Get variables to work in int expressions.
peter klausler [Fri, 6 Jul 2018 22:12:33 +0000 (15:12 -0700)]
[flang] Use Indirection.  Get variables to work in int expressions.

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

6 years ago[flang] More abstraction in expressions.
peter klausler [Thu, 5 Jul 2018 21:19:19 +0000 (14:19 -0700)]
[flang] More abstraction in expressions.

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

6 years ago[flang] tweaks
peter klausler [Thu, 5 Jul 2018 17:47:01 +0000 (10:47 -0700)]
[flang] tweaks

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

6 years ago[flang] clean up dumping code
peter klausler [Thu, 5 Jul 2018 16:39:39 +0000 (09:39 -0700)]
[flang] clean up dumping code

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

6 years ago[flang] Fix issue flang-compiler/f18#113.
peter klausler [Tue, 3 Jul 2018 23:17:52 +0000 (16:17 -0700)]
[flang] Fix issue flang-compiler/f18#113.

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

6 years ago[flang] work on variables and traversal
peter klausler [Tue, 3 Jul 2018 22:14:48 +0000 (15:14 -0700)]
[flang] work on variables and traversal

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

6 years ago[flang] Commit work in progress to branch for f18 repository move.
peter klausler [Tue, 26 Jun 2018 22:18:53 +0000 (15:18 -0700)]
[flang] Commit work in progress to branch for f18 repository move.

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

6 years ago[flang] Merge pull request flang-compiler/f18#116 from flang-compiler/tsk8
Tim Keith [Mon, 9 Jul 2018 23:02:23 +0000 (16:02 -0700)]
[flang] Merge pull request flang-compiler/f18#116 from flang-compiler/tsk8

Fix bug recognizing derived type constructor call

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

6 years ago[flang] Fix bug recognizing derived type constructor call
Tim Keith [Mon, 9 Jul 2018 22:25:49 +0000 (15:25 -0700)]
[flang] Fix bug recognizing derived type constructor call

A ProcedureDesignator is a derived type constructor call if the name
resolves to a derived type. We need to recognize it as such and not
report an error. It may be in another derived type so we have to call
FindSymbol() first to find the derived type.

Most of the diffs are due to `symbol` changing from a reference to a
pointer.

In this example we were reporting an error on the first `t1()` and
resolving the second as an external function call.
```
module m
  type :: t1
  end type
  type(t1) :: x = t1()
  type t2
    type(t1) :: y = t1()
  end type
end module
```

Original-commit: flang-compiler/f18@717b22ca2b9e7ade24454b90b980f8c825fe4b12
Reviewed-on: https://github.com/flang-compiler/f18/pull/116

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