Commit graph

510 commits

Author SHA1 Message Date
peter klausler
bfb65b5476 [flang] Address review comments
Original-commit: flang-compiler/f18@7bc3c97f1e
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
2019-04-16 12:29:00 -07:00
peter klausler
1498911aa2 [flang] Rewrite I/O units in the parse tree when a variable is not character.
Original-commit: flang-compiler/f18@46791a73e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
2019-04-16 12:28:59 -07:00
peter klausler
1b8a78ac13 [flang] Resolve ambiguous I/O unit parse in favor of CharVariable.
Original-commit: flang-compiler/f18@ecabe82825
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
2019-04-16 12:28:59 -07:00
peter klausler
b147f32dcc [flang] Fix bug found in testing
Original-commit: flang-compiler/f18@45a1e6e3dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/415
2019-04-15 15:53:18 -07:00
peter klausler
ce9716d037 [flang] Capture source locations for Designators and Calls
Original-commit: flang-compiler/f18@970333fff7
Reviewed-on: https://github.com/flang-compiler/f18/pull/415
Tree-same-pre-rewrite: false
2019-04-15 15:18:07 -07:00
Tim Keith
b2f84a5eda [flang] More coarray name resolution and semantic checks
Add CoarrayChecker to check for valid team-value in CHANGE TEAM,
SYNC TEAM, and image selector. Check that coarray names and selector
names are distinct in CHANGE TEAM.

Resolve the variable in a coarray-association.
Create a scope for the construct entities of a CHANGE TEAM construct.

Add ResolveSelector to resolve a parser::Selector into an Expr and
optional variable name (and a source location for messages). Make use of
ResolveSelector to handle coarray-association, as well as it's previous
use in associate-stmt.

Improve the check for C1157 in select-type-stmt and add a test.

Add a test for "Associate name must have a type".

Move ResolveName, ResolveDataRef, etc. from ResolveNamesVisitor
to DeclarationVisitor so that they are available in ConstructVisitor
as well. Add ResolveVariable and ResolveDesignator.

In the parse tree, change TeamValue from a type alias to a wrapper
class. We already had a wrapper class anyway, ImageSelectorSpec::Team,
so the new TeamValue can be used instead. This allows the member
of ImageSelectorSpec to be treated like other occurrences of TeamValue.

Original-commit: flang-compiler/f18@f856744b54
Reviewed-on: https://github.com/flang-compiler/f18/pull/414
Tree-same-pre-rewrite: false
2019-04-15 14:07:11 -07:00
Tim Keith
b69c2c6997 [flang] Remove ObjectName alternative from Designator
A simple name in a `Designator` is always parsed as a `DataRef`, not
an `ObjectName`. So remove that alternative.

`StmtFunctionStmt::ConvertToAssignment` was creating a `Designator` with
that alternative: change it to do the same thing as the parser.

Add `GetSimpleName` utility functions to check if an `Expr` or `Variable`
represents a simple name. Many of the places that checked for `ObjectName`
in `Designator` are trying to do that.

Clean up includes and forward declarations in `tools.h`.

Original-commit: flang-compiler/f18@97d44de7b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/410
2019-04-12 16:30:03 -07:00
Tim Keith
4ee3386c8f [flang] Clean up includes
indirection.h: Doesn't need ../common because it is in common.

expression.h: ../lib is the wrong path but the includes are needed.
They were probably coming in indirectly through other includes.

token-parsers.h: Include was not needed and parser shouldn't have
dependency on evaluate.

Original-commit: flang-compiler/f18@86f6b0023d
Reviewed-on: https://github.com/flang-compiler/f18/pull/405
2019-04-11 16:12:10 -07:00
peter klausler
923c891111 [flang] Do not replace format with namelist if there is no unit (avoiding accidental language extension)
Original-commit: flang-compiler/f18@08562d9b86
Reviewed-on: https://github.com/flang-compiler/f18/pull/394
2019-04-10 08:52:46 -07:00
peter klausler
0e55f2463b [flang] Rewrite read-stmt/write-stmt parse trees for misparsed namelist group names
Original-commit: flang-compiler/f18@e0f1b1c469
Reviewed-on: https://github.com/flang-compiler/f18/pull/394
Tree-same-pre-rewrite: false
2019-04-10 08:52:42 -07:00
Tim Keith
0671857b69 [flang] Fix source locations for some expressions
When expressions are parsed iteratively they weren't getting the correct
source positions. For example, when parsing an `add-operand` as a sequence
of `mult-operand`s separated by `mult-op`.

This shows up when we report an error message referring to this kind
of expression:
```
t.f90:1:11: error: Expected a LOGICAL expression
  if (i * j * k) then
            ^^^
```

The fix is to remember the location of the first operand and then
for each sub-expression (`i * j` and `i * j * k` in this example)
extend its location back to include that first operand.

Original-commit: flang-compiler/f18@e276f11f48
Reviewed-on: https://github.com/flang-compiler/f18/pull/395
2019-04-09 16:48:37 -07:00
peter klausler
4950dfa04e [flang] Redo without macros
Original-commit: flang-compiler/f18@8d955cfb3b
Reviewed-on: https://github.com/flang-compiler/f18/pull/390
2019-04-09 13:29:40 -07:00
peter klausler
3230a2f3ce [flang] fix bug found in testing
Original-commit: flang-compiler/f18@297ad78510
Reviewed-on: https://github.com/flang-compiler/f18/pull/390
Tree-same-pre-rewrite: false
2019-04-08 16:57:30 -07:00
peter klausler
8057a2ce32 [flang] Lots of debugging and refinement
Original-commit: flang-compiler/f18@1c3c30b540
Reviewed-on: https://github.com/flang-compiler/f18/pull/390
Tree-same-pre-rewrite: false
2019-04-08 16:16:55 -07:00
peter klausler
17c4ae070b [flang] Revert that reversion. Move semantics work just fine.
Original-commit: flang-compiler/f18@72bd8e7b03
Reviewed-on: https://github.com/flang-compiler/f18/pull/390
Tree-same-pre-rewrite: false
2019-04-08 14:29:47 -07:00
peter klausler
d0e7775431 [flang] Revert to forwarding on variadic messaging APIs
Original-commit: flang-compiler/f18@d2e464eb15
Reviewed-on: https://github.com/flang-compiler/f18/pull/390
Tree-same-pre-rewrite: false
2019-04-08 14:29:47 -07:00
peter klausler
dc9c3d1c46 [flang] Fix bug#389, prevent std::move() on forwarded lvalue references
Original-commit: flang-compiler/f18@9d61c091ad
Reviewed-on: https://github.com/flang-compiler/f18/pull/390
Tree-same-pre-rewrite: false
2019-04-08 14:29:45 -07:00
Tim Keith
1599d09041 [flang] Update the grammar with team-value
Everywhere we had `team-variable` except for the FORM TEAM statement is
now `team-value`, according to the N2162 draft standard. The grammar
and parse tree are updated to reflect that.

The addition of the production for `team-value` caused productions
R1177-R1181 to have their numbers increased by one.

Original-commit: flang-compiler/f18@9071f0a352
Reviewed-on: https://github.com/flang-compiler/f18/pull/387
2019-04-06 11:17:07 -07:00
peter klausler
b65572d5a0 [flang] fix original failure (reshape intrinsic argument check)
Original-commit: flang-compiler/f18@8bba330b32
Reviewed-on: https://github.com/flang-compiler/f18/pull/386
Tree-same-pre-rewrite: false
2019-04-05 12:56:04 -07:00
peter klausler
39b7433194 [flang] some debugging after more testing
Original-commit: flang-compiler/f18@005b841dd1
Reviewed-on: https://github.com/flang-compiler/f18/pull/373
2019-04-01 16:23:34 -07:00
peter klausler
0ff94b9d0b [flang] Define and use UnlabeledStatement<> for if & forall
Original-commit: flang-compiler/f18@028e6aba6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/373
Tree-same-pre-rewrite: false
2019-04-01 16:23:32 -07:00
peter klausler
4d21120d89 [flang] Add extension edit descriptors to the unparser.
Original-commit: flang-compiler/f18@74e09e249a
Reviewed-on: https://github.com/flang-compiler/f18/pull/352
2019-04-01 10:14:20 -07:00
peter klausler
e0f76d2306 [flang] Support CONVERT= and DISPOSE= on INQUIRE
Original-commit: flang-compiler/f18@fbedd32376
Reviewed-on: https://github.com/flang-compiler/f18/pull/352
Tree-same-pre-rewrite: false
2019-04-01 10:14:19 -07:00
peter klausler
822810f017 [flang] Check int literals for overflow when kind is known.
improve test

Original-commit: flang-compiler/f18@09ce783cd3
Reviewed-on: https://github.com/flang-compiler/f18/pull/352
Tree-same-pre-rewrite: false
2019-04-01 10:14:16 -07:00
peter klausler
1d2a212c38 [flang] Allow dollar and backslash formats
Original-commit: flang-compiler/f18@4d8d6e599e
Reviewed-on: https://github.com/flang-compiler/f18/pull/352
Tree-same-pre-rewrite: false
2019-04-01 10:14:15 -07:00
peter klausler
5b0e18b0e4 [flang] Allow multiple associations on legacy POINTER declaration
fix that fix

Original-commit: flang-compiler/f18@f096b73842
Reviewed-on: https://github.com/flang-compiler/f18/pull/352
Tree-same-pre-rewrite: false
2019-04-01 10:14:12 -07:00
Steve Scalpone
1de9ecd251 [flang] Add CMake rules to install static and shared libraries in
the default install directory or in the directory specified
with CMAKE_INSTALL_PREFIX.  Fixes flang-compiler/f18#359.

Original-commit: flang-compiler/f18@35ce1628e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/364
2019-03-28 09:55:56 -07:00
peter klausler
8118196fda [flang] Better error locations
Original-commit: flang-compiler/f18@9d4a3e9734
Reviewed-on: https://github.com/flang-compiler/f18/pull/349
2019-03-21 13:42:35 -07:00
peter klausler
7ded6de0d5 [flang] Fix bug#348
Original-commit: flang-compiler/f18@ba3504b00e
Reviewed-on: https://github.com/flang-compiler/f18/pull/349
Tree-same-pre-rewrite: false
2019-03-21 10:36:04 -07:00
peter klausler
0c78d8bd9b [flang] Fix unparsing of defined operators.
Original-commit: flang-compiler/f18@14aa5198f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
2019-03-20 14:17:12 -07:00
peter klausler
afd0c19fec [flang] cleanup after extraction and merging
Original-commit: flang-compiler/f18@6314daadc1
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
Tree-same-pre-rewrite: false
2019-03-20 11:49:32 -07:00
peter klausler
ad057a42fa [flang] Remove OwningPointer, use unique_ptr better instead.
Original-commit: flang-compiler/f18@89aff868aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
Tree-same-pre-rewrite: false
2019-03-20 11:38:45 -07:00
Tim Keith
1ad772336a [flang] Address review comments
Original-commit: flang-compiler/f18@511c9ec536
Reviewed-on: https://github.com/flang-compiler/f18/pull/343
2019-03-19 14:18:44 -07:00
Tim Keith
299628e2cb [flang] Strip whitespace from parse tree source locations
Parse tree nodes have `source` fields that map the node back to
a range in the cooked input stream. These are used for names and
to locate error messages.

This change strips spaces from the beginning and end of those
source ranges before they are saved. This fixes two problems:
1. For a statement like this: `generic :: operator(+) => ...`,
   the name of the symbol we want to create is "operator(+)" but
   the parser was including the following space in the CharBlock
   it captured.
2. Error messages referring to parts of expressions sometimes included
   extra spaces in the source locations. For example:
   ```
   t.f90:9:29: error: subscripts may be applied only to an object or component
    integer, parameter :: b = a(1) + 1
                              ^^^^^
   t.f90:4:8: error: operands to LOGICAL operation must be LOGICAL
    i = j .or. k
         ^^^^^^^
   ```

Original-commit: flang-compiler/f18@fa14297967
Reviewed-on: https://github.com/flang-compiler/f18/pull/343
Tree-same-pre-rewrite: false
2019-03-19 13:38:54 -07:00
peter klausler
62c39b72af [flang] Still do scalar- constraint check.
Original-commit: flang-compiler/f18@e50b4c4b48
Reviewed-on: https://github.com/flang-compiler/f18/pull/342
2019-03-19 11:59:58 -07:00
peter klausler
e1a9c85e72 [flang] Simplify grammar for STOP/ERROR STOP.
Original-commit: flang-compiler/f18@eddaea25a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/342
Tree-same-pre-rewrite: false
2019-03-19 11:44:35 -07:00
Tim Keith
3ec5e102e2 [flang] Name resolution for defined operators
Instead of tracking just genericName_ while in a generic interface
block or generic statement, now we immediately create a symbol for it.
A parser::Name isn't good enough because a defined-operator or
defined-io-generic-spec doesn't have a name.

Change the parse tree to add a source field to GenericSpec. Use these
as names for symbols for defined-operator and defined-io-generic-spec
(e.g. "operator(+)" or "read(formatted)").

Change the source for defined-op-name to include the dots so that they
can be distinguished from normal symbols with the same name (e.g. you
can have both ".foo." and "foo"). These symbols have names in the symbol
table like ".foo.", not "operator(.foo.)", because references to them
have that form.

Add GenericKind enum to GenericDetails and GenericBindingDetails.
This allows us to know a symbol is "assignment(=)", for example,
without having to do a string comparison.

Add GenericSpecInfo to handle analyzing the various kinds of
generic-spec and generating symbol names and GenericKind for them.

Add reference to LanguageFeatureControl to SemanticsContext so that
they can be checked during semantics. For this change, if
LogicalAbbreviations is enabled, report an error if the user tries
to define an operator named ".T." or ".F.".

Add resolve-name-utils.cc to hold utility functions and classes that
don't have to be in the ResolveNamesVisitor class hierarchy. The goal
is to reduce the size of resolve-names.cc where possible.

Original-commit: flang-compiler/f18@3081f694e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/338
2019-03-18 11:48:02 -07:00
peter klausler
19c91ea9e1 [flang] Improve comment
Original-commit: flang-compiler/f18@140ebe060e
Reviewed-on: https://github.com/flang-compiler/f18/pull/339
2019-03-18 13:43:03 -07:00
peter klausler
cf8f173512 [flang] Final tweak before review
Original-commit: flang-compiler/f18@5dda7b2f65
Reviewed-on: https://github.com/flang-compiler/f18/pull/339
Tree-same-pre-rewrite: false
2019-03-18 13:05:21 -07:00
peter klausler
f8c80f90ee [flang] Simplify
Original-commit: flang-compiler/f18@42bee00a45
Reviewed-on: https://github.com/flang-compiler/f18/pull/339
Tree-same-pre-rewrite: false
2019-03-18 12:24:44 -07:00
peter klausler
81a35e3b2f [flang] Squash spaces in generic specs.
Original-commit: flang-compiler/f18@bd5e29f5f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/339
Tree-same-pre-rewrite: false
2019-03-18 12:19:35 -07:00
peter klausler
7c71e2f288 [flang] Fix parse of .TRUE._8
Original-commit: flang-compiler/f18@b03e7a691d
Reviewed-on: https://github.com/flang-compiler/f18/pull/336
2019-03-17 15:51:02 -07:00
peter klausler
713cd91a34 [flang] Final tweaks, can now parse all SPEC CPUv6
Original-commit: flang-compiler/f18@015152f1ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/335
Tree-same-pre-rewrite: false
2019-03-15 15:01:54 -07:00
peter klausler
827407a86a [flang] more spec work, handle classic C comments
Original-commit: flang-compiler/f18@d901ee7f50
Reviewed-on: https://github.com/flang-compiler/f18/pull/335
Tree-same-pre-rewrite: false
2019-03-15 13:57:41 -07:00
peter klausler
4b26466375 [flang] Accomodate missing clock_gettime(); remove f18-parse-demo dependence on lib/evaluate; allow #ifdef with no name
Original-commit: flang-compiler/f18@330fd8116f
Reviewed-on: https://github.com/flang-compiler/f18/pull/335
Tree-same-pre-rewrite: false
2019-03-15 10:50:15 -07:00
peter klausler
615ba7754b [flang] Move dump-parse-tree.h from semantics into parser.
Original-commit: flang-compiler/f18@9075adfcdf
Reviewed-on: https://github.com/flang-compiler/f18/pull/330
Tree-same-pre-rewrite: false
2019-03-14 16:28:06 -07:00
peter klausler
df2a910639 [flang] Get clean -fparse-only pass over WRF
Original-commit: flang-compiler/f18@ffe517abc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/333
2019-03-14 14:53:29 -07:00
peter klausler
3348b1691d [flang] WRF preprocessing tweaks
Original-commit: flang-compiler/f18@53f76e1c93
Reviewed-on: https://github.com/flang-compiler/f18/pull/333
Tree-same-pre-rewrite: false
2019-03-14 14:53:25 -07:00
peter klausler
3204a1c1b9 [flang] checkpoint
Original-commit: flang-compiler/f18@0c9bdc7032
Reviewed-on: https://github.com/flang-compiler/f18/pull/333
Tree-same-pre-rewrite: false
2019-03-14 14:52:44 -07:00
peter klausler
f3abed639d [flang] Fix misparsings of substrings in the parse tree, not in expressions.
Original-commit: flang-compiler/f18@53d0e26d92
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
Tree-same-pre-rewrite: false
2019-03-09 10:25:07 -08:00
peter klausler
e3b632337d [flang] add structconst04.f90 test and fixes to pass it
Original-commit: flang-compiler/f18@d857c843f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
Tree-same-pre-rewrite: false
2019-03-09 10:25:07 -08:00
peter klausler
64ea462e3a [flang] Resolve misparse of structure constructor as function reference.
Original-commit: flang-compiler/f18@5b6b2540f6
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
Tree-same-pre-rewrite: false
2019-03-09 10:25:06 -08:00
peter klausler
6a0f9474ff [flang] Use value()/has_value() on Indirection class templates instead of operator*/operator->
Original-commit: flang-compiler/f18@a97f377ae6
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-05 12:28:08 -08:00
peter klausler
ab74d1ac0c [flang] Rename to Fortran.h, update style guide, run clang-format
Original-commit: flang-compiler/f18@aa2907d226
Reviewed-on: https://github.com/flang-compiler/f18/pull/308
Tree-same-pre-rewrite: false
2019-02-28 11:48:15 -08:00
peter klausler
6a56782b2f [flang] fix flang-compiler/f18#303, better error recovery for misplaced type parameter declarations
Original-commit: flang-compiler/f18@ebaa23cbcd
Reviewed-on: https://github.com/flang-compiler/f18/pull/307
2019-02-28 09:31:16 -08:00
peter klausler
204a50d283 [flang] unparse interfaces as PROCEDURE(TYPE(REAL)) to avoid ambiguity
Original-commit: flang-compiler/f18@efef1f1ad1
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
2019-02-27 12:30:57 -08:00
peter klausler
2d76abcd07 [flang] checkpoint
Original-commit: flang-compiler/f18@a2b1c94ddb
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:18:56 -08:00
Tim Keith
efd7bdb030 [flang] Remove TODO for saved-entity
The parser can't distinguish `saved-entity -> object-name` from
`saved-entity -> proc-pointer-name`. So just use `kind` == `Entity`
for those cases. Name resolution will verify it is the right kind
of entity name.

Original-commit: flang-compiler/f18@69d7c0e025
Reviewed-on: https://github.com/flang-compiler/f18/pull/298
Tree-same-pre-rewrite: false
2019-02-21 08:48:30 -08:00
peter klausler
475d72f8e6 [flang] push for review
Original-commit: flang-compiler/f18@17dc735911
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 14:26:23 -08:00
peter klausler
4417443be9 [flang] Fix CHECK() on wa22 by implementing PGI language extension
Original-commit: flang-compiler/f18@03fcb58977
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:29:10 -08:00
peter klausler
5b79ffc5f6 [flang] checkpoint
Original-commit: flang-compiler/f18@156791b288
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:10 -08:00
peter klausler
d3559a5d18 [flang] Name resolution for structure constructors
Original-commit: flang-compiler/f18@9d60038f03
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:04 -08:00
Tim Keith
b60fd092f5 [flang] Simplify CommonStmt in parse tree
The grammar requires parsing the first common block in a common stmt
differently from the others: the '//' is optional for the blank common.

But once it's parsed, it is easier to work with if each is represented
as a `parser::CommonStmt::Block`. This is achieved by using the same
constructor for `CommonStmt` but then including the first block in
the list of blocks.

Original-commit: flang-compiler/f18@dd46afd6b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/284
2019-02-12 16:13:58 -08:00
peter klausler
6d8aecf981 [flang] Convert structs to classes, move some defs from variable.h to call.h
Original-commit: flang-compiler/f18@c877a34694
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 16:04:17 -08:00
peter klausler
0ae3d43d76 [flang] Run expression semantic analysis with rest of semantics.
checkpoint array constructor semantics work

checkpoint

array constructors of lengthless intrinsic types

checkpoint

Correct ambiguous substring refs misparsed as array elements

Original-commit: flang-compiler/f18@2232549efe
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:28 -08:00
peter klausler
9d63306d76 [flang] Remove SHARED from add_library(), use cmake command line option instead
Original-commit: flang-compiler/f18@6644c799a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:20 -08:00
peter klausler
f47c0bdaba [flang] Add SHARED to add_library() invocations so f18 libraries are always built shared.
Original-commit: flang-compiler/f18@060ced04c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:20 -08:00
peter klausler
be3b765e2a [flang] basic skeleton of assignment analyzer
remove needless template<> on some function overloads

dodge bogus compiler warning from gcc 8.1.0 only

stricter typing of expressions in symbols

adjust modfile12.f90 expected test results

add Unwrap, massage folding a bit

Use Unwrap to simplify folding

Move KindSelector analysis into expression semantics

fix crash

checkpoint

updates to TypeParamInquiry

support of %KIND type parameter inquiry

equality testing for expressions

checkpoint during PDT implementation

reformat

checkpoint derived type instantiation

checkpoint

resolve merge

debugging failed tests

fix failing resolve37.f90 test

all existing tests pass

clean up all build warnings

fix bug

update copyright dates

fix copyright dates

address review comments

review comment

merge with master after peeling off changes

bugfixing new feature

fix warning from old g++s

tweaks after merging with latest head

more bugfixing

making modfile17.f90 test work

Make kinds into expressions in symbol table types

big refactor for deferring kinds in intrinsic types

modfile17.f90 test passes

clean up TODOs

Simplify types as stored in scopes

Test KIND parameter default init expressions, debug them

Update copyright dates

address comments

remove dead line

address comments

Original-commit: flang-compiler/f18@1f43d0a048
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 10:41:08 -08:00
peter klausler
e30ef0ec8d [flang] Roll up small tweaks to parser and semantics.
Original-commit: flang-compiler/f18@57d823a809
Reviewed-on: https://github.com/flang-compiler/f18/pull/254
2019-01-07 15:38:48 -08:00
peter klausler
ee2a32e561 [flang] Rework expression constraint checking
Original-commit: flang-compiler/f18@7a31c1ed2b
Reviewed-on: https://github.com/flang-compiler/f18/pull/250
Tree-same-pre-rewrite: false
2018-12-28 15:58:17 -08:00
Tim Keith
d7ba02ab8c [flang] Change when symbol is set in parser::Name
Rework how `parser::Name` is resolved to contain a `Symbol`. so that
constants in types can be evaluated. For example:
```
  integer, parameter :: k = 8
  integer(k) :: i
```
The old approach of collecting the symbols at the end of name resolution
and filling in the `parser::Name` does not work because the type of `i`
needs to be set in the symbol table.

The symbol field in `parser::Name` is now mutable so that we can set it
during name resolution. `RewriteParseTree` no longer needs to do that
(it still warns about unresolved ones), so it does not need to collect
symbols and fill them in. Consequently, we can eliminate "occurrences"
from symbols -- we just need the name where each is first defined.

This requires a lot of refactoring in `resolve-names.cc` to pass around
`parser::Name` rather than `SourceName` so that we can resolve the
name to a symbol.

Fix some bugs where we stored `SourceName *` instead of `SourceName`
in the symbol table. The pointers were into the parse tree, so they
were only valid as long as the parse tree was around. The symbol
table needs to remain valid longer than that, so the names need to
be copied. `parser::Name` is not used in the symbol table.

Eliminate `GenericSpec`. Currently all we need to do is to resolve
the kinds of GenericSpec that contain names.

Add `ScopeName` kind of `MiscDetails` for when we need a symbol in
the scope to match the name of the scope. For example, `module m`
cannot contain a declaration of a new `m`. Subprograms need real
details because they can be called recursively.

Fix output of partially resolved modules where we know it is a submodule
but have not yet resolved the ancestor.

Original-commit: flang-compiler/f18@5c1a4b99d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/238
Tree-same-pre-rewrite: false
2018-12-06 07:16:52 -08:00
peter klausler
1b1f60ff50 [flang] Use std::optional<>::value() where appropriate.
Original-commit: flang-compiler/f18@4278b79b3d
Reviewed-on: https://github.com/flang-compiler/f18/pull/237
Tree-same-pre-rewrite: false
2018-12-05 13:03:39 -08:00
Tim Keith
7704b1fcf9 [flang] Add ExtendToCover() to CharBlock and Interval
Use them in Scope::AddSourceRange().

Original-commit: flang-compiler/f18@ec2f6db46a
Reviewed-on: https://github.com/flang-compiler/f18/pull/230
2018-11-29 09:10:19 -08:00
Tim Keith
cef802b1b4 [flang] Add mapping of source location to Scope
Each Scope now tracks the source locations that it and its nested scopes
span. This is achieved by extending the source range of a scope for each
statement encountered while it is the current scope.

Semantics::FindScope maps a source location (from the cooked character
stream) to the narrowest scope that contains it.

Original-commit: flang-compiler/f18@7b4d2bb113
Reviewed-on: https://github.com/flang-compiler/f18/pull/230
Tree-same-pre-rewrite: false
2018-11-28 15:55:55 -08:00
Tim Keith
daa0b054ba [flang] Change formatting of common::visitors{}
Including a comma after the last lambda in a `common::visitors{}` list
causes clang-format to do a better job of formatting them.

Add that recommendation to C++style.md, insert the missing commas,
and reformat the changed files.

Original-commit: flang-compiler/f18@a2486ca3b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/232
2018-11-29 09:27:34 -08:00
peter klausler
ac9e17f4cf [flang] fix issue#224
Original-commit: flang-compiler/f18@c40e197c61
Reviewed-on: https://github.com/flang-compiler/f18/pull/226
2018-11-14 15:44:17 -08:00
peter klausler
12b0f643ab [flang] bugfixing and review comments
Original-commit: flang-compiler/f18@6df4a52d6b
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-14 11:57:47 -08:00
peter klausler
972d2d52c5 [flang] bugfixing from regression testing
Original-commit: flang-compiler/f18@f1bcaa0292
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-14 11:12:09 -08:00
peter klausler
ef59a45f50 [flang] fix warning
Original-commit: flang-compiler/f18@92003070de
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:03 -08:00
peter klausler
10aa1eafa0 [flang] multi-byte character TODOs
Original-commit: flang-compiler/f18@3bd2d227dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:02 -08:00
peter klausler
cfb57cd2d3 [flang] take literal substrings out of variable.h
Original-commit: flang-compiler/f18@a762b70beb
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:37:15 -08:00
peter klausler
3f6ae3550f [flang] merge
Original-commit: flang-compiler/f18@d0cd9544f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:13 -07:00
peter klausler
d6ea6af7c4 [flang] new refactored Fold
Original-commit: flang-compiler/f18@061868fd85
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:09 -07:00
peter klausler
ef9dd9d1fe [flang] refactor a bit, and rearrange actual arguments into dummy order on intrinsic calls
Original-commit: flang-compiler/f18@1f50ace68b
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:16:41 -07:00
Jean Perier
f7e7cb349b [flang] Changed .clang-format so that it will not add a comment after the closing brace of each namespace. Removed all such previous comments from all .cc and .h files
Original-commit: flang-compiler/f18@aa7f55e15f
Reviewed-on: https://github.com/flang-compiler/f18/pull/217
2018-10-25 05:55:23 -07:00
Eric Schweitz
2ced09610b [flang] Improved error messages:
Update the tests to reflect new message
Improved error messages to show both source and destination of mismatches.

Use CharBlock::size.

Original-commit: flang-compiler/f18@bf79d77d3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/185
Tree-same-pre-rewrite: false
2018-10-24 11:03:49 -07:00
Tim Keith
d3e063e648 [flang] Rename PushLocation() to SetLocation().
Original-commit: flang-compiler/f18@1b5593c12b
Reviewed-on: https://github.com/flang-compiler/f18/pull/215
2018-10-23 14:35:13 -07:00
Tim Keith
30dd289247 [flang] Add FoldingContext to SemanticsContext
FoldingContext is now part of SemanticsContext. It is created at the
beginning with a default-constructed CharBlock as the location in its
ContextualMessages.

Add PushLocation() to ContextualMessages to remember the previous source
location and set a new one. The old one is restored when the returned
object goes out of scope.

SemanticsContext is now the only state passed in to class ExprAnalyzer,
class Mutator, AnalyzeExpr(), AnalyzeExpressions().

Add Say() convenience functions for reporting errors to ExprAnalyzer.

Original-commit: flang-compiler/f18@70c499ffc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/215
Tree-same-pre-rewrite: false
2018-10-22 16:41:26 -07:00
Tim Keith
ed94af4c47 [flang] More name resolution for construct entities
Push a new scope for constructs and statements that require one
(DataStmt, DO CONCURRENT, ForallConstruct, ForallStmt -- there are more
to do). Currently we use the Block kind of scope because there is no
difference. Perhaps that kind should be renamed to Construct, though it
does apply to statements as well as constructs.

Add DeclareConstructEntity to create a construct or statement entity.
When the type is not specified it can come from the type of a symbol in
the enclosing scope with the same name. Change DeclareObjectEntity et al.
to return the symbol declared, for the benefit of DeclareConstructEntity.

Use DeclareConstructEntity for DO CONCURRENT index-name, LOCAL, and
LOCAL_INIT variables and the data-i-do-variable in DataImpliedDo

Names in SHARED locality spec need special handling: create a new kinds
of symbol with HostAssocDetails to represent the host-association of the
shared variables within the construct scope. That symbol gets the
LocalityShared flag without affecting the symbol in the outer scope.
HostAssoc symbols may be useful in other contexts, e.g. up-level
references to local variables.

Add parser::DoConstruct::IsDoConcurrent() because DO CONCURRENT loops
introduce a construct scope while other DO loops do not.

Move CanonicalizeDo to before name resolution so that name resolution
doesn't have to deal with labeled DO CONCURRENT loops.

Allow for type of index name to be specified in ConcurrentHeader.

Resolve the derived type name in an AllocateStmt, StructureConstructor

Original-commit: flang-compiler/f18@bc7b989136
Reviewed-on: https://github.com/flang-compiler/f18/pull/214
2018-10-18 09:06:11 -07:00
peter klausler
94041d7667 [flang] review comments
Original-commit: flang-compiler/f18@daaf080dbc
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
2018-10-15 13:39:51 -07:00
peter klausler
7bda1b3243 [flang] unit testing, better error messages
Original-commit: flang-compiler/f18@f3876008d0
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:41 -07:00
peter klausler
a70f596719 [flang] intrinsic pattern matching
Original-commit: flang-compiler/f18@ca0ee1660a
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:30 -07:00
Tim Keith
03435d981d [flang] Use fundamental types in overloadings of Unparse.
Different systems map std::size_t, string::size_type, etc. to different
fundamental types. To ensure they are all covered, make the overloadings
of Unparse for integer types use only fundamental types.

This fixes compilations problems on Darwin and *BSD systems.

Original-commit: flang-compiler/f18@5576ed49a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/205
2018-10-10 07:24:27 -07:00
peter klausler
b64a39e1ea [flang] Prep for review
Original-commit: flang-compiler/f18@e86eae005e
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
2018-10-04 13:55:51 -07:00
peter klausler
7e87d5a297 [flang] Parse nonlabel DO within label DO better; add -fdebug-semantics; more testing
Original-commit: flang-compiler/f18@2825a45956
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
Tree-same-pre-rewrite: false
2018-10-04 13:54:07 -07:00
peter klausler
4d6885346e [flang] rework non-block DO loop canonicalization
Original-commit: flang-compiler/f18@50574936f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
Tree-same-pre-rewrite: false
2018-10-04 13:52:42 -07:00
peter klausler
c71aecb787 [flang] Correct the spelling of LOCAL_INIT clauses on DO CONCURRENT statements.
Original-commit: flang-compiler/f18@bfc869ad5f
Reviewed-on: https://github.com/flang-compiler/f18/pull/198
2018-10-02 10:03:37 -07:00
peter klausler
a5687fd579 [flang] source provenances for expressions
Original-commit: flang-compiler/f18@5fe292fcac
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:00 -07:00
peter klausler
c2d4f07cda [flang] Changes that might fix MSVC build problems from sjs
Original-commit: flang-compiler/f18@009f0cc8df
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:23:59 -07:00
peter klausler
93a7f1f85c [flang] work on structure components
Original-commit: flang-compiler/f18@619b6957b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:23:58 -07:00
peter klausler
a636624c71 [flang] Resolve recent NAG failures better, more clean-up, ready for merge.
Original-commit: flang-compiler/f18@5bc5a317f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
2018-09-13 11:29:10 -07:00
peter klausler
0f28575378 [flang] Fix recent regression on NAG tests found during pre-merge testing
Original-commit: flang-compiler/f18@1fc6d00ac8
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-13 10:29:44 -07:00
peter klausler
6c6234be9e [flang] clean up for review
Original-commit: flang-compiler/f18@d3d81b1e6f
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:20 -07:00
peter klausler
003c8329ba [flang] add left(), right(), and comments
Original-commit: flang-compiler/f18@372fd06508
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:16 -07:00
peter klausler
710d635cad [flang] mixed Complex; removed BOZConstant in favor of converting in place
Original-commit: flang-compiler/f18@17a18ddd22
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:13 -07:00
peter klausler
b1d441749c [flang] checkpoint once g++ can build again
Original-commit: flang-compiler/f18@1c09641a6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:03 -07:00
peter klausler
4515b167c7 [flang] merge with master, add comments
Original-commit: flang-compiler/f18@1fe4cf8142
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:02 -07:00
peter klausler
98b9465527 [flang] expression analysis
Original-commit: flang-compiler/f18@dedfe182d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:49 -07:00
peter klausler
c75c9f0a54 [flang] Refactoring and renaming
Original-commit: flang-compiler/f18@29fc0bee8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:46 -07:00
peter klausler
94540975f3 [flang] clean up naming in expressions and types
Original-commit: flang-compiler/f18@ab17ef4d4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:46 -07:00
Eric Schweitz
bb361924ff [flang] Clean up dangling spaces
Original-commit: flang-compiler/f18@7a29dc617a
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
2018-09-11 16:30:49 -07:00
Eric Schweitz
dba93d3fbe [flang] Fixes the Label vs. IntLiteralConstant issue flang-compiler/f18#180
Original-commit: flang-compiler/f18@40387158dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Tree-same-pre-rewrite: false
2018-09-11 16:26:19 -07:00
Eric Schweitz
715a1ed493 [flang] Changes per the review comments. The majority of the changes are simply
to rename identifiers to meet the project (not LLVM) coding standard.
Includes a home brew of FileCheck for testing.

Original-commit: flang-compiler/f18@bb15490cc0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
df4575f6b9 [flang] Add label resolution design document, pass, and tests
Original-commit: flang-compiler/f18@e0d0df900c
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
peter klausler
72075b659e [flang] Restore mistakenly deleted call to nonemptyList()
Original-commit: flang-compiler/f18@d40d492fb2
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
2018-09-10 14:25:03 -07:00
peter klausler
9a94a23482 [flang] Better error recovery and messages for PROCEDURE components
Original-commit: flang-compiler/f18@19813349aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
Tree-same-pre-rewrite: false
2018-09-10 14:20:35 -07:00
Tim Keith
903730721a [flang] Address review comments
Original-commit: flang-compiler/f18@2ca329b85a
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
2018-09-05 16:02:41 -07:00
Tim Keith
1b50885a3f [flang] Move KindOrLen enum to common/fortran.h
This is so that it can more easily be used in semantics in the
representation of type parameters.

Original-commit: flang-compiler/f18@f734d754e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-09-04 10:26:31 -07:00
peter klausler
53fef0b36c [flang] Fix parsing ambiguity with pointer assignment statements
Original-commit: flang-compiler/f18@42eb1b140d
Reviewed-on: https://github.com/flang-compiler/f18/pull/172
2018-09-04 11:55:27 -07:00
peter klausler
df13a8fcee [flang] Fix parsing ambiguity: MODULESUBROUTINEFOO at top level
Original-commit: flang-compiler/f18@cfda0945ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/172
Tree-same-pre-rewrite: false
2018-09-04 11:55:27 -07:00
peter klausler
eea5287a3c [flang] Better error recovery when END TYPE is expected but only END appears.
Original-commit: flang-compiler/f18@7b70829d41
2018-09-04 11:42:10 -07:00
peter klausler
8cde753c36 [flang] improve error recovery for missequenced IMPORT and IMPLICIT
Original-commit: flang-compiler/f18@a096fc8604
2018-09-04 11:13:47 -07:00
Tim Keith
37476ee32e [flang] Add common::ImportKind
Replace parser::ImportStmt::Kind and semantics::Scope::ImportKind with a
single enum class in common/fortran.h. This eliminates the need to map
between the parser enum and the semantics enum.

Original-commit: flang-compiler/f18@779a99314c
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
2018-08-23 11:45:49 -07:00
peter klausler
27753b8b98 [flang] Canonicalize nonstandard BOZ literals to avoid spurious parse/unparse/reparse/unparse failures.
Original-commit: flang-compiler/f18@d651990632
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
2018-08-09 10:17:44 -07:00
peter klausler
9e90c99e43 [flang] More expression analysis of literal constants.
Original-commit: flang-compiler/f18@3c89dace19
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:43 -07:00
peter klausler
ce231b9559 [flang] Clean up messaging: make Say() member function templates more flexible, hide MessageFormattedText instances
Original-commit: flang-compiler/f18@59d774382f
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:40 -07:00
peter klausler
a8fed82258 [flang] Implement and test RESHAPE. Avoid G++ workaround when compiled with GNU 8.2.0.
Original-commit: flang-compiler/f18@80257ee0d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:01 -07:00
peter klausler
51b3ceaafe [flang] Use a common enum class in evaluate and runtime for type category.
Original-commit: flang-compiler/f18@5012e652af
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:00 -07:00
peter klausler
439ddb334f [flang] Use std::nullopt in place of empty braces in return statements.
Original-commit: flang-compiler/f18@90e556301c
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:57 -07:00
peter klausler
837b6960a5 [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@16ed01d8f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/161
2018-08-03 14:16:16 -07:00
peter klausler
81b92ae6da [flang] Clean up end-of-statement error recovery. And fix issue#157.
Original-commit: flang-compiler/f18@23d8368571
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
2018-07-31 12:35:06 -07:00
peter klausler
e1b584468c [flang] Even better program unit END statement error recovery.
Original-commit: flang-compiler/f18@31f456ebc5
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
Tree-same-pre-rewrite: false
2018-07-30 16:33:55 -07:00
peter klausler
6135c20380 [flang] better program unit END statement error recovery
Original-commit: flang-compiler/f18@62799c88ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
Tree-same-pre-rewrite: false
2018-07-30 15:31:06 -07:00
peter klausler
5369b346c3 [flang] issue#152 and a little clean-up
Original-commit: flang-compiler/f18@54d74dc1e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/154
2018-07-30 12:56:58 -07:00
peter klausler
d90437bd91 [flang] address review comments
Original-commit: flang-compiler/f18@a18aba21fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 17:06:55 -07:00
peter klausler
851a5a00f9 [flang] add isModuleFile flag to parser::Options, use it
Original-commit: flang-compiler/f18@0727140f53
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 15:18:36 -07:00
peter klausler
4c5dfecb3e [flang] Let multiple CookedSource instances share a ref-counted AllSources.
Original-commit: flang-compiler/f18@98a170e3e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 14:58:14 -07:00
peter klausler
108e9b4678 [flang] Support resolution of provenances in messages from CharBlocks to ProvenanceRanges
Original-commit: flang-compiler/f18@aa57287959
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 14:01:19 -07:00
peter klausler
fa30061f09 [flang] fix double deallocation bug from previous commit
Original-commit: flang-compiler/f18@f216b6bb82
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 13:27:33 -07:00
peter klausler
544f9d5e74 [flang] Tweaks to provenance data structures, in preparation for better module file support.
Original-commit: flang-compiler/f18@a7b7b2b680
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 13:27:30 -07:00
Tim Keith
11225c978b [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@24672adba9
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
2018-07-27 08:12:37 -07:00
Tim Keith
6f4f772685 [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@fdbf5c841e
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
Tree-same-pre-rewrite: false
2018-07-26 16:03:31 -07:00
Tim Keith
9e48304374 [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@9088891ab2
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
Tree-same-pre-rewrite: false
2018-07-26 10:57:51 -07:00
peter klausler
594c554fa3 [flang] OpenMP conditional compilation lines
Original-commit: flang-compiler/f18@5602f7e041
Reviewed-on: https://github.com/flang-compiler/f18/pull/146
2018-07-25 11:44:20 -07:00
peter klausler
7f484d7011 [flang] real expression folding
Original-commit: flang-compiler/f18@8757dc2c90
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:57 -07:00
peter klausler
0aae9893a5 [flang] checkpoint
Original-commit: flang-compiler/f18@7fae33797a
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:53 -07:00
peter klausler
aa6c6f97a9 [flang] Begin semantic analysis of expressions.
Original-commit: flang-compiler/f18@34615fdc37
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:52 -07:00
peter klausler
6c4773012c [flang] issue#134
Original-commit: flang-compiler/f18@a40c38bdb5
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:42 -07:00
peter klausler
997e09bebd [flang] issue#142, some refactoring of common patterns in basic-parsers.h, and reformatting
Original-commit: flang-compiler/f18@1faad40678
Reviewed-on: https://github.com/flang-compiler/f18/pull/143
2018-07-24 13:51:27 -07:00
hsuauthai
08b2684271 [flang] Merge pull request flang-compiler/f18#137 from flang-compiler/omppar
Omppar

Original-commit: flang-compiler/f18@d341464e7f
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@cfbc8bd16b Add OpenMP Block directives and some declarative directive(TBD:declare reduction and declare target)
flang-compiler/f18@d198352f84 Removed extra code from resolveing conflict of the merge.
flang-compiler/f18@85911a0e80 fix some grammar and unparsing.
flang-compiler/f18@43bcfb7cd3 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@5d83b50ad3 Merge branch 'master' into omppar
flang-compiler/f18@8c666436a5 remove "HEAD" code and resolve conflict.
2018-07-20 15:49:19 -07:00