platform/upstream/llvm.git
6 years ago[flang] Adjust productions in grammar.h so that construct<> invocations span what...
peter klausler [Tue, 10 Apr 2018 00:03:49 +0000 (17:03 -0700)]
[flang] Adjust productions in grammar.h so that construct<> invocations span what they cover (more to come)

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

6 years ago[flang] Merge pull request flang-compiler/f18#67 from ThePortlandGroup/tsk3
Tim Keith [Tue, 24 Apr 2018 19:30:09 +0000 (12:30 -0700)]
[flang] Merge pull request flang-compiler/f18#67 from ThePortlandGroup/tsk3

Create Message instances with provenance range.

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

6 years ago[flang] Create Message instances with provenance range.
Tim Keith [Mon, 23 Apr 2018 23:18:48 +0000 (16:18 -0700)]
[flang] Create Message instances with provenance range.

This allows the message to point to the full name or statement
rather than just the first character.

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

6 years ago[flang] Merge pull request flang-compiler/f18#68 from ThePortlandGroup/pmk-scrub2
Peter Klausler [Tue, 24 Apr 2018 17:45:23 +0000 (10:45 -0700)]
[flang] Merge pull request flang-compiler/f18#68 from ThePortlandGroup/pmk-scrub2

Remove needless empty braces from construct<>() calls.

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

6 years ago[flang] Remove needless empty braces from construct<>() calls.
peter klausler [Mon, 23 Apr 2018 23:53:16 +0000 (16:53 -0700)]
[flang] Remove needless empty braces from construct<>() calls.

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

6 years ago[flang] Merge pull request flang-compiler/f18#66 from ThePortlandGroup/pmk-scrub
Peter Klausler [Mon, 23 Apr 2018 22:54:38 +0000 (15:54 -0700)]
[flang] Merge pull request flang-compiler/f18#66 from ThePortlandGroup/pmk-scrub

Code clean-up & provenance ranges on messages

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

6 years ago[flang] Delete more dead code.
peter klausler [Mon, 23 Apr 2018 19:38:49 +0000 (12:38 -0700)]
[flang] Delete more dead code.

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

6 years ago[flang] Remove dead code.
peter klausler [Mon, 23 Apr 2018 19:25:43 +0000 (12:25 -0700)]
[flang] Remove dead code.

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

6 years ago[flang] Use ranges of provenances in messages.
peter klausler [Mon, 23 Apr 2018 19:17:11 +0000 (12:17 -0700)]
[flang] Use ranges of provenances in messages.

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

6 years ago[flang] Extend Message representation to cover ranges.
peter klausler [Fri, 20 Apr 2018 23:56:58 +0000 (16:56 -0700)]
[flang] Extend Message representation to cover ranges.

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

6 years ago[flang] Finish cleaning up debug-parser.
peter klausler [Fri, 20 Apr 2018 23:14:57 +0000 (16:14 -0700)]
[flang] Finish cleaning up debug-parser.

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

6 years ago[flang] Split debug-parser.h, put code into debug-parser.cc.
peter klausler [Fri, 20 Apr 2018 22:56:19 +0000 (15:56 -0700)]
[flang] Split debug-parser.h, put code into debug-parser.cc.

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

6 years ago[flang] Finish moving user state action parsers into user-state.{h,cc}.
peter klausler [Fri, 20 Apr 2018 22:47:40 +0000 (15:47 -0700)]
[flang] Finish moving user state action parsers into user-state.{h,cc}.

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

6 years ago[flang] More clean-up.
peter klausler [Fri, 20 Apr 2018 22:19:20 +0000 (15:19 -0700)]
[flang] More clean-up.

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

6 years ago[flang] Begin moving UserState action parsers into user-state.{h,cc}.
peter klausler [Fri, 20 Apr 2018 21:27:49 +0000 (14:27 -0700)]
[flang] Begin moving UserState action parsers into user-state.{h,cc}.

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

6 years ago[flang] Fix header file name.
peter klausler [Fri, 20 Apr 2018 21:09:29 +0000 (14:09 -0700)]
[flang] Fix header file name.

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

6 years ago[flang] Move Parser<> to its own header.
peter klausler [Fri, 20 Apr 2018 20:49:03 +0000 (13:49 -0700)]
[flang] Move Parser<> to its own header.

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

6 years ago[flang] Use references for ParseState arguments to parsers. Other minor clean-up.
peter klausler [Fri, 20 Apr 2018 18:23:51 +0000 (11:23 -0700)]
[flang] Use references for ParseState arguments to parsers.  Other minor clean-up.

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

6 years ago[flang] Merge pull request flang-compiler/f18#65 from ThePortlandGroup/tsk2
Tim Keith [Mon, 23 Apr 2018 22:38:21 +0000 (15:38 -0700)]
[flang] Merge pull request flang-compiler/f18#65 from ThePortlandGroup/tsk2

Rewrite function calls to array element references

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

6 years ago[flang] Undo previous commit.
Tim Keith [Mon, 23 Apr 2018 22:33:59 +0000 (15:33 -0700)]
[flang] Undo previous commit.

`name` depends on the template type, so we have to explicitly say
that `has` is a template with the `template` keyword.
Rather than do that I'm putting back the explicit type for name.

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

6 years ago[flang] Address review comment.
Tim Keith [Mon, 23 Apr 2018 20:10:33 +0000 (13:10 -0700)]
[flang] Address review comment.

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

6 years ago[flang] Rewrite function calls to array element references
Tim Keith [Mon, 23 Apr 2018 19:33:10 +0000 (12:33 -0700)]
[flang] Rewrite function calls to array element references

parse-tree.h, parse-tree.cc:
Add FunctionReference::ConvertToArrayElementRef() to convert a function
reference to an array element reference.
Factor out MakeArrayElementRef() to use in ConvertToArrayElementRef()
and also in converting statement functions to array element assignments.

resolve-names.cc:
Recognize references to functions and subroutines and add symbols for them.
Detect declaration conflicts from these and check `IMPLICIT NONE(EXTERNAL)`.

rewrite-parse-tree.cc:
Find function references that need to be converted and rewrite them.

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

6 years ago[flang] Merge pull request flang-compiler/f18#62 from ThePortlandGroup/pmk-instr
Peter Klausler [Fri, 20 Apr 2018 17:42:03 +0000 (10:42 -0700)]
[flang] Merge pull request flang-compiler/f18#62 from ThePortlandGroup/pmk-instr

Parser instrumentation and caching of failed parse attempts

Original-commit: flang-compiler/f18@30040ed22e9e8063e11e325e1afd9963773b53a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/62

6 years ago[flang] Complete parser instrumentation and caching of failures.
peter klausler [Fri, 20 Apr 2018 00:02:12 +0000 (17:02 -0700)]
[flang] Complete parser instrumentation and caching of failures.

Original-commit: flang-compiler/f18@9843dbf211bf2a2859aaa5451223e7d090a229ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/62

6 years ago[flang] Parser instrumentation and fail-fast experiment begun.
peter klausler [Thu, 19 Apr 2018 22:46:02 +0000 (15:46 -0700)]
[flang] Parser instrumentation and fail-fast experiment begun.

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

6 years ago[flang] First cut at parser instrumentation with pass/fail counters.
peter klausler [Thu, 19 Apr 2018 20:03:23 +0000 (13:03 -0700)]
[flang] First cut at parser instrumentation with pass/fail counters.

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

6 years ago[flang] Merge pull request flang-compiler/f18#61 from ThePortlandGroup/pmk-cset
Peter Klausler [Thu, 19 Apr 2018 20:51:46 +0000 (13:51 -0700)]
[flang] Merge pull request flang-compiler/f18#61 from ThePortlandGroup/pmk-cset

Define SetOfChars type, use it

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

6 years ago[flang] Address review comments.
peter klausler [Thu, 19 Apr 2018 20:51:25 +0000 (13:51 -0700)]
[flang] Address review comments.

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

6 years ago[flang] Finish repackaging SetOfChars
peter klausler [Thu, 19 Apr 2018 00:05:07 +0000 (17:05 -0700)]
[flang] Finish repackaging SetOfChars

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

6 years ago[flang] More repackaging
peter klausler [Wed, 18 Apr 2018 23:39:28 +0000 (16:39 -0700)]
[flang] More repackaging

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

6 years ago[flang] repackage SetOfChars as a class type
peter klausler [Wed, 18 Apr 2018 23:28:29 +0000 (16:28 -0700)]
[flang] repackage SetOfChars as a class type

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

6 years ago[flang] Combine expected character sets of messages ending at same point from two...
peter klausler [Wed, 18 Apr 2018 20:24:41 +0000 (13:24 -0700)]
[flang] Combine expected character sets of messages ending at same point from two alternatives.

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

6 years ago[flang] debugging
peter klausler [Wed, 18 Apr 2018 19:55:27 +0000 (12:55 -0700)]
[flang] debugging

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

6 years ago[flang] Define sets of characters; use them in parsing and messages.
peter klausler [Wed, 18 Apr 2018 18:26:17 +0000 (11:26 -0700)]
[flang] Define sets of characters; use them in parsing and messages.

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

6 years ago[flang] Merge pull request flang-compiler/f18#60 from ThePortlandGroup/tsk2
Tim Keith [Thu, 19 Apr 2018 17:47:48 +0000 (10:47 -0700)]
[flang] Merge pull request flang-compiler/f18#60 from ThePortlandGroup/tsk2

Implement parse tree rewriting.

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

6 years ago[flang] Move ConvertToAssignment into class StmtFunctionStmt.
Tim Keith [Thu, 19 Apr 2018 14:07:47 +0000 (07:07 -0700)]
[flang] Move ConvertToAssignment into class StmtFunctionStmt.

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

6 years ago[flang] Merge parse-tree-mutator.h into parse-tree-visitor.h
Tim Keith [Wed, 18 Apr 2018 23:49:42 +0000 (16:49 -0700)]
[flang] Merge parse-tree-mutator.h into parse-tree-visitor.h

Use the latter for visiting and mutating and delete the former.

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

6 years ago[flang] Address review comments.
Tim Keith [Wed, 18 Apr 2018 22:50:36 +0000 (15:50 -0700)]
[flang] Address review comments.

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

6 years ago[flang] Implement parse tree rewriting.
Tim Keith [Wed, 18 Apr 2018 22:06:35 +0000 (15:06 -0700)]
[flang] Implement parse tree rewriting.

Add parse-tree-mutator.h like parse-tree-visitor.h except that the Walk
functions take non-const references to parse tree nodes so the Pre and
Post methods of the mutator that are passed around can make changes to
the parse tree.

Change ExecutionPart to be a class that wraps a list so that it can be
identified during parse tree walking.

Add Symbol* field to parser::Name for the result of symbol resolution.
In parse tree dumper, dump symbol when it is there instead of just name.

Add RewriteParseTree to walk the parse tree, fill in resolved symbols in
Name nodes, and make necessary changes to the structure. Currently that
consists of rewriting statement functions as array assignments when
appropriate.

In ResolveNames, call RewriteParseTree if the resolution was successful.
Recognize a statement function that comes after a mis-identified
statement function and report an error. resolve08.f90 tests this case.

Add -fdebug-dump-symbols to dump the scope tree and symbols in each scope.
This is implemented by DumpSymbols in resolve-names.cc. Add an optional
symbol to scopes that correspond to symbols (e.g. subprograms). Remove
debug output from ResolveNamesVisitor as this option can be used instead.

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

6 years ago[flang] Merge pull request flang-compiler/f18#59 from ThePortlandGroup/pmk-messages
Peter Klausler [Wed, 18 Apr 2018 00:09:43 +0000 (17:09 -0700)]
[flang] Merge pull request flang-compiler/f18#59 from ThePortlandGroup/pmk-messages

Messaging work

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

6 years ago[flang] Defer message accumulation until it is known that messages will be produced.
peter klausler [Tue, 17 Apr 2018 22:47:51 +0000 (15:47 -0700)]
[flang] Defer message accumulation until it is known that messages will be produced.

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

6 years ago[flang] Suppress messages in lookAhead and negated parsers.
peter klausler [Tue, 17 Apr 2018 21:58:55 +0000 (14:58 -0700)]
[flang] Suppress messages in lookAhead and negated parsers.

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

6 years ago[flang] reformat
peter klausler [Tue, 17 Apr 2018 21:45:43 +0000 (14:45 -0700)]
[flang] reformat

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

6 years ago[flang] Remove questionable swap() routines in ParseState and Messages.
peter klausler [Tue, 17 Apr 2018 21:45:12 +0000 (14:45 -0700)]
[flang] Remove questionable swap() routines in ParseState and Messages.

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

6 years ago[flang] Avoid a std::move() when emplacing new messages.
peter klausler [Tue, 17 Apr 2018 18:16:05 +0000 (11:16 -0700)]
[flang] Avoid a std::move() when emplacing new messages.

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

6 years ago[flang] Remove obsolete #if 0 code.
peter klausler [Tue, 17 Apr 2018 17:34:01 +0000 (10:34 -0700)]
[flang] Remove obsolete #if 0 code.

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

6 years ago[flang] Avoid std::shared_ptr<> in favor of reference counting.
peter klausler [Tue, 17 Apr 2018 17:28:25 +0000 (10:28 -0700)]
[flang] Avoid std::shared_ptr<> in favor of reference counting.

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

6 years ago[flang] Message experiment: defer all message generation until non-speculative.
peter klausler [Fri, 13 Apr 2018 23:00:03 +0000 (16:00 -0700)]
[flang] Message experiment: defer all message generation until non-speculative.

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

6 years ago[flang] Merge pull request flang-compiler/f18#58 from ThePortlandGroup/tsk1
Tim Keith [Tue, 17 Apr 2018 23:55:57 +0000 (16:55 -0700)]
[flang] Merge pull request flang-compiler/f18#58 from ThePortlandGroup/tsk1

Add statement functions to symbol table

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

6 years ago[flang] Address review comments.
Tim Keith [Tue, 17 Apr 2018 22:04:08 +0000 (15:04 -0700)]
[flang] Address review comments.

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

6 years ago[flang] Add statement functions to symbol table
Tim Keith [Tue, 17 Apr 2018 21:16:42 +0000 (14:16 -0700)]
[flang] Add statement functions to symbol table

SubprogramDetails: Store dummy args and result as symbols, not names.

Symbol: Save list of occurrences (i.e. SourceNames that map to the same
symbol). This is needed to map Names in the parse tree back to symbols,
and will probably be useful when reporting errors.
Improve dumping of symbols.

resolve-names.cc: Recognize statement functions. They are treated like
function subprograms but the result type and type of dummy arguments come
from the enclosing scope. The implicit rules from the enclosing scope need
to be copied in.

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

6 years ago[flang] Merge pull request flang-compiler/f18#57 from ThePortlandGroup/pmk-bugfix
Peter Klausler [Mon, 16 Apr 2018 23:21:07 +0000 (16:21 -0700)]
[flang] Merge pull request flang-compiler/f18#57 from ThePortlandGroup/pmk-bugfix

fix misrecogition of actual argument "a==b"

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

6 years ago[flang] fix misrecogition of actual argument "a==b" as keyword "a=" and value "=b"
peter klausler [Mon, 16 Apr 2018 16:39:45 +0000 (09:39 -0700)]
[flang] fix misrecogition of actual argument "a==b" as keyword "a=" and value "=b"

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

6 years ago[flang] Merge pull request flang-compiler/f18#56 from ThePortlandGroup/pmk-proc-component
Peter Klausler [Mon, 16 Apr 2018 20:52:45 +0000 (13:52 -0700)]
[flang] Merge pull request flang-compiler/f18#56 from ThePortlandGroup/pmk-proc-component

Simplify grammar for "variable" as used in proc-component-ref and pointer ass't

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

6 years ago[flang] Resolve array specifications of entities.
Tim Keith [Thu, 12 Apr 2018 19:59:42 +0000 (12:59 -0700)]
[flang] Resolve array specifications of entities.

Add ArraySpecVisitor to recognize the various forms of array specifications.
They are tracked in arraySpec_ and attrArraySpec_. Both are needed because
a declaration like `integer, dimension(4) :: x(2,2), y` has two different
array-specs.

The method DeclareEntity was extracted out to handle the common part for
EntityDecl, ObjectDecl, and DimensionStmt. AllocatableStmt and TargetStmt
are now handled through their contained ObjectDecl.

The test resolve07 checks the interactions between these kinds of declarations.

Rename ComponentArraySpec to ArraySpec as it doesn't just occur in components.

Fix some 'begin' and 'end' methods to start with upper-case letters.

Original-commit: flang-compiler/f18@113bfc4fe7781b11c3d3399254a6fcea1afeedd5
Reviewed-on: https://github.com/flang-compiler/f18/pull/56

6 years ago[flang] run clang-format
Stephane Chauveau [Thu, 12 Apr 2018 19:32:44 +0000 (21:32 +0200)]
[flang] run clang-format

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

6 years ago[flang] add accessor to derived type definition
Stephane Chauveau [Thu, 12 Apr 2018 15:27:55 +0000 (17:27 +0200)]
[flang] add accessor to derived type definition

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

6 years ago[flang] Add missing accessors in 'type' classes
Stephane Chauveau [Thu, 12 Apr 2018 15:11:31 +0000 (17:11 +0200)]
[flang] Add missing accessors in 'type' classes

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

6 years ago[flang] fix misrecognition of a bounds-spec-list or bound-remapping-list in a pointer...
peter klausler [Mon, 16 Apr 2018 16:43:22 +0000 (09:43 -0700)]
[flang] fix misrecognition of a bounds-spec-list or bound-remapping-list in a pointer-assignment-stmt

Original-commit: flang-compiler/f18@32148441f5e8a500648c61709c50c8530d2395db
Reviewed-on: https://github.com/flang-compiler/f18/pull/56

6 years ago[flang] Use DataRef as a better name for the data-ref production. Use DataRef instea...
peter klausler [Fri, 13 Apr 2018 21:21:13 +0000 (14:21 -0700)]
[flang] Use DataRef as a better name for the data-ref production.  Use DataRef instead of Variable for LHS of pointer assignment.

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

6 years ago[flang] Simplify proc-component-ref and variable parsing, do not try to support funct...
peter klausler [Fri, 13 Apr 2018 20:56:49 +0000 (13:56 -0700)]
[flang] Simplify proc-component-ref and variable parsing, do not try to support function calls via components of function results.

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

6 years ago[flang] Merge pull request flang-compiler/f18#55 from ThePortlandGroup/tsk8
Tim Keith [Fri, 13 Apr 2018 17:00:52 +0000 (10:00 -0700)]
[flang] Merge pull request flang-compiler/f18#55 from ThePortlandGroup/tsk8

Add -fdebug-dump-parse-tree and -fdebug-resolve-names

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

6 years ago[flang] Add -fdebug-dump-parse-tree and -fdebug-resolve-names
Tim Keith [Thu, 12 Apr 2018 21:20:26 +0000 (14:20 -0700)]
[flang] Add -fdebug-dump-parse-tree and -fdebug-resolve-names

"f18 -fdebug-resolve-names -fparse-only ..." is equivalent to what
test-type used to do, so the test-type executable can be eliminated.

-fdebug-dump-parse-tree does the parse-tree dumping that test-sema
does, but test-sema does more so I have left it alone.

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

6 years ago[flang] Merge pull request flang-compiler/f18#54 from ThePortlandGroup/tsk6
Tim Keith [Thu, 12 Apr 2018 21:36:43 +0000 (14:36 -0700)]
[flang] Merge pull request flang-compiler/f18#54 from ThePortlandGroup/tsk6

Fix integration problem between PR flang-compiler/f18#51 and PR flang-compiler/f18#53.

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

6 years ago[flang] Fix integration problem between PR flang-compiler/f18#51 and PR flang-compile...
Tim Keith [Thu, 12 Apr 2018 21:33:50 +0000 (14:33 -0700)]
[flang] Fix integration problem between PR flang-compiler/f18#51 and PR flang-compiler/f18#53.

Stephane added an access that returned ComponentArraySpec and meanwhile
I renamed it to ArraySpec.

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

6 years ago[flang] Merge pull request flang-compiler/f18#53 from ThePortlandGroup/tsk6
Tim Keith [Thu, 12 Apr 2018 21:25:50 +0000 (14:25 -0700)]
[flang] Merge pull request flang-compiler/f18#53 from ThePortlandGroup/tsk6

Resolve array specifications of entities.

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

6 years ago[flang] Resolve array specifications of entities.
Tim Keith [Thu, 12 Apr 2018 19:59:42 +0000 (12:59 -0700)]
[flang] Resolve array specifications of entities.

Add ArraySpecVisitor to recognize the various forms of array specifications.
They are tracked in arraySpec_ and attrArraySpec_. Both are needed because
a declaration like `integer, dimension(4) :: x(2,2), y` has two different
array-specs.

The method DeclareEntity was extracted out to handle the common part for
EntityDecl, ObjectDecl, and DimensionStmt. AllocatableStmt and TargetStmt
are now handled through their contained ObjectDecl.

The test resolve07 checks the interactions between these kinds of declarations.

Rename ComponentArraySpec to ArraySpec as it doesn't just occur in components.

Fix some 'begin' and 'end' methods to start with upper-case letters.

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

6 years ago[flang] Merge pull request flang-compiler/f18#52 from ThePortlandGroup/tsk8
Tim Keith [Thu, 12 Apr 2018 19:56:35 +0000 (12:56 -0700)]
[flang] Merge pull request flang-compiler/f18#52 from ThePortlandGroup/tsk8

Improve include file sorting.

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

6 years ago[flang] Improve include file sorting.
Tim Keith [Thu, 12 Apr 2018 19:23:20 +0000 (12:23 -0700)]
[flang] Improve include file sorting.

Includes like "../dir/file.h" should sort after local includes.
This change fixes that and applies the new formatting.

Now the order (in reverse) is:
- system includes
- includes from llvm or clang (this is from the default IncludeCategories)
- includes of ../something
- everything else

Original-commit: flang-compiler/f18@324643d63a1842ddfea9ea2a70ebb363f9ced8cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/52

6 years ago[flang] Merge pull request flang-compiler/f18#51 from ThePortlandGroup/sch_types
Stephane Chauveau [Thu, 12 Apr 2018 19:34:03 +0000 (21:34 +0200)]
[flang] Merge pull request flang-compiler/f18#51 from ThePortlandGroup/sch_types

add missing accessors to types

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

6 years ago[flang] run clang-format
Stephane Chauveau [Thu, 12 Apr 2018 19:32:44 +0000 (21:32 +0200)]
[flang] run clang-format

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

6 years ago[flang] add accessor to derived type definition
Stephane Chauveau [Thu, 12 Apr 2018 15:27:55 +0000 (17:27 +0200)]
[flang] add accessor to derived type definition

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

6 years ago[flang] Add missing accessors in 'type' classes
Stephane Chauveau [Thu, 12 Apr 2018 15:11:31 +0000 (17:11 +0200)]
[flang] Add missing accessors in 'type' classes

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

6 years ago[flang] Merge pull request flang-compiler/f18#49 from ThePortlandGroup/tsk6
Tim Keith [Wed, 11 Apr 2018 23:17:40 +0000 (16:17 -0700)]
[flang] Merge pull request flang-compiler/f18#49 from ThePortlandGroup/tsk6

Continue work on name resolution.

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

6 years ago[flang] Use ENUM_CLASS macro for Scope::Kind.
Tim Keith [Wed, 11 Apr 2018 20:26:38 +0000 (13:26 -0700)]
[flang] Use ENUM_CLASS macro for Scope::Kind.

Original-commit: flang-compiler/f18@3492e8d247c33e1053170df0c7bb552608c5234f
Reviewed-on: https://github.com/flang-compiler/f18/pull/49

6 years ago[flang] Continue work on name resolution.
Tim Keith [Wed, 11 Apr 2018 20:11:42 +0000 (13:11 -0700)]
[flang] Continue work on name resolution.

In Symbol and Scope, use SourceName (== parser::CharBlock) in place of
Name (== std::string) so that names in the symtab have provenance. We
may ultimately have multiple source locations associated with a symbol.

ImplicitRules: Add isImplicitNoneType and isImplicitNoneExternal flags.

MessageHandler: Add methods to emit messages associated with source
locations.

Detect conflicting declarations of symbols (e.g. as subprogram and
variable).

Handle attribute statements like ASYNCHRONOUS statement: make sure the
symbol is present and set the attribute on it. Check that these all have
a type declared by the end of the specification part if IMPLICIT NONE.

Find variables named in Variable and Expr nodes and check they have
types declared if IMPLICIT NONE. Otherwise, make sure they are in the
symtab and apply the implicit type rules at the end of the scope.

Push a scope for MainProgram nodes and add a symbol for the name if it
has one.

Rename Scope::map_type to Scope::mapType

Add tests for errors currently being detected. There is no framework for
running them yet, just source files with the expected errors in
comments.

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

6 years ago[flang] Merge pull request flang-compiler/f18#48 from ThePortlandGroup/pmk-nag-h
Peter Klausler [Mon, 9 Apr 2018 23:02:54 +0000 (16:02 -0700)]
[flang] Merge pull request flang-compiler/f18#48 from ThePortlandGroup/pmk-nag-h

Parse NAG tests (no execution)

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

6 years ago[flang] Document support for CONVERT= extension.
peter klausler [Mon, 9 Apr 2018 22:39:39 +0000 (15:39 -0700)]
[flang] Document support for CONVERT= extension.

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

6 years ago[flang] Add length check so that memcmp() on source does not go past the end of input...
peter klausler [Mon, 9 Apr 2018 22:08:38 +0000 (15:08 -0700)]
[flang] Add length check so that memcmp() on source does not go past the end of input and make valgrind complain.

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

6 years ago[flang] Fix unparsing of renamed operators in USE statements.
peter klausler [Mon, 9 Apr 2018 21:52:15 +0000 (14:52 -0700)]
[flang] Fix unparsing of renamed operators in USE statements.

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

6 years ago[flang] Always put parens on unparsed ENTRY statement in case there is a suffix.
peter klausler [Mon, 9 Apr 2018 20:45:30 +0000 (13:45 -0700)]
[flang] Always put parens on unparsed ENTRY statement in case there is a suffix.

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

6 years ago[flang] Fix unparsing of pointer-decls with deferred shape.
peter klausler [Mon, 9 Apr 2018 20:40:20 +0000 (13:40 -0700)]
[flang] Fix unparsing of pointer-decls with deferred shape.

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

6 years ago[flang] Repair negative scale factors in formats.
peter klausler [Mon, 9 Apr 2018 20:17:31 +0000 (13:17 -0700)]
[flang] Repair negative scale factors in formats.

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

6 years ago[flang] Tweak recent disambiguations after more testing.
peter klausler [Mon, 9 Apr 2018 19:53:11 +0000 (12:53 -0700)]
[flang] Tweak recent disambiguations after more testing.

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

6 years ago[flang] Remove a needless std::move() call, and be more careful about line continuation.
peter klausler [Mon, 9 Apr 2018 19:52:52 +0000 (12:52 -0700)]
[flang] Remove a needless std::move() call, and be more careful about line continuation.

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

6 years ago[flang] Remove some needless std::move() calls for readability.
peter klausler [Mon, 9 Apr 2018 19:51:33 +0000 (12:51 -0700)]
[flang] Remove some needless std::move() calls for readability.

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

6 years ago[flang] Better solution in grammar for a data statement value parse.
peter klausler [Mon, 9 Apr 2018 18:57:53 +0000 (11:57 -0700)]
[flang] Better solution in grammar for a data statement value parse.

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

6 years ago[flang] Handle pp-directives amid continuations correctly, and fix a Hollerith ambiguity.
peter klausler [Mon, 9 Apr 2018 18:47:00 +0000 (11:47 -0700)]
[flang] Handle pp-directives amid continuations correctly, and fix a Hollerith ambiguity.

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

6 years ago[flang] Adjust TODO messages to reflect deliberate behavior.
peter klausler [Mon, 9 Apr 2018 18:43:37 +0000 (11:43 -0700)]
[flang] Adjust TODO messages to reflect deliberate behavior.

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

6 years ago[flang] Fix naming: list_type -> listType
peter klausler [Mon, 9 Apr 2018 18:42:46 +0000 (11:42 -0700)]
[flang] Fix naming: list_type -> listType

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

6 years ago[flang] Rearrange alternatives in data statement values to put longer parse earlier.
peter klausler [Mon, 9 Apr 2018 16:57:49 +0000 (09:57 -0700)]
[flang] Rearrange alternatives in data statement values to put longer parse earlier.

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

6 years ago[flang] Prevent misrecognition of a digit string that is the kind parameter of a...
peter klausler [Sat, 7 Apr 2018 00:04:18 +0000 (17:04 -0700)]
[flang] Prevent misrecognition of a digit string that is the kind parameter of a character literal from being misrecognized as an integer literal.

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

6 years ago[flang] Parse unlimited format item -- needed to adjust its precedence in grammar.
peter klausler [Fri, 6 Apr 2018 23:43:36 +0000 (16:43 -0700)]
[flang] Parse unlimited format item -- needed to adjust its precedence in grammar.

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

6 years ago[flang] Parser mistakenly attempted error recovery in specification part when it...
peter klausler [Fri, 6 Apr 2018 23:30:45 +0000 (16:30 -0700)]
[flang] Parser mistakenly attempted error recovery in specification part when it saw END statement with label.

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

6 years ago[flang] Fix two errors in the grammar (array constructors with type but no values...
peter klausler [Fri, 6 Apr 2018 23:15:55 +0000 (16:15 -0700)]
[flang] Fix two errors in the grammar (array constructors with type but no values did not consume the ::, and ERR= was omitted from CLOSE().  Add CONVERT= extension to OPEN().

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

6 years ago[flang] Crash more gracefully when files include themselves.
peter klausler [Fri, 6 Apr 2018 21:20:29 +0000 (14:20 -0700)]
[flang] Crash more gracefully when files include themselves.

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

6 years ago[flang] Merge pull request flang-compiler/f18#43 from ThePortlandGroup/pmk2
Peter Klausler [Mon, 9 Apr 2018 20:48:44 +0000 (13:48 -0700)]
[flang] Merge pull request flang-compiler/f18#43 from ThePortlandGroup/pmk2

Avoid most uses of Boolean-valued Pre() callbacks in unparse.cc.

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

6 years ago[flang] Avoid most uses of Boolean-valued Pre() callbacks in unparse.cc.
peter klausler [Fri, 6 Apr 2018 20:13:20 +0000 (13:13 -0700)]
[flang] Avoid most uses of Boolean-valued Pre() callbacks in unparse.cc.

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

6 years ago[flang] Merge pull request flang-compiler/f18#46 from ThePortlandGroup/tsk8
Tim Keith [Mon, 9 Apr 2018 18:55:25 +0000 (11:55 -0700)]
[flang] Merge pull request flang-compiler/f18#46 from ThePortlandGroup/tsk8

Change API of Scope to match std::map

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

6 years ago[flang] Address review comments.
Tim Keith [Mon, 9 Apr 2018 18:53:20 +0000 (11:53 -0700)]
[flang] Address review comments.

Make map_type private -- it is not part of the API.

Add cbegin() and cend().

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