Tim Keith [Sat, 22 Sep 2018 15:05:46 +0000 (08:05 -0700)]
[flang] Fix problems determining object/function/subroutine
Convert each Entity to ObjectEntity at the end of each scope.
Add `ConvertToObjectEntity()` to achieve this, similar to
`ConvertToProcEntity()`. Move them both up into `ScopeHandler`
because they need to be called from `PopScope()`.
In a proc-decl, only mark the proc as a function if it has a return type.
If no return type is declared, function vs. subroutine is determined by:
- for a module it is a subroutine (at end of specification-part)
- otherwise it is by usage
If an entity that could otherwise be a function is used as the base of a
structure component, that forces it to be an object. Because we have to
change it to an object entity at that point, the `base` in `FindComponent()`
can't be const, and that propagates to all of its callers.
Remove the name argument to `ApplyImplicitRules` as it is unneeded.
Fixes flang-compiler/f18#191.
Original-commit: flang-compiler/f18@
9bd8bf7c3706e501a58b564f316794d023f762b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/194
Tree-same-pre-rewrite: false
Tim Keith [Fri, 21 Sep 2018 18:37:02 +0000 (11:37 -0700)]
[flang] Merge pull request flang-compiler/f18#192 from flang-compiler/tsk2
Fix problems with extended derived types
Original-commit: flang-compiler/f18@
c9b323a49b2b0894a3f115d4fce61122b8e0a496
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
Tim Keith [Thu, 20 Sep 2018 21:21:04 +0000 (14:21 -0700)]
[flang] Fix typo
Original-commit: flang-compiler/f18@
3ad7a77898f2d85cf01d4a1445d1ed4b274e0236
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
Tim Keith [Thu, 20 Sep 2018 21:08:59 +0000 (14:08 -0700)]
[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@
664b9627f2be6dc4212f6904e6f14ee642b473a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 19 Sep 2018 22:07:36 +0000 (15:07 -0700)]
[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@
2d3c4b08f4daf347e95164fb23b06fb730f523e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/189
Eric Schweitz [Wed, 19 Sep 2018 22:00:33 +0000 (15:00 -0700)]
[flang] Fix a bug with BLOCK DATA name matching
Original-commit: flang-compiler/f18@
f0af26df12912839d94a8ec5e7f66b8c22674a85
Reviewed-on: https://github.com/flang-compiler/f18/pull/189
Tim Keith [Mon, 17 Sep 2018 18:15:28 +0000 (11:15 -0700)]
[flang] Merge pull request flang-compiler/f18#186 from flang-compiler/tsk2
Add top-level Semantics class
Original-commit: flang-compiler/f18@
8b9e7ef642aa59fdb5cb326f253fd0d208acc3c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tim Keith [Mon, 17 Sep 2018 03:34:20 +0000 (20:34 -0700)]
[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@
78bd74501ed9f76de14175452b39374a8fbf66a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tim Keith [Sat, 15 Sep 2018 22:05:59 +0000 (15:05 -0700)]
[flang] Add explicit '= default' for move constructor.
Original-commit: flang-compiler/f18@
7007a488ba61bf53f0f9edfd82250b7d08a68c68
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
Tim Keith [Fri, 14 Sep 2018 23:21:37 +0000 (16:21 -0700)]
[flang] Initialize directories_ directly rather than with setter.
Original-commit: flang-compiler/f18@
a9a6fc688bb42840651055363172d5e5166d9447
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
Tim Keith [Fri, 14 Sep 2018 22:04:50 +0000 (15:04 -0700)]
[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@
771d0e1293c460fe28946f20464587f9a993586d
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 13 Sep 2018 22:46:17 +0000 (15:46 -0700)]
[flang] Merge pull request flang-compiler/f18#184 from flang-compiler/eas5
Add semantics checking for END xxx statements.
Original-commit: flang-compiler/f18@
e4f2b6c7d7585ed124df07b80a822e79c96349c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
Eric Schweitz [Thu, 13 Sep 2018 22:44:33 +0000 (15:44 -0700)]
[flang] Convert some of the functions to longer names.
Original-commit: flang-compiler/f18@
6cb59e916c26138e3e95b4edef7cfeadb40eae07
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
Eric Schweitz [Thu, 13 Sep 2018 22:34:34 +0000 (15:34 -0700)]
[flang] Remove incorrect error message
Original-commit: flang-compiler/f18@
9ef54520dfa4779023e5deb4bf366956b7f2c2ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 13 Sep 2018 21:50:38 +0000 (14:50 -0700)]
[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@
5fe62f108ce83315d2ffde23429188b995850414
Reviewed-on: https://github.com/flang-compiler/f18/pull/184
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 13 Sep 2018 18:30:07 +0000 (11:30 -0700)]
[flang] Merge pull request flang-compiler/f18#183 from flang-compiler/pmk0
Semantic analysis of expressions (work in progress)
Original-commit: flang-compiler/f18@
c9521f66c27278172339d2e602586d529f951f48
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
peter klausler [Thu, 13 Sep 2018 18:29:10 +0000 (11:29 -0700)]
[flang] Resolve recent NAG failures better, more clean-up, ready for merge.
Original-commit: flang-compiler/f18@
5bc5a317f4c67c2525b0c9cd08b45ee3bd6dafc0
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
peter klausler [Thu, 13 Sep 2018 17:29:44 +0000 (10:29 -0700)]
[flang] Fix recent regression on NAG tests found during pre-merge testing
Original-commit: flang-compiler/f18@
1fc6d00ac8eaaf952bfb0dd2fe3b14d9d104496f
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 12 Sep 2018 23:37:28 +0000 (16:37 -0700)]
[flang] Repair CMakeLists.txt after accidentally clang-formatting it
Original-commit: flang-compiler/f18@
21eef98f477c15c6c015797b298fbc32230b9ba8
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 12 Sep 2018 23:27:51 +0000 (16:27 -0700)]
[flang] Add "explicit" to constructors, define Type<TypeCategory::Derived>
Original-commit: flang-compiler/f18@
79c165af65a0357f5bf90995f862fdb4ec11364e
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 12 Sep 2018 20:53:14 +0000 (13:53 -0700)]
[flang] Merge with current master, address early review comments.
Original-commit: flang-compiler/f18@
d1f981ddb431fedcc6aba5e33465ebe85fdf66dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 12 Sep 2018 18:50:25 +0000 (11:50 -0700)]
[flang] remove unused code
Original-commit: flang-compiler/f18@
79c32523405c86f1fdd4a3b0c7fcb3f86daa57fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 12 Sep 2018 18:20:30 +0000 (11:20 -0700)]
[flang] clean up for review
Original-commit: flang-compiler/f18@
d3d81b1e6fdc394b8ba9607ce15f39988a3b8e23
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 12 Sep 2018 00:06:44 +0000 (17:06 -0700)]
[flang] array references
Original-commit: flang-compiler/f18@
5659510c31f858bdba91ea58de3df21bc1aac08c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 11 Sep 2018 18:13:40 +0000 (11:13 -0700)]
[flang] automate analysis of expression parse tree types that are wrappers/unions
Original-commit: flang-compiler/f18@
e8fbd6c1fdce933db5c8a49b56d389bb366bca78
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 7 Sep 2018 23:54:33 +0000 (16:54 -0700)]
[flang] cleaning up TODOs
Original-commit: flang-compiler/f18@
cfd67de3cdda968e01928bdab4a9767dd30ab869
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 7 Sep 2018 22:25:10 +0000 (15:25 -0700)]
[flang] LOGICAL operations
Original-commit: flang-compiler/f18@
71a1de4c599c89f2b93afffdc40b8b6d10066dbd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 7 Sep 2018 17:33:32 +0000 (10:33 -0700)]
[flang] add left(), right(), and comments
Original-commit: flang-compiler/f18@
372fd0650895153286e66f21caff9302f635cb36
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 6 Sep 2018 00:12:03 +0000 (17:12 -0700)]
[flang] mixed Complex; removed BOZConstant in favor of converting in place
Original-commit: flang-compiler/f18@
17a18ddd223d8a91687d59f0299dbbf35f771f72
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 4 Sep 2018 23:42:32 +0000 (16:42 -0700)]
[flang] mixed z+i, z+r expressions
Original-commit: flang-compiler/f18@
5c5d11c1f77fa188a4ee88c6a15c47fb6d734edc
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 4 Sep 2018 21:20:48 +0000 (14:20 -0700)]
[flang] Finish typeless casting
Original-commit: flang-compiler/f18@
a4cfd1696aec7fc5686ca6f018a209546de679d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 31 Aug 2018 23:14:14 +0000 (16:14 -0700)]
[flang] more operators
Original-commit: flang-compiler/f18@
4925b4b94461dfeecd8f1f542ef81da00f99e071
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 31 Aug 2018 20:28:21 +0000 (13:28 -0700)]
[flang] restructure work in progress in semantics/expression.cc; checkpoint before finishing operators
Original-commit: flang-compiler/f18@
5d991b0df38937f59aeade66fe413b2b5d4d3a4d
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 30 Aug 2018 17:09:44 +0000 (10:09 -0700)]
[flang] checkpoint
Original-commit: flang-compiler/f18@
04697760f34f6d56bf5ca96ed7dad8051b29e7c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 29 Aug 2018 19:26:22 +0000 (12:26 -0700)]
[flang] cleanup
Original-commit: flang-compiler/f18@
99c4bcb60c66b591b24143be194ba85ff692977d
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 28 Aug 2018 23:35:45 +0000 (16:35 -0700)]
[flang] checkpoint - building again now with all compilers
Original-commit: flang-compiler/f18@
8cd746910de1f256fbab4f80d125b535e4cafe1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 28 Aug 2018 22:15:18 +0000 (15:15 -0700)]
[flang] checkpoint once g++ can build again
Original-commit: flang-compiler/f18@
1c09641a6daf04909561cc8d5ff7b7c223e961c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 23 Aug 2018 22:28:08 +0000 (15:28 -0700)]
[flang] merge with master, add comments
Original-commit: flang-compiler/f18@
1fe4cf81428fd63fe17671edf0071046a509e791
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 23 Aug 2018 21:49:28 +0000 (14:49 -0700)]
[flang] continue refactoring
Original-commit: flang-compiler/f18@
f2b49ba0e23a6281f9e850611712bdbb32af3334
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 23 Aug 2018 19:00:44 +0000 (12:00 -0700)]
[flang] CombineVariants
Original-commit: flang-compiler/f18@
d4c55084bd5a432d56e118da009ee19050c10d00
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 23 Aug 2018 17:55:16 +0000 (10:55 -0700)]
[flang] work on numeric operations
Original-commit: flang-compiler/f18@
e0ab91914c6f20d0e242e80795c35cc858860449
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 22 Aug 2018 20:36:45 +0000 (13:36 -0700)]
[flang] Replace FOR_EACH_... macro cruft with safer template metaprogramming.
Original-commit: flang-compiler/f18@
bc3c4279b053bf9d779bb9b341cde8bd6222260a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Mon, 20 Aug 2018 16:29:08 +0000 (09:29 -0700)]
[flang] Remove GenericExpr, move operator overloads to tools.h
Original-commit: flang-compiler/f18@
23e7a6c27c72c88f565bcd6e4cc02d46e082ec5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 17 Aug 2018 22:38:37 +0000 (15:38 -0700)]
[flang] complex extraction of operator classes
Original-commit: flang-compiler/f18@
0506bb7a0c28cc9374c62eecfb7def724c5488fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 17 Aug 2018 16:50:32 +0000 (09:50 -0700)]
[flang] checkpoint
Original-commit: flang-compiler/f18@
e874c926d039953f4309f98ab05c1c6f1d272ab8
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Thu, 16 Aug 2018 18:46:18 +0000 (11:46 -0700)]
[flang] checkpoint with clang workaround
Original-commit: flang-compiler/f18@
c4a2aaf8b10adc2aec0d66f020d358e2a2ac417b
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Wed, 15 Aug 2018 20:46:33 +0000 (13:46 -0700)]
[flang] checkpoint
Original-commit: flang-compiler/f18@
2a9e80d9bbd75fdbf7b563dece563531866ac4e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 14 Aug 2018 23:48:49 +0000 (16:48 -0700)]
[flang] expression analysis
Original-commit: flang-compiler/f18@
dedfe182d9fc9f0d2d7392c515b84ac0492d16f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 14 Aug 2018 22:11:53 +0000 (15:11 -0700)]
[flang] More cleaning
Original-commit: flang-compiler/f18@
8227229f625dd7a88760ea96810c9456295d8a43
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 14 Aug 2018 21:35:51 +0000 (14:35 -0700)]
[flang] Extirpate expression-forward.h
Original-commit: flang-compiler/f18@
288acd399304de69c154b7b7bfe3b9d0ccd32a7d
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 14 Aug 2018 20:39:59 +0000 (13:39 -0700)]
[flang] Refactoring and renaming
Original-commit: flang-compiler/f18@
29fc0bee8a14cad46ec29b5baf6326cad7c0b4e0
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Tue, 14 Aug 2018 00:05:15 +0000 (17:05 -0700)]
[flang] clean up naming in expressions and types
Original-commit: flang-compiler/f18@
ab17ef4d4bc7e5ab8fae2dbe43edd47f25f9ba5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Mon, 13 Aug 2018 20:33:31 +0000 (13:33 -0700)]
[flang] checkpoint
Original-commit: flang-compiler/f18@
3fae716c44104cd9ec7694ccda93c8881f2e3c7e
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
peter klausler [Fri, 10 Aug 2018 18:44:43 +0000 (11:44 -0700)]
[flang] Expression analysis checkpoint
Original-commit: flang-compiler/f18@
f740cab6414d8bec8614c66f1deec6dc96da80ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
Tim Keith [Wed, 12 Sep 2018 22:56:55 +0000 (15:56 -0700)]
[flang] Merge pull request flang-compiler/f18#179 from flang-compiler/tsk1
Improve error message for "type already declared"
Original-commit: flang-compiler/f18@
46b68921531f13a1ecf70e289ed22ec8b5e26c32
Reviewed-on: https://github.com/flang-compiler/f18/pull/179
Tim Keith [Tue, 11 Sep 2018 14:26:54 +0000 (07:26 -0700)]
[flang] Improve error message for "type already declared"
Add reference to the statement where the type was first set.
Original-commit: flang-compiler/f18@
911c90e99ee43e4e221d0b5ffd8a76c82390c153
Reviewed-on: https://github.com/flang-compiler/f18/pull/179
Tim Keith [Wed, 12 Sep 2018 18:38:26 +0000 (11:38 -0700)]
[flang] Merge pull request flang-compiler/f18#182 from flang-compiler/tsk2
Simplify representation of intrinsic types
Original-commit: flang-compiler/f18@
a6afb59d427a178f51055ae5df00b2cbcae6d054
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
Tim Keith [Wed, 12 Sep 2018 18:37:29 +0000 (11:37 -0700)]
[flang] The default kind of complex is the same as that of real.
Original-commit: flang-compiler/f18@
16080c06746194c9e51daf14ae649342d4c0683a
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
Tim Keith [Wed, 12 Sep 2018 00:33:42 +0000 (17:33 -0700)]
[flang] Simplify representation of intrinsic types
Intrinsic types are now just a TypeCategory and a int kind. If no kind
is specified the default is used so that every type has an explicit
kind. This caused changes in the expected results of some of the tests.
Add support for "double precision" and "double complex".
Intrinsic types are now stored as values in DeclTypeSpec so none of the
KindedTypeHelper machinery is needed any more.
Eliminate DerivedTypeDef, DataComponentDef, ProcComponentDef,
TypeBoundProc. The components and bindings of a derived type are now
represented by the corresponding Scope.
Original-commit: flang-compiler/f18@
4ad8ffb18708e073da9a0f37c3bb09a271ca1c02
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 12 Sep 2018 15:30:43 +0000 (08:30 -0700)]
[flang] Merge pull request flang-compiler/f18#181 from flang-compiler/eas6
Issue flang-compiler/f18#180 - Label vs. IntLiteralConstant
Original-commit: flang-compiler/f18@
2350ed912873d17c897d5e4d08a583bb2edfaec7
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Eric Schweitz [Tue, 11 Sep 2018 23:30:49 +0000 (16:30 -0700)]
[flang] Clean up dangling spaces
Original-commit: flang-compiler/f18@
7a29dc617a45bd864c62b4da76eeda8f8d7fc235
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Eric Schweitz [Tue, 11 Sep 2018 23:26:19 +0000 (16:26 -0700)]
[flang] Fixes the Label vs. IntLiteralConstant issue flang-compiler/f18#180
Original-commit: flang-compiler/f18@
40387158dc33ae4623bef89d4509fb682feba82b
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Tree-same-pre-rewrite: false
Eric Schweitz [Tue, 11 Sep 2018 21:01:25 +0000 (14:01 -0700)]
[flang] Merge pull request flang-compiler/f18#170 from flang-compiler/easddd
Add label resolution initial pass implementation and tests
Original-commit: flang-compiler/f18@
92a20cbdc9ec72a97ce0ea1f733b61ce1ae77de7
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Eric Schweitz [Thu, 6 Sep 2018 23:21:35 +0000 (16:21 -0700)]
[flang] tweak Legality
Original-commit: flang-compiler/f18@
19834c65d7d5889932d139681eb200af98a0c603
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Eric Schweitz [Thu, 6 Sep 2018 22:37:40 +0000 (15:37 -0700)]
[flang] clang-format doesn't
Original-commit: flang-compiler/f18@
0114db6ced2186c862862af636b121e329125f70
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 22:32:33 +0000 (15:32 -0700)]
[flang] Remove the strict F18 checking flag. Always check that program is
strictly conforming to F18, but demote errors to warnings when the
Fortran is legal under pre-F18 standards. If the Fortran is illegal
under F18 _and_ previous standards, then emit an error.
Original-commit: flang-compiler/f18@
6d1f37683a4409a609af49c4a623007950c868fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 22:03:03 +0000 (15:03 -0700)]
[flang] convert name to lowercase
Original-commit: flang-compiler/f18@
f591d31ab436157e92b1e46a86a6f6148b5d812d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 20:33:51 +0000 (13:33 -0700)]
[flang] More renaming
Original-commit: flang-compiler/f18@
9ef9ef4479468f5054edfe3183e4c4d14dc87111
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 17:38:52 +0000 (10:38 -0700)]
[flang] Fix a couple other spots clang-format missed
Original-commit: flang-compiler/f18@
1a4b12e1b2d38db3a39ddb4a4dbdd6b96d32010f
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 17:31:47 +0000 (10:31 -0700)]
[flang] clang-format didn't clean up some of the code. delete std::make_pair call.
Original-commit: flang-compiler/f18@
4defccc50d428f7b5493cde585f3436a29ce10e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 17:04:18 +0000 (10:04 -0700)]
[flang] Simplify some of the if-return-else-return expansions while possibly
keeping things readable.
Original-commit: flang-compiler/f18@
55b7e18763de2cb786ea03b4813aabd45a507337
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 16:55:29 +0000 (09:55 -0700)]
[flang] Fix globbing bug and return variable not being set
Original-commit: flang-compiler/f18@
238349048bb7e5b4bbf359e6dad2d24b647ebb33
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 6 Sep 2018 16:06:21 +0000 (09:06 -0700)]
[flang] Per review:
Change initializer lists to use curlies.
Change uses of std::tuple to PODs & add ctors per compiler complaining.
Original-commit: flang-compiler/f18@
42c5cdcaabb7fdc4971698fadb608a9df61360b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 5 Sep 2018 23:04:56 +0000 (16:04 -0700)]
[flang] More review comment actions.
Original-commit: flang-compiler/f18@
eb7ab3452d9cfd969154ffacc3d1a007dbaef367
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 5 Sep 2018 22:26:41 +0000 (15:26 -0700)]
[flang] Changes for the latest round of syntax change requests per the review.
Original-commit: flang-compiler/f18@
0df221aeda76b927376fe524231ba2db22bdf1c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 5 Sep 2018 18:37:45 +0000 (11:37 -0700)]
[flang] ctest may require that the path be specified, so add it to the input file name.
Original-commit: flang-compiler/f18@
751e88f108ffb06ba736b97ea2359e27a3ca136a
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Tue, 4 Sep 2018 18:34:26 +0000 (11:34 -0700)]
[flang] remove emacs line
Original-commit: flang-compiler/f18@
64aa22d64491ed986c1c26b1837402ee52cd208d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Fri, 31 Aug 2018 17:26:19 +0000 (10:26 -0700)]
[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@
bb15490cc02327773cb680597226346f02cd4dd0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Tue, 28 Aug 2018 17:14:43 +0000 (10:14 -0700)]
[flang] Use is_same<> templates
Original-commit: flang-compiler/f18@
a47f6bacf09a032c46d9d26d7e3d07c5b96853ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Tue, 28 Aug 2018 17:07:48 +0000 (10:07 -0700)]
[flang] Make use of is_same<>
Original-commit: flang-compiler/f18@
12cd53086568241e68d7a7b03f024ae746607e6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Mon, 27 Aug 2018 22:14:41 +0000 (15:14 -0700)]
[flang] Merge up to new Messages interface
Original-commit: flang-compiler/f18@
ca45fdd1cbc1cba3a14da52b59616361b1cdd967
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Eric Schweitz [Mon, 20 Aug 2018 23:47:18 +0000 (16:47 -0700)]
[flang] Add label resolution design document, pass, and tests
Original-commit: flang-compiler/f18@
e0d0df900c4d823b7114a4d511105c2dbd9d2e77
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 10 Sep 2018 23:25:38 +0000 (16:25 -0700)]
[flang] Merge pull request flang-compiler/f18#178 from flang-compiler/pmk1
Better error recovery and messages for PROCEDURE components (issue#174)
Original-commit: flang-compiler/f18@
31c258ae68a0fd4fe9413d33edb6be1dae1af482
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
peter klausler [Mon, 10 Sep 2018 21:25:03 +0000 (14:25 -0700)]
[flang] Restore mistakenly deleted call to nonemptyList()
Original-commit: flang-compiler/f18@
d40d492fb2230bebd692f15a79d0399041557817
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
peter klausler [Mon, 10 Sep 2018 21:19:37 +0000 (14:19 -0700)]
[flang] Better error recovery and messages for PROCEDURE components
Original-commit: flang-compiler/f18@
19813349aa19222974f7cb92b98a1b38407cdaf7
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
Tree-same-pre-rewrite: false
Tim Keith [Mon, 10 Sep 2018 22:37:43 +0000 (15:37 -0700)]
[flang] Merge pull request flang-compiler/f18#177 from flang-compiler/tsk1
Write private symbols to .mod files
Original-commit: flang-compiler/f18@
f325e8b765278bca5626def839cfb07d5662f261
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tim Keith [Mon, 10 Sep 2018 19:20:42 +0000 (12:20 -0700)]
[flang] Miscellaneous name resolution
Handle BIND statement and PARAMETER statement. They are different from
other attribute-setting statements so some refactoring of
HandleAttributeStmt is required. And for PARAMETER, SetType needs to
report an error if the implicitly determined type is changed later. This
requires operator== on DeclTypeSpec.
Resolve names in allocate statements, pointer assignment statements,
substring expressions, and type parameter values.
Original-commit: flang-compiler/f18@
79ad96b976c495dcc836267bd08276c4a6be8bb4
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tim Keith [Fri, 7 Sep 2018 22:39:20 +0000 (15:39 -0700)]
[flang] Write private symbols to .mod files
We were trying to write only symbols that are part of the public API of
a module to the .mod file. The problem with that is that submodules need
access to the private symbols in their ancestor modules and submodules.
For now, just write out all of the symbols, private or otherwise.
We could be more precise by omitting some private symbols for modules
that don't have separate module procedures and so can't have submodules.
Also, the old implementation went into an infinite loop for recursive
derived types.
This makes CollectSymbols simpler, so have it do both the collecting and
sorting. Make it static so that the types don't have to be defined in
mod-file.h.
Original-commit: flang-compiler/f18@
33a10d6238c3b0062c43974114048ccc8cc1f450
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
Tim Keith [Fri, 7 Sep 2018 16:48:40 +0000 (09:48 -0700)]
[flang] Ensure use of ObjectEntityDetails for data objects
A symbol is created with EntityDetails if we don't know whether it is a
procedure or data object. At the end of the specification part, if we
don't know it's a procedure then it must be an object, so convert it
then. So after name resolution there should be no symbols with
EntityDetails.
Also, a couple of small fixes:
- need to visit sub-nodes of shape specs so that any names get resolved
- don't report an error for an array element mis-parsed as a call
Original-commit: flang-compiler/f18@
0effecd2252488455b1d2f0c86dc3dc00d37f483
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
Tim Keith [Thu, 6 Sep 2018 20:44:21 +0000 (13:44 -0700)]
[flang] Code cleanup
Rename stmtFuncsToConvert to stmtFuncsToConvert_.
Make member functions out-of-line.
Original-commit: flang-compiler/f18@
3ada89d22f7fb79d7730a7498d89a96dbc9bffab
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
Tim Keith [Thu, 6 Sep 2018 20:31:45 +0000 (13:31 -0700)]
[flang] Fix bug in rewriting function calls
Arrays are now represented with ObjectEntityDetails, not EntityDetails.
So that's what we have to look for when rewriting function calls to
array element references.
Original-commit: flang-compiler/f18@
841b37d94bc02f5a8726873fff7182cee053c8c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
Tim Keith [Fri, 7 Sep 2018 16:08:05 +0000 (09:08 -0700)]
[flang] Merge pull request flang-compiler/f18#175 from flang-compiler/tsk1
More name resolution
Original-commit: flang-compiler/f18@
804e7359134a6bf724d27085931608cc9297dbe0
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tim Keith [Fri, 7 Sep 2018 16:06:27 +0000 (09:06 -0700)]
[flang] Address review comments
Change IsModule to a member function of Scope.
Make multiple PRIVATE statements in a derived type be a non-fatal error.
Original-commit: flang-compiler/f18@
dd42dcd15a634c629168c5fcb767c09184f000f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tim Keith [Thu, 6 Sep 2018 19:06:32 +0000 (12:06 -0700)]
[flang] Add procedure pointer components for derived types
Also eliminate `derivedTypeData_`. Information about derived types needed
during name resolution is in `derivedTypeInfo_` and the permanent record
is the symbol table.
Original-commit: flang-compiler/f18@
789960bd95d1a4c24650ff14950cb9faaa13c6aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
Tim Keith [Thu, 6 Sep 2018 15:01:49 +0000 (08:01 -0700)]
[flang] More derived type name resolution
Track PRIVATE statement in derived type components and in procedure
bindings. These are recorded in derivedTypeInfo_ (along with the name
appearing in EXTENDS) and used to modify the accessibility attributes of
components and bindings. Also track SEQUENCE statement.
Detect erroneous PRIVATE in derived types that aren't in modules.
Detect incompatible SEQUENCE types.
Save EXTENDS symbol and SEQUENCE in DerivedTypeDetails and write them to
the .mod file.
Original-commit: flang-compiler/f18@
f29d6207140bb818442b2d5cb7de067a34082b61
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
Tim Keith [Wed, 5 Sep 2018 20:44:22 +0000 (13:44 -0700)]
[flang] Improve dumping of enums in parse tree
Change dump-parse-tree.h to dump enumerator names rather than just type
names for data members whose types are defined with ENUM_CLASS.
Original-commit: flang-compiler/f18@
57bd4f3af945d9416ef8b302fdad7400e76d54b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
Tim Keith [Wed, 5 Sep 2018 23:04:12 +0000 (16:04 -0700)]
[flang] Merge pull request flang-compiler/f18#173 from flang-compiler/tsk1
More name resolution for derived types
Original-commit: flang-compiler/f18@
c06230e9cc9a4ad15c2e6dac79db26461489e666
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tim Keith [Wed, 5 Sep 2018 23:02:41 +0000 (16:02 -0700)]
[flang] Address review comments
Original-commit: flang-compiler/f18@
2ca329b85a3e6113f417dff25ba39898bd8869e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tim Keith [Tue, 4 Sep 2018 17:28:27 +0000 (10:28 -0700)]
[flang] Resolve derived type parameters
Add TypeParamDetails for symbols that represent type parameters.
Create such symbols when a type-param-def-stmt is encountered.
At the end of the derived-type-def, check the parameters named
in the type-param-name-list against those encountered in each
type-param-def-stmt.
Original-commit: flang-compiler/f18@
c15247bb30311e7166429a34db510cb8c736bd66
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
Tim Keith [Tue, 4 Sep 2018 17:26:31 +0000 (10:26 -0700)]
[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@
f734d754e49b45c8bcaf246f577b030e77413aa7
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false