peter klausler [Tue, 3 Apr 2018 20:02:40 +0000 (13:02 -0700)]
[flang] Error recovery for specification part.
Original-commit: flang-compiler/f18@
187075c7a052c3d38760890c63127b4016be383a
Reviewed-on: https://github.com/flang-compiler/f18/pull/39
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 3 Apr 2018 17:30:16 +0000 (10:30 -0700)]
[flang] Merge pull request flang-compiler/f18#38 from ThePortlandGroup/pmk-recovery
Messaging and error recovery work
Original-commit: flang-compiler/f18@
073210bf91ddc91e7f2e773861d9a40a2fd34de4
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
peter klausler [Tue, 3 Apr 2018 17:29:04 +0000 (10:29 -0700)]
[flang] Address review comments (thanks!).
Original-commit: flang-compiler/f18@
1e61fbaeae5402fcd0c732de244bfe02aadfe6ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
peter klausler [Tue, 3 Apr 2018 00:00:28 +0000 (17:00 -0700)]
[flang] Add documentation.
Original-commit: flang-compiler/f18@
4114c9e695ff740199ec015a041be3ac0fa8b779
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 23:44:34 +0000 (16:44 -0700)]
[flang] More clean-up in token-parsers.h.
Original-commit: flang-compiler/f18@
320213454237dcda9011f2ee48c258c118d83f0c
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 23:33:10 +0000 (16:33 -0700)]
[flang] Debugging and a TODO.
Original-commit: flang-compiler/f18@
4fab40bc37e870e3b4fa039d51d7cc8b672f2f36
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 23:06:18 +0000 (16:06 -0700)]
[flang] Better error recovery, some debugging.
Original-commit: flang-compiler/f18@
b7509f0e5be796e0b29a481215f3950c8276d76d
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 22:51:04 +0000 (15:51 -0700)]
[flang] Revamp messaging. Add ""_err_en_US to denote fatal error messages.
Original-commit: flang-compiler/f18@
7ddc807a1bb6b33613ebdfab9c089bb2eabdcea9
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 18:52:53 +0000 (11:52 -0700)]
[flang] Fix debug-parser.h after recent merge.
Original-commit: flang-compiler/f18@
97b6df606c4add591c212ff4b8aa5f4b8e3de765
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 18:05:07 +0000 (11:05 -0700)]
[flang] Fix indentation bug in unparsed output that I introduced in last merge.
Original-commit: flang-compiler/f18@
aa0ba5acacc02a360504661e457446a370dff4c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
peter klausler [Mon, 2 Apr 2018 17:59:42 +0000 (10:59 -0700)]
[flang] Work around clang-format issue by using "auto" where type is obvious.
Original-commit: flang-compiler/f18@
7499bccaa938547d3af29c7b859f1fede2e718be
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
Tim Keith [Mon, 2 Apr 2018 17:49:22 +0000 (10:49 -0700)]
[flang] Merge pull request flang-compiler/f18#36 from ThePortlandGroup/tsk6
Continue work on name resolution
Original-commit: flang-compiler/f18@
acaee7b44f4d9fd87800032eb385685407343eb8
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tim Keith [Mon, 2 Apr 2018 17:36:51 +0000 (10:36 -0700)]
[flang] Fix bug parsing "implicit none(type)"
"implicit none(type)" was being recognized as "implicit none(external)".
Original-commit: flang-compiler/f18@
0cc88678369afa49b8e435eb5e9d43fc119b37d0
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tim Keith [Sat, 31 Mar 2018 02:49:00 +0000 (19:49 -0700)]
[flang] Respond to review comments.
Original-commit: flang-compiler/f18@
d2497a6485e1dc8ea5fc7ba1dfb01d7603f57bfa
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tree-same-pre-rewrite: false
Tim Keith [Fri, 30 Mar 2018 20:57:23 +0000 (13:57 -0700)]
[flang] Continue work on name resolution
Enhance DeclTypeSpecVisitor to find derived-type-specs, including with
type parameter values.
Change DerivedTypeSpec so it only needs the name of the derived type,
not the definition, as that isn't necessarily known when we encounter
it.
Fix how memory is managed in DeclTypeSpec: Intrinsic type specs aren't a
problem -- they are one of a few types that live throughout the program.
Derived type specs are dynamically allocated and the memory is owned by
the DeclTypeSpec -- it allocates it when a DeclTypeSpec for a derived
type is created and deletes it when it is destroyed. Pass around
references to TypeSpecs rather than pointers as they can never be null.
In AttrsVisitor, DeclTypeSpecVisitor, ResolveNamesVisitor: make most
functions out-of-line to clean up the class declaration.
In AttrsVisitor, use preprocessor to simplify the simple case of
encountering a parse-tree class causing an attribute to be set.
Handle all such attributes.
Remove old testing code from type.cc.
Remove some of the declarations for IntExpr and IntConst -- they are
only placeholder classes anyway. Don't distinguish kind and length
parameter values.
Original-commit: flang-compiler/f18@
e172b5121274a3cfc597f062da1ea32aa56039d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 2 Apr 2018 16:46:19 +0000 (09:46 -0700)]
[flang] Merge pull request flang-compiler/f18#37 from ThePortlandGroup/pmk-minor
Roll up some small changes to resolve TODOs
Original-commit: flang-compiler/f18@
e3d5b7256c787848d58f3696111963912a115f20
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
peter klausler [Sat, 31 Mar 2018 00:03:02 +0000 (17:03 -0700)]
[flang] Elide a useless local variable that used to be a formal argument.
Original-commit: flang-compiler/f18@
419b5d07eeccda8bf2320b2adce0bb5adb55b0fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
peter klausler [Fri, 30 Mar 2018 23:21:12 +0000 (16:21 -0700)]
[flang] Debugging after testing. Take care of a TODO in the prescanner.
Original-commit: flang-compiler/f18@
4c8181e106fd73b145208ce987abb702a72fee87
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
Tree-same-pre-rewrite: false
peter klausler [Fri, 30 Mar 2018 22:23:37 +0000 (15:23 -0700)]
[flang] Debugging, and resolve another TODO in unparse.cc.
Original-commit: flang-compiler/f18@
edeb283cd5bd730e7284e3d894c1e1ffa8d1c313
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
Tree-same-pre-rewrite: false
peter klausler [Fri, 30 Mar 2018 21:10:00 +0000 (14:10 -0700)]
[flang] Look for declared STRUCTURE component names after a . rather than defined operator names.
Original-commit: flang-compiler/f18@
cf6480955148152e644e677b4901e30370c72c9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/37
Tree-same-pre-rewrite: false
Peter Klausler [Fri, 30 Mar 2018 18:33:24 +0000 (11:33 -0700)]
[flang] Merge pull request flang-compiler/f18#35 from ThePortlandGroup/pmk-spaces
Warn about missing spaces in free form
Original-commit: flang-compiler/f18@
2cf8391737e2e4254ce4a48152b468e99c1f0d12
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
peter klausler [Fri, 30 Mar 2018 18:32:37 +0000 (11:32 -0700)]
[flang] Remove some needless checks for mandatory spaces before keywords and names that could not be present anyway, they were slowing things down.
Original-commit: flang-compiler/f18@
a07b78d2d76c994d0594fba6c38d3b98f3d03e9f
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
peter klausler [Fri, 30 Mar 2018 18:11:48 +0000 (11:11 -0700)]
[flang] Use "..."_sptok rather than ~ in tokens to denote mandatory spaces.
Original-commit: flang-compiler/f18@
1b22874a9da595c0496618263e585ced5b6be312
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
peter klausler [Fri, 30 Mar 2018 00:07:19 +0000 (17:07 -0700)]
[flang] "free from" -> "free form" in comment.
Original-commit: flang-compiler/f18@
39231666734e1e7135f2e0f4227979cb1cb28b4f
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
peter klausler [Thu, 29 Mar 2018 23:53:10 +0000 (16:53 -0700)]
[flang] Update documentation.
Original-commit: flang-compiler/f18@
7045fbcd0c3412d990c9c7d2af963765dbb2395f
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
peter klausler [Thu, 29 Mar 2018 23:49:25 +0000 (16:49 -0700)]
[flang] Make functions inline to recoup performance.
Original-commit: flang-compiler/f18@
7f8705304d871d7568eea9ee047eaf418d7349c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
peter klausler [Thu, 29 Mar 2018 23:34:03 +0000 (16:34 -0700)]
[flang] Debugging.
Original-commit: flang-compiler/f18@
84e0cc75498b61905e699dab6ae8762dd938cf4d
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
peter klausler [Thu, 29 Mar 2018 23:06:31 +0000 (16:06 -0700)]
[flang] Emit warnings in free form when a required space is missing.
Original-commit: flang-compiler/f18@
e41917d144354271c5f58cbd6033ef704d0e08c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/35
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 29 Mar 2018 19:18:54 +0000 (12:18 -0700)]
[flang] Merge pull request flang-compiler/f18#34 from ThePortlandGroup/pmk-cdir
Support compiler directives in the prescanner and parser.
Original-commit: flang-compiler/f18@
bc625a6cdd4399af7965c112ede00b7461375e71
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
peter klausler [Thu, 29 Mar 2018 19:16:10 +0000 (12:16 -0700)]
[flang] Begin work on missing space warnings in free form. Reformat C++.
Original-commit: flang-compiler/f18@
1bcbf0eb7bb216e14076cc1b83f1f7a2c3f75340
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
peter klausler [Thu, 29 Mar 2018 18:19:37 +0000 (11:19 -0700)]
[flang] Add MinSizeRel to .gitignore.
Original-commit: flang-compiler/f18@
068e2e4465a22ecfcc32f84a3077d52eca23e531
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
Tree-same-pre-rewrite: false
peter klausler [Thu, 29 Mar 2018 00:15:00 +0000 (17:15 -0700)]
[flang] Simplify test-type and test-sema to use parser::Parsing wrapper class.
Original-commit: flang-compiler/f18@
3741a652eda98669481923ddf250cf2fd6a9bac6
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
Tree-same-pre-rewrite: false
peter klausler [Wed, 28 Mar 2018 22:11:12 +0000 (15:11 -0700)]
[flang] Resolve merge with code pushed to master.
Original-commit: flang-compiler/f18@
d75d86f28e9d1651fa6051e3700afeb48ba9c5d3
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
Tree-same-pre-rewrite: false
peter klausler [Fri, 23 Mar 2018 22:14:52 +0000 (15:14 -0700)]
[flang] Clean out obsolete parsing code. Handle !cdir$ fixed and free in parser.
Work on scanning compiler directive lines.
Fix glitch in earlier change to parse-state.h.
Add ClassifyLine(), simplify some token sequence data lifetimes and interfaces.
Handle continued directives. Obey !DIR$ FIXED and FREE in prescanner.
Some refactoring of TokenSequence API, then support initial directives (FIXED, FREE, IGNORE_TKR).
Fix !DIR$ IGNORE_TKR syntax, manual was wrong.
Debugging directive scanning & parsing.
Profiling-directed speed-up - do not map cooked source locations to Provenance until a Message is emitted. Turn some non-nullable pointers into references.
Debugging.
Handle !DIR$ IVDEP too, it is in a test.
Accept directives in the execution part.
Original-commit: flang-compiler/f18@
fb2ff367ec0609b7307771f927f22fd7bab5e180
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
Tree-same-pre-rewrite: false
Stephane Chauveau [Mon, 26 Mar 2018 14:35:34 +0000 (16:35 +0200)]
[flang] Merge pull request flang-compiler/f18#24 from ThePortlandGroup/sch_sema
Add initial semantic analysis on statements
Original-commit: flang-compiler/f18@
68bb9f670ddbaf71ca735d4d7241ef4f67720e22
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Stephane Chauveau [Mon, 26 Mar 2018 14:04:37 +0000 (16:04 +0200)]
[flang] Merge branch 'sch_sema' of https://github.com/ThePortlandGroup/f18 into sch_sema
Conflicts:
lib/parser/parse-tree.h
lib/semantics/CMakeLists.txt
tools/f18/CMakeLists.txt
tools/f18/test-sema.cc
Original-commit: flang-compiler/f18@
2282b5759ba6fa9d8f8003d499fa114b869723b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Stephane Chauveau [Mon, 26 Mar 2018 13:50:54 +0000 (15:50 +0200)]
[flang] Remove files in include/flang/Sema/
Original-commit: flang-compiler/f18@
779131941447f0c69f635900b1d2640bc0b8e67a
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Mon, 26 Mar 2018 13:49:04 +0000 (15:49 +0200)]
[flang] Merge with current master and move code to lib/semantics/
Original-commit: flang-compiler/f18@
8b31a01102072a855e1c53d642d8c51128e84477
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Mon, 26 Mar 2018 08:16:26 +0000 (10:16 +0200)]
[flang] commit before rebase master
Original-commit: flang-compiler/f18@
77f6a25f8ab6245b9f180341871e5729799c422a
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Mon, 26 Mar 2018 08:04:40 +0000 (01:04 -0700)]
[flang] Commit changes made while at Portland. Some of them will disapear
Original-commit: flang-compiler/f18@
0972ffe1852257203a0c2aa32e8f1603dd1411f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Mon, 12 Mar 2018 18:36:43 +0000 (11:36 -0700)]
[flang] Provide an emacs style for editing Flang C++ sources
Original-commit: flang-compiler/f18@
e9922dda1d1d17d8d4c98318703f2de4efc9e766
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Fri, 9 Mar 2018 16:02:20 +0000 (17:02 +0100)]
[flang] remove long comment
Original-commit: flang-compiler/f18@
c20912629b72655f7fcc7dfdfc0484ae10f4bf1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Fri, 9 Mar 2018 15:48:12 +0000 (16:48 +0100)]
[flang] several changes following pull comments
Original-commit: flang-compiler/f18@
ba1275a7cb5d13a022302294603df9164a55b667
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Thu, 8 Mar 2018 20:54:17 +0000 (21:54 +0100)]
[flang] Implement dump of parse-tree
Original-commit: flang-compiler/f18@
ca6dbfc4776663f362894421c15e504e534ef097
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Thu, 8 Mar 2018 10:23:19 +0000 (11:23 +0100)]
[flang] remove unused member
Original-commit: flang-compiler/f18@
1d39fd8c5ffb49aba9abbe586ad1e0f5f09d342f
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Thu, 8 Mar 2018 10:21:04 +0000 (11:21 +0100)]
[flang] Mostly code cleanup
Original-commit: flang-compiler/f18@
f78fef7a17b4106540ac56f97bd9e00f35073602
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Wed, 7 Mar 2018 13:21:01 +0000 (14:21 +0100)]
[flang] Fix misc issues with closing of LabelDo
Original-commit: flang-compiler/f18@
8134331da8a21b40f6c61bc371f3af66bf3662c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Tue, 6 Mar 2018 16:47:22 +0000 (17:47 +0100)]
[flang] add resolution of CYCLE target construct
Original-commit: flang-compiler/f18@
669ab24267cfa11bcfc85cf8227c1dd4328c2fc0
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Tue, 6 Mar 2018 16:29:22 +0000 (17:29 +0100)]
[flang] Target construct of EXIT statements are now identified
Original-commit: flang-compiler/f18@
2000ae49044e4fd0ee1b14862745fcd55f3f6cbb
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Tue, 6 Mar 2018 15:14:26 +0000 (16:14 +0100)]
[flang] fix incorrect handling of select rank and select type
Original-commit: flang-compiler/f18@
9970fb02b4b474d22db8921c67a18bfb39d64d4a
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Tue, 6 Mar 2018 14:46:22 +0000 (15:46 +0100)]
[flang] LabelDo are now properly handled (for cases supported by parser)
Also, construct names are now matched
Original-commit: flang-compiler/f18@
0e090160595a810fc631ce53ac6c49c648904a8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Fri, 2 Mar 2018 15:16:36 +0000 (16:16 +0100)]
[flang] Very early semantic analysis.
Original-commit: flang-compiler/f18@
862eca9c5b4ae9fa5000cdade3e55cec3f9d580d
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Thu, 1 Mar 2018 11:32:36 +0000 (12:32 +0100)]
[flang] add fummy cc file for experiment
Original-commit: flang-compiler/f18@
3972ad954b115adce0306adfd302031d046d0554
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Stephane Chauveau [Wed, 28 Feb 2018 11:47:31 +0000 (12:47 +0100)]
[flang] commit before rebase
Original-commit: flang-compiler/f18@
8366a87e476f664bd0d715506dbbe5b4e05d0c7b
Reviewed-on: https://github.com/flang-compiler/f18/pull/24
Tree-same-pre-rewrite: false
Tim Keith [Fri, 23 Mar 2018 22:33:50 +0000 (15:33 -0700)]
[flang] Merge pull request flang-compiler/f18#31 from ThePortlandGroup/tsk7
Add ENUM_CLASS to define enum class with ToString function.
Original-commit: flang-compiler/f18@
bd1fc89b73a3081c3d5a9e7d6ae1593ae97e4973
Reviewed-on: https://github.com/flang-compiler/f18/pull/31
Tim Keith [Fri, 23 Mar 2018 21:31:14 +0000 (14:31 -0700)]
[flang] Add ENUM_CLASS to define enum class with ToString function.
This replaces DEFINE_NESTED_ENUM_CLASS in parse-tree.h but works
similarly. "ENUM_CLASS(Foo, A, B, C)" defined enum class Foo with
enumerators A, B, C. It also defines an overloading of EnumToString
that converts enumerators to their string representation.
Change unparse.cc to adapt to this change.
Make use of ENUM_CLASS in attr.h and attr.cc.
Original-commit: flang-compiler/f18@
c45b8f172a2559e22d1aaf12257b4e2558df8c6f
Reviewed-on: https://github.com/flang-compiler/f18/pull/31
Peter Klausler [Fri, 23 Mar 2018 21:19:27 +0000 (14:19 -0700)]
[flang] Merge pull request flang-compiler/f18#29 from ThePortlandGroup/pmk-prov
Source provenance ranges for statements and names, plus clean-up.
Original-commit: flang-compiler/f18@
13d976bb0f0e7161a376cd9e867f4555d3900276
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
peter klausler [Fri, 23 Mar 2018 21:18:59 +0000 (14:18 -0700)]
[flang] Disable code in development before merging into
Original-commit: flang-compiler/f18@
f9484682d10c9c05fe291bf693d32165d23083d3
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
peter klausler [Fri, 23 Mar 2018 21:02:11 +0000 (14:02 -0700)]
[flang] Rebase and merge with current master branch.
Original-commit: flang-compiler/f18@
71544b84627160daf38f80a2e6d4eb6e096cf3f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Mar 2018 17:59:07 +0000 (10:59 -0700)]
[flang] Handle empty files gracefully.
Create interval.h. Use std::size_t instead of bare size_t. Redefine parser::Name to not be just a bare string.
Break out and rename CharBlock from token-sequence.h for use in the parse tree.
Incremental replacement of name strings with pointers to cooked characters.
Fix case sensitivity problem.
Use new CharBlock encoding to replace strings for real literal constants.
Normalized cooked character stream to lower case.
Simplify parsing now that cooked stream is lower case. Replace Keyword in parse tree.
Add static_asserts to || and recovery parsers to enforce same result types.
Remove needless TODO comment inserted earlier.
Fix case conversion on prefixed character literals (f90_correct/dc04.f90).
Use CharBlock in user-state.h.
Complete transition from nextChar to nextCh (i.e., always use pointers).
Document extensions. Begin work on compiler directive lines.
More documentation work.
Reformat prescan.cc.
More work on compiler directive scanning.
Original-commit: flang-compiler/f18@
38d0404e16ee7c797c69bc38fa64bcb55413884a
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
Tree-same-pre-rewrite: false
Tim Keith [Fri, 23 Mar 2018 19:27:57 +0000 (12:27 -0700)]
[flang] Merge pull request flang-compiler/f18#30 from ThePortlandGroup/tsk6
Partial implementation of Symbols and Scopes.
Original-commit: flang-compiler/f18@
cd8bb82ecd4e0ced72258cdfd07a9d5d592060bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/30
Tim Keith [Fri, 23 Mar 2018 19:24:29 +0000 (12:24 -0700)]
[flang] Address review comments.
Use "namespace Fortran::semantics".
Add helper MakeSymbol() functions to ResolveNameVisitor to make a symbol
in the current scope.
Start work on subroutines, similar to what's been done for functions.
Original-commit: flang-compiler/f18@
afe84af1c7a16f7d5de8897d0c3453f580ac7e07
Reviewed-on: https://github.com/flang-compiler/f18/pull/30
Tim Keith [Fri, 23 Mar 2018 00:08:20 +0000 (17:08 -0700)]
[flang] Partial implementation of Symbols and Scopes.
A Symbol consists of a common part (in class Symbol) containing name,
owner, attributes. Information for a specific kind of symbol is in a
variant containing one of the *Details classes. So the kind of symbol is
determined by the type of details class stored in the details_ variant.
For scopes there is a single Scope class with an enum indicating the
kind. So far there isn't a need for extra kind-specific details as with
Symbols but that could change. Symbols defined in a Scope are stored
there in a simple map.
resolve-names.cc is a partial implementation of a parse-tree walker that
resolves names to Symbols. Currently is only handles functions (which
introduce a new Scope) and entity-decls. The test-type executable was
reused as a driver for this to avoid the need for a new one.
Sample output is below. When each "end function" is encountered the
scope is dumped, which shows the symbols defined in it.
$ cat a.f90
pure integer(8) function foo(arg1, arg2) result(res)
integer :: arg1
real :: arg2
contains
function bar(arg1)
real :: bar
real :: arg1
end function
end function
$ Debug/tools/f18/test-type a.f90
Subprogram scope: 0 children
arg1: Entity type: REAL
bar: Entity type: REAL
Subprogram scope: 1 children
arg1: Entity type: INTEGER
arg2: Entity type: REAL
bar: Subprogram (arg1)
foo: Subprogram (arg1, arg2) result(res)
res: Entity type: INTEGER(8)
Original-commit: flang-compiler/f18@
1cd2fbc04da1d6bb2ef5bc1cf07c808460ea7547
Reviewed-on: https://github.com/flang-compiler/f18/pull/30
Tree-same-pre-rewrite: false
Steve Scalpone [Thu, 22 Mar 2018 18:55:04 +0000 (11:55 -0700)]
[flang] Merge pull request flang-compiler/f18#28 from ThePortlandGroup/sjs-doc
Overview of scope creation and symbol resolution
Original-commit: flang-compiler/f18@
fc901a48f403f5bebd74b5386dc3eb23edcf8560
Reviewed-on: https://github.com/flang-compiler/f18/pull/28
Steve Scalpone [Thu, 22 Mar 2018 18:53:59 +0000 (11:53 -0700)]
[flang] Add 'todo' for the predefined scope
Incorporate review feedback; shorten long lines.
Original-commit: flang-compiler/f18@
699fb076d7605f4b302d6e2296f4849b1a907e07
Reviewed-on: https://github.com/flang-compiler/f18/pull/28
Steve Scalpone [Thu, 22 Mar 2018 05:45:43 +0000 (22:45 -0700)]
[flang] Formatting changes
Original-commit: flang-compiler/f18@
ac704fb586242b1806b61a2a371ea213633a0f28
Reviewed-on: https://github.com/flang-compiler/f18/pull/28
Tree-same-pre-rewrite: false
Steve Scalpone [Thu, 22 Mar 2018 05:42:05 +0000 (22:42 -0700)]
[flang] Update formatting
Extract questions and rationals from the step-wise descriptions.
Original-commit: flang-compiler/f18@
38f49e08948516df26a733d74df2d95872cda73f
Reviewed-on: https://github.com/flang-compiler/f18/pull/28
Tree-same-pre-rewrite: false
Steve Scalpone [Tue, 20 Mar 2018 22:47:52 +0000 (15:47 -0700)]
[flang] Add semantics documentation
Overview of scoping, symbols, and basic semantics.
Original-commit: flang-compiler/f18@
b28880a361c1a0df84fedccb56e2d6bf4dd17f4f
Reviewed-on: https://github.com/flang-compiler/f18/pull/28
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 20 Mar 2018 17:17:05 +0000 (10:17 -0700)]
[flang] Merge pull request flang-compiler/f18#26 from ThePortlandGroup/pmk-f90
More fixes for bugs found by running f90_correct tests.
Original-commit: flang-compiler/f18@
5e27ec4ab9b8ebc34c9969d3baa5beec4e4557af
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
peter klausler [Mon, 19 Mar 2018 23:17:23 +0000 (16:17 -0700)]
[flang] Make unreadable code less so, per review comments.
Original-commit: flang-compiler/f18@
78073c15a5fa74c0a45b9bbb127ff9bdc1158ecd
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
peter klausler [Mon, 19 Mar 2018 18:48:49 +0000 (11:48 -0700)]
[flang] Improve preprocessor error message provenances, pass f90_correct test pre21.
Original-commit: flang-compiler/f18@
af5943e3bce4961594bd06c575a24ea51f0881a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Fri, 16 Mar 2018 23:58:35 +0000 (16:58 -0700)]
[flang] Pass as much of f90_correct as I think we can.
Original-commit: flang-compiler/f18@
6d101d3ec8dae923c8445a36f87e81a9ee2deb68
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Fri, 16 Mar 2018 23:13:49 +0000 (16:13 -0700)]
[flang] More f90_correct work.
Original-commit: flang-compiler/f18@
92b68f705f82783c543dd3c952ab09bafd4765a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Fri, 16 Mar 2018 00:09:27 +0000 (17:09 -0700)]
[flang] More f90_correct work.
Original-commit: flang-compiler/f18@
442771db3c24ed3b5482a0bfb016ea2ac0bb9556
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Mar 2018 23:28:37 +0000 (16:28 -0700)]
[flang] Make previous commit more precise.
Original-commit: flang-compiler/f18@
543da95754caf3719250b32da1d824e325e96bb1
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Mar 2018 23:22:38 +0000 (16:22 -0700)]
[flang] Never emit :: when /-bracketed initializers appear on a type declaration stmt.
Original-commit: flang-compiler/f18@
2ed327a4f8c881a78f0a75e437cc6010046a03c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Mar 2018 23:03:28 +0000 (16:03 -0700)]
[flang] Unparsing fixes, PGF90 bug work-arounds.
Original-commit: flang-compiler/f18@
c9c98c0e5cedc3e1c6f01b86d1d87c22c960dded
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Mar 2018 20:25:37 +0000 (13:25 -0700)]
[flang] Remove excess newlines from cooked source, no longer needed.
Original-commit: flang-compiler/f18@
9330b0d7fd4dbab3265a4009b2697b28302605f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/26
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 20 Mar 2018 17:07:39 +0000 (10:07 -0700)]
[flang] Merge pull request flang-compiler/f18#27 from ThePortlandGroup/pmk-doc
New documentation
Original-commit: flang-compiler/f18@
e3886bac53f7907e1cc1607021733e919e0025f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
peter klausler [Tue, 20 Mar 2018 16:58:45 +0000 (09:58 -0700)]
[flang] Extend documentation.
Original-commit: flang-compiler/f18@
f0901673560d6c0484c225cfd6269f5174fab93f
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
peter klausler [Tue, 20 Mar 2018 00:10:53 +0000 (17:10 -0700)]
[flang] Write documentation/preprocessing.md
Original-commit: flang-compiler/f18@
4c8f4a97ad4365f52e2af2bc9e11b41cdb1e5a5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
Tree-same-pre-rewrite: false
peter klausler [Mon, 19 Mar 2018 22:30:32 +0000 (15:30 -0700)]
[flang] More typing into documentation/parsing.md
Original-commit: flang-compiler/f18@
73f68d0ea141041882822e0627060460b7d8aa7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
Tree-same-pre-rewrite: false
peter klausler [Mon, 19 Mar 2018 22:17:32 +0000 (15:17 -0700)]
[flang] Initial cut at documentation/parsing.md
Original-commit: flang-compiler/f18@
5484515b09eef042f2b50ca2a054182cf2545c57
Reviewed-on: https://github.com/flang-compiler/f18/pull/27
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 15 Mar 2018 19:25:20 +0000 (12:25 -0700)]
[flang] Merge pull request flang-compiler/f18#25 from ThePortlandGroup/pmk-walk-unparse
Take flang-compiler/f18#2 on unparsing, now using the new parse tree walker.
Original-commit: flang-compiler/f18@
1f6c2c390e28beaf8f3954a92182de05b934d175
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
peter klausler [Thu, 15 Mar 2018 19:22:41 +0000 (12:22 -0700)]
[flang] Do not forget to run the linker even if there was nothing to compile.
Original-commit: flang-compiler/f18@
4f4f853e5b6a75f0f0f0340266c9a0b8fdc1190a
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
peter klausler [Thu, 15 Mar 2018 17:59:46 +0000 (10:59 -0700)]
[flang] Get clean parse-unparse-reparse-unparse on f90_correct too.
Original-commit: flang-compiler/f18@
901a9e462c13e801e589cacdc049d319ceb2dcca
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Mar 2018 00:07:15 +0000 (17:07 -0700)]
[flang] Fix regression from last commit on STAT=/ERRMSG=.
Original-commit: flang-compiler/f18@
f031d07c300c09d33ec383ff3fc257d08c7492d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Mar 2018 00:02:21 +0000 (17:02 -0700)]
[flang] More f90 unparsing.
Original-commit: flang-compiler/f18@
b9991c1a04725466479783f8c6a1e2cf606342f6
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Mar 2018 23:31:41 +0000 (16:31 -0700)]
[flang] More unparsing.
Original-commit: flang-compiler/f18@
a3ef9de51854d3e0551f2fa2c18d221b7a049370
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Mar 2018 22:31:16 +0000 (15:31 -0700)]
[flang] Incorporate more code review comments, fix more f90.
Original-commit: flang-compiler/f18@
2428121ab4d57ed12671ef78e18b5880c187dff6
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Mar 2018 00:20:40 +0000 (17:20 -0700)]
[flang] Address review comments. Add note to style guide condemning if((x=y)).
Original-commit: flang-compiler/f18@
4ca8b8e51402d94bb921c1993d15e2c1305baa46
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Mar 2018 00:11:26 +0000 (17:11 -0700)]
[flang] Fix some F90 unparsings; address review comments.
Original-commit: flang-compiler/f18@
af33f37600e6c88f9745c9ae0400e99719819652
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Tue, 13 Mar 2018 23:59:30 +0000 (16:59 -0700)]
[flang] Start on f90_correct. Incorporate review comments.
Original-commit: flang-compiler/f18@
3f8cecef8efe49778e25a2ab04269b4c07ac6d07
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Tue, 13 Mar 2018 23:47:48 +0000 (16:47 -0700)]
[flang] Bugfixing and review comments.
Original-commit: flang-compiler/f18@
29cabc71005bb24b8de146c97fa4fe4c4ca3e5f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Mar 2018 00:56:10 +0000 (16:56 -0800)]
[flang] Take flang-compiler/f18#2 on unparsing, now using the new parse tree walker.
Clean out old data structure formatter.
Create stand-alone Parsing class to compose parts of the parser together.
Hello, world!
Better error recovery on command line errors.
Fix bugs from initial run at f77_correct.
Allow parentheses on PROGRAM statement.
Fix Hollerith scanning.
Remove REDIMENSION with good error recovery.
Fix new "spaces" parser, clean up calls to it.
Fix bugs exposed by in38.f90.
Escaped \a is not special to pgf90; get slashes around STRUCTURE name right.
Better multi-byte source encoding support in Hollerith.
Reformat C++.
More work on multi-byte source encoding.
Pass 219 tests in f77_correct, with good excuses for the rest.
Original-commit: flang-compiler/f18@
8a1a0aa2dc5b4ba3fba2116d278affb51857ffb7
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
Tim Keith [Fri, 2 Mar 2018 02:09:18 +0000 (18:09 -0800)]
[flang] Merge pull request flang-compiler/f18#23 from ThePortlandGroup/tsk4
Add MakeTypes to build types using visitor.
Original-commit: flang-compiler/f18@
30a4b46d4b9eded542a8beac0e66a88539986d99
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
Tim Keith [Fri, 2 Mar 2018 02:04:05 +0000 (18:04 -0800)]
[flang] Replace raw pointers with std::unique_ptr.
This simplifies the "delete and set to null" pattern to just a call to
reset(), and "assign and set to null" to a call to std::move.
The ideal would be a custom deleter that throws an error when an
implicit delete happens but not when reset() is called, but I'm not sure
that's possible.
Original-commit: flang-compiler/f18@
f618fc729a5b92b036437ec9828788823ce88f13
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
Tim Keith [Thu, 1 Mar 2018 23:24:35 +0000 (15:24 -0800)]
[flang] Add MakeTypes to build types using visitor.
This replaces the manual walking code in test-type.cc. It walks the
parse tree and constructs DeclTypeSpec and DerivedTypeDef objects for
each type encountered. It's in a new file, make-types.cc, so that
failing compilations complete faster.
Handle more parts of derived type definitions.
Also some minor cleanups in type.h and type.cc.
Original-commit: flang-compiler/f18@
859e7e2665e0d66c583ffcb7c74265813c25967c
Reviewed-on: https://github.com/flang-compiler/f18/pull/23
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 1 Mar 2018 22:47:28 +0000 (14:47 -0800)]
[flang] Merge pull request flang-compiler/f18#22 from ThePortlandGroup/pmk-fix2
Ensure that the parse tree visitation Walk template works on FORMAT.
Original-commit: flang-compiler/f18@
e693dd320d496db24e8241d6a0f6627036304769
Reviewed-on: https://github.com/flang-compiler/f18/pull/22
peter klausler [Thu, 1 Mar 2018 21:23:31 +0000 (13:23 -0800)]
[flang] Ensure that the parse tree visitation Walk template works on FORMAT.
The classes that were segregated into format-specification.h have
also been grouped into a new Fortran::format namespace.
Code added to tools/f18/f18.cc to run a minimal visitor over
the parse trees resulting from successful parses so that any
future build problems with Walk() will be caught earlier.
Rearrange Walk instances, keep format:: ones together.
Original-commit: flang-compiler/f18@
685ddb91ceb2217877a887eca14a63a4b725ea12
Reviewed-on: https://github.com/flang-compiler/f18/pull/22