Commit graph

1019 commits

Author SHA1 Message Date
Tim Keith
af22eea4b0 [flang] Fix typo
Original-commit: flang-compiler/f18@3ad7a77898
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
2018-09-20 14:21:04 -07:00
Tim Keith
3133c9e7e2 [flang] Fix problems with extended derived types
When looking for a component name in a derived type, also look in the
parent type. Before adding a component to a derived type, report an
error if it already has one with that name. Check that components are
accessible when they are accessed.

Add the "parent component" to derived types (i.e. a component with the
same name as the parent type). The symbol is marked with the
`ParentComp` flag so we can avoid writing it to `.mod` files.

Add calls to `add_occurrence()` so that those particular instances of
`parser::Name` get their symbol set.

Change `DeclareObjectEntity` and `DeclareProcEntity` to use `SourceName` as
the name passed in rather than `parser::Name`.

Fix some problems in `unparse-with-symbols.cc` on statements that both
define and reference names.

Fixes flang-compiler/f18#187.

Original-commit: flang-compiler/f18@664b9627f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
Tree-same-pre-rewrite: false
2018-09-20 14:08:59 -07:00
Eric Schweitz
22f2533844 [flang] Merge pull request flang-compiler/f18#189 from flang-compiler/eas8
Fix a bug with BLOCK DATA name matching

Original-commit: flang-compiler/f18@2d3c4b08f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/189
2018-09-19 15:07:36 -07:00
Eric Schweitz
09a84c4d7d [flang] Fix a bug with BLOCK DATA name matching
Original-commit: flang-compiler/f18@f0af26df12
Reviewed-on: https://github.com/flang-compiler/f18/pull/189
2018-09-19 15:01:38 -07:00
Tim Keith
fe5543c49e [flang] Merge pull request flang-compiler/f18#186 from flang-compiler/tsk2
Add top-level Semantics class

Original-commit: flang-compiler/f18@8b9e7ef642
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
2018-09-17 11:15:28 -07:00
Tim Keith
bea570ff74 [flang] Change how messages_ is handled in ResolveNameVisitor
Change messages_ back to a reference. At the end, move them out to Annex
to the main messages object. This eliminates the need for set_messages
and ensures that messages_ is properly initialized.

Original-commit: flang-compiler/f18@78bd74501e
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
2018-09-16 20:34:20 -07:00
Tim Keith
f5e29b175e [flang] Add explicit '= default' for move constructor.
Original-commit: flang-compiler/f18@7007a488ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
2018-09-15 15:05:59 -07:00
Tim Keith
64ed507b36 [flang] Initialize directories_ directly rather than with setter.
Original-commit: flang-compiler/f18@a9a6fc688b
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
2018-09-14 16:21:37 -07:00
Tim Keith
7edb7ec69b [flang] Add top-level Semantics class
Refactor to create the Semantics class that is responsible for holding
state during semantics (the scope tree and messages) and managing the
logic of the various phases of semantic processing. Eliminate static
Scope::globalScope.

The messages generated during semantic processing are accumulated in a
Messages data member of Semantics so that individual phases don't need
to emit them to std::cerr. This is now done by the driver so that it has
control over where they go and eliminates other includes of iostream.
To do this, the messages object is passed in to the various semantics
operations.

Move DumpSymbols into semantics.cc: it doesn't belong in resolve-names.cc
and it depends on the global scope, so it's as good a place as any.
The call to RewriteParseTree is also moved to Semantics.

Original-commit: flang-compiler/f18@771d0e1293
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
2018-09-14 15:04:50 -07:00
Eric Schweitz
cd839623ec [flang] Merge pull request flang-compiler/f18#184 from flang-compiler/eas5
Add semantics checking for END xxx statements.

Original-commit: flang-compiler/f18@e4f2b6c7d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
2018-09-13 15:46:17 -07:00
Eric Schweitz
9ea2010677 [flang] Convert some of the functions to longer names.
Original-commit: flang-compiler/f18@6cb59e916c
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
2018-09-13 15:46:17 -07:00
Eric Schweitz
43da7a187e [flang] Remove incorrect error message
Original-commit: flang-compiler/f18@9ef54520df
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
Tree-same-pre-rewrite: false
2018-09-13 15:46:17 -07:00
Eric Schweitz
b1938138a7 [flang] Add semantics checking for END xxx statements.
Add a negative test for END xxx names.
Reverse the sequence of calls such that resolve-label is before
resolve-name.

Original-commit: flang-compiler/f18@5fe62f108c
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
Tree-same-pre-rewrite: false
2018-09-13 15:46:17 -07:00
Peter Klausler
c000824d80 [flang] Merge pull request flang-compiler/f18#183 from flang-compiler/pmk0
Semantic analysis of expressions (work in progress)

Original-commit: flang-compiler/f18@c9521f66c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
2018-09-13 11:30:07 -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
58b357d1ce [flang] Repair CMakeLists.txt after accidentally clang-formatting it
Original-commit: flang-compiler/f18@21eef98f47
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:37:28 -07:00
peter klausler
74563c17c1 [flang] Add "explicit" to constructors, define Type<TypeCategory::Derived>
Original-commit: flang-compiler/f18@79c165af65
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:23 -07:00
peter klausler
55763194f1 [flang] Merge with current master, address early review comments.
Original-commit: flang-compiler/f18@d1f981ddb4
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:22 -07:00
peter klausler
a73eebdbca [flang] remove unused code
Original-commit: flang-compiler/f18@79c3252340
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:21 -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
9236fa92ae [flang] array references
Original-commit: flang-compiler/f18@5659510c31
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:19 -07:00
peter klausler
935f0a2470 [flang] automate analysis of expression parse tree types that are wrappers/unions
Original-commit: flang-compiler/f18@e8fbd6c1fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:19 -07:00
peter klausler
f9d4cef84e [flang] cleaning up TODOs
Original-commit: flang-compiler/f18@cfd67de3cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:18 -07:00
peter klausler
dc31b3d1ca [flang] LOGICAL operations
Original-commit: flang-compiler/f18@71a1de4c59
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:17 -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
63a26fc7dc [flang] mixed z+i, z+r expressions
Original-commit: flang-compiler/f18@5c5d11c1f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:12 -07:00
peter klausler
0b2d90bc00 [flang] Finish typeless casting
Original-commit: flang-compiler/f18@a4cfd1696a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:12 -07:00
peter klausler
5f43f78b82 [flang] more operators
Original-commit: flang-compiler/f18@4925b4b944
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:11 -07:00
peter klausler
79408f956d [flang] restructure work in progress in semantics/expression.cc; checkpoint before finishing operators
Original-commit: flang-compiler/f18@5d991b0df3
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:10 -07:00
peter klausler
b357bfcb99 [flang] checkpoint
Original-commit: flang-compiler/f18@04697760f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:09 -07:00
peter klausler
70febd9285 [flang] cleanup
Original-commit: flang-compiler/f18@99c4bcb60c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:07 -07:00
peter klausler
3c850d05ca [flang] checkpoint - building again now with all compilers
Original-commit: flang-compiler/f18@8cd746910d
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:05 -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
7d042acb9d [flang] continue refactoring
Original-commit: flang-compiler/f18@f2b49ba0e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:01 -07:00
peter klausler
f38fe515ed [flang] CombineVariants
Original-commit: flang-compiler/f18@d4c55084bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:59 -07:00
peter klausler
a9446d3d40 [flang] work on numeric operations
Original-commit: flang-compiler/f18@e0ab91914c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:58 -07:00
peter klausler
e90480785d [flang] Replace FOR_EACH_... macro cruft with safer template metaprogramming.
Original-commit: flang-compiler/f18@bc3c4279b0
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:56 -07:00
peter klausler
b114c58118 [flang] Remove GenericExpr, move operator overloads to tools.h
Original-commit: flang-compiler/f18@23e7a6c27c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:56 -07:00
peter klausler
c0d3a67fac [flang] complex extraction of operator classes
Original-commit: flang-compiler/f18@0506bb7a0c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:54 -07:00
peter klausler
856123351c [flang] checkpoint
Original-commit: flang-compiler/f18@e874c926d0
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:53 -07:00
peter klausler
e798ab7d91 [flang] checkpoint with clang workaround
Original-commit: flang-compiler/f18@c4a2aaf8b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:52 -07:00
peter klausler
ae308415bb [flang] checkpoint
Original-commit: flang-compiler/f18@2a9e80d9bb
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:51 -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
5566d70ef2 [flang] More cleaning
Original-commit: flang-compiler/f18@8227229f62
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:48 -07:00
peter klausler
d986a35a5c [flang] Extirpate expression-forward.h
Original-commit: flang-compiler/f18@288acd3993
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:47 -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