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

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

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

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

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

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

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

Module file improvements

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

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

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

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

Verify that checksums are correct when reading a module file.

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

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

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

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

Roll up work on folding, descriptors, runtime, RESHAPE

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Restore buildability with clang

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

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

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

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

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

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

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

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

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

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

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

 Add support for submodules

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Better program unit END statement error recovery.

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

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

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

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

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

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

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

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

issue#153

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

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

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

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

issue#152 and a little clean-up

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

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

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

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

Tweaks to source provenance and messaging in support of module files

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

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

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

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

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

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

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

6 years ago[flang] Let multiple CookedSource instances share a ref-counted AllSources.
peter klausler [Fri, 27 Jul 2018 21:58:14 +0000 (14:58 -0700)]
[flang] Let multiple CookedSource instances share a ref-counted AllSources.

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

6 years ago[flang] Support resolution of provenances in messages from CharBlocks to ProvenanceRanges
peter klausler [Fri, 27 Jul 2018 21:01:19 +0000 (14:01 -0700)]
[flang] Support resolution of provenances in messages from CharBlocks to ProvenanceRanges

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

6 years ago[flang] complete merge to current master
peter klausler [Fri, 27 Jul 2018 20:38:24 +0000 (13:38 -0700)]
[flang] complete merge to current master

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

6 years ago[flang] fix double deallocation bug from previous commit
peter klausler [Fri, 27 Jul 2018 20:10:01 +0000 (13:10 -0700)]
[flang] fix double deallocation bug from previous commit

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

6 years ago[flang] Tweaks to provenance data structures, in preparation for better module file...
peter klausler [Fri, 27 Jul 2018 18:44:31 +0000 (11:44 -0700)]
[flang] Tweaks to provenance data structures, in preparation for better module file support.

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

6 years ago[flang] Merge pull request flang-compiler/f18#149 from flang-compiler/tsk5
Tim Keith [Fri, 27 Jul 2018 17:57:29 +0000 (10:57 -0700)]
[flang] Merge pull request flang-compiler/f18#149 from flang-compiler/tsk5

Refactor ModFileReader to use parser::Parsing

Original-commit: flang-compiler/f18@451e9e4ee45304e8aaad828cf6a87844d6be8f40
Reviewed-on: https://github.com/flang-compiler/f18/pull/149

6 years ago[flang] Remove unnecessary unique_ptr.
Tim Keith [Fri, 27 Jul 2018 15:12:37 +0000 (08:12 -0700)]
[flang] Remove unnecessary unique_ptr.

The unique_ptr around the vector of char was unnecessary. We can just
move the vector itself and it still keeps the same stream of chars.

Original-commit: flang-compiler/f18@24672adba9fb38703cc88b2b7ff35b6c8824e918
Reviewed-on: https://github.com/flang-compiler/f18/pull/149

6 years ago[flang] Change how cooked source is saved
Tim Keith [Thu, 26 Jul 2018 21:33:41 +0000 (14:33 -0700)]
[flang] Change how cooked source is saved

Rather than save the entire CookedSource object in the module scope,
all we need is the vector of characters that CharBlock has references
into. This avoids the problem that CookedSource object has a dangling
reference to an AllSources object (which shouldn't be needed by the
CharBlocks in the symbol table, but is there).

This also decouples Scope from parser classes other than CharBlock.

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

6 years ago[flang] Refactor ModFileReader to use parser::Parsing
Tim Keith [Thu, 26 Jul 2018 17:57:51 +0000 (10:57 -0700)]
[flang] Refactor ModFileReader to use parser::Parsing

parser::Parsing does most of the work needed to prescan and parse a file.
The only problem is that for module files we need to take ownership of
the cooked character stream so that it lives as long as the module scope
does.

To achieve this, change Parsing::cooked_ to be a unique_ptr and add a
member function to allow the caller to take ownership of it.

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

6 years ago[flang] Update README.md (flang-compiler/f18#150)
Austin Wells [Fri, 27 Jul 2018 15:46:33 +0000 (11:46 -0400)]
[flang] Update README.md (flang-compiler/f18#150)

Corrected the URL  in README.md to point to the correct public URL for this repository.

Original-commit: flang-compiler/f18@7005e9ad7b9597e946dd8ea6bb40a978f8326e03
Reviewed-on: https://github.com/flang-compiler/f18/pull/150

6 years ago[flang] Merge pull request flang-compiler/f18#147 from flang-compiler/tsk5
Tim Keith [Thu, 26 Jul 2018 17:40:27 +0000 (10:40 -0700)]
[flang] Merge pull request flang-compiler/f18#147 from flang-compiler/tsk5

Add support for -module option

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

6 years ago[flang] Add support for -module option
Tim Keith [Thu, 26 Jul 2018 00:07:38 +0000 (17:07 -0700)]
[flang] Add support for -module option

The `-module` option specifies where to write module files. It is also
the first place search for modules files. The current options name and
behavior match PGI compilers.

To support this, reorganize `ModFileWriter` to be more like `ModFileReader`.
The gives the client a way to set the output directory and fetch the
error messages. A bunch of static member functions in `ModFileWriter`
were changed to non-member functions so they didn't need to be exposed
in `mod-files.h`.

Original-commit: flang-compiler/f18@2717846e81a6be325a6eaec73c22eae5a7cf6577
Reviewed-on: https://github.com/flang-compiler/f18/pull/147

6 years ago[flang] Merge pull request flang-compiler/f18#146 from flang-compiler/pmk1
Peter Klausler [Wed, 25 Jul 2018 20:14:34 +0000 (13:14 -0700)]
[flang] Merge pull request flang-compiler/f18#146 from flang-compiler/pmk1

OpenMP conditional compilation lines

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

6 years ago[flang] OpenMP conditional compilation lines
peter klausler [Wed, 25 Jul 2018 18:44:20 +0000 (11:44 -0700)]
[flang] OpenMP conditional compilation lines

Original-commit: flang-compiler/f18@5602f7e041bf9d58bf88d5d86dc1900d102d899c
Reviewed-on: https://github.com/flang-compiler/f18/pull/146

6 years ago[flang] Merge pull request flang-compiler/f18#145 from flang-compiler/tsk5
Tim Keith [Wed, 25 Jul 2018 17:11:38 +0000 (10:11 -0700)]
[flang] Merge pull request flang-compiler/f18#145 from flang-compiler/tsk5

Implement reading of module files

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

6 years ago[flang] Implement reading of module files
Tim Keith [Wed, 25 Jul 2018 13:55:11 +0000 (06:55 -0700)]
[flang] Implement reading of module files

When a use-stmt is encountered for a module that isn't in the global
scope, search for and read the appropriate `.mod` file. To perform the
search, pass the search directories in to ResolveNames.

For modules that were read from `.mod` files, we have to keep the cooked
source from being deleted so that the names so that references to names
stay valid. So we store the cooked source in the Scope of the module as
a `unique_ptr`.

Add `Symbol::Flag::ModFile` to distinguish module symbols that were read
from a `.mod` file rather than from the current compilation. Use it to
prevent writing those back out.

Fix test_errors.sh to run the compiler in the temp subdirectory --
otherwise tests could be affected by `.mod` files left from previous
tests.

Original-commit: flang-compiler/f18@207065999ce09ca7361aeb0262d1b8bf8cf4b99e
Reviewed-on: https://github.com/flang-compiler/f18/pull/145

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