Commit graph

52 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
peter klausler
b23701f7d0 [flang] Rearrange some facilities into a new lib/common.
Original-commit: flang-compiler/f18@279af1e817
Reviewed-on: https://github.com/flang-compiler/f18/pull/106
2018-06-18 11:05:17 -07:00
peter klausler
a7a8506ce6 [flang] reformat for merge
Original-commit: flang-compiler/f18@ca8f9611f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/84
2018-05-08 13:15:13 -07:00
peter klausler
1e28daf2ab [flang] Keep message.cc buildable by g++ 7.2.
Original-commit: flang-compiler/f18@edd311972f
Reviewed-on: https://github.com/flang-compiler/f18/pull/84
Tree-same-pre-rewrite: false
2018-05-08 13:14:14 -07:00
peter klausler
f76d2073de [flang] Fix bug noticed in code review.
Original-commit: flang-compiler/f18@7fc497064e
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-07 13:11:08 -07:00
peter klausler
a6da97cb6f [flang] Use attachments to messages in resolve-names.cc
Original-commit: flang-compiler/f18@d24674f4ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 15:40:40 -07:00
peter klausler
bb7d39497d [flang] Use attachment for context.
Original-commit: flang-compiler/f18@e92cf73cf9
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 15:03:10 -07:00
peter klausler
04b8f48d86 [flang] Allow attachments to Messages.
Original-commit: flang-compiler/f18@08785977ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 14:39:29 -07:00
peter klausler
8f27198cd3 [flang] More clean-up.
Original-commit: flang-compiler/f18@ed60db3708
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 13:59:56 -07:00
peter klausler
b00fa16ce4 [flang] Some initial clean-up in messages, use std::variant to make component possibilities clearer.
Original-commit: flang-compiler/f18@9b7eeb2354
Reviewed-on: https://github.com/flang-compiler/f18/pull/83
Tree-same-pre-rewrite: false
2018-05-04 13:00:35 -07:00
peter klausler
ca8d718f64 [flang] Do not sort messages by location for now.
Original-commit: flang-compiler/f18@8a92dad973
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:41:33 -07:00
peter klausler
35aef1025e [flang] Improve error message location.
Original-commit: flang-compiler/f18@5efd011d18
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:11 -07:00
peter klausler
1de02ee11c [flang] Add TODO comment.
Original-commit: flang-compiler/f18@1a82940ca8
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:11 -07:00
peter klausler
5e69a7507d [flang] Make messages more like clang's.
Original-commit: flang-compiler/f18@176cdf8e6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:06 -07:00
peter klausler
b867921eb8 [flang] Clean up message output a little; remove unused APIs.
Original-commit: flang-compiler/f18@64298b8d74
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
Tree-same-pre-rewrite: false
2018-05-04 09:35:05 -07:00
Tim Keith
7f66c0ae72 [flang] Normalize namespace definitions.
Replace `namespace Fortran { namespace parser { ... } }` with
`namespace Fortran::parser { ... }` and similarly for semantics.

Original-commit: flang-compiler/f18@838c9539b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/77
Tree-same-pre-rewrite: false
2018-05-02 13:52:36 -07:00
Tim Keith
18cee3e8e6 [flang] Add copyright notices.
For source files (C++, Fortran, CMake) add copyright and license.
For documentation files add just copyright.

Original-commit: flang-compiler/f18@38381aed83
Reviewed-on: https://github.com/flang-compiler/f18/pull/74
2018-05-01 12:50:34 -07:00
peter klausler
d3c1a08e68 [flang] Extend Message representation to cover ranges.
Original-commit: flang-compiler/f18@314819c87f
Reviewed-on: https://github.com/flang-compiler/f18/pull/66
Tree-same-pre-rewrite: false
2018-04-23 15:44:28 -07:00
peter klausler
7335482d98 [flang] Complete parser instrumentation and caching of failures.
Original-commit: flang-compiler/f18@9843dbf211
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
2018-04-19 17:02:12 -07:00
peter klausler
56b09e08eb [flang] Parser instrumentation and fail-fast experiment begun.
Original-commit: flang-compiler/f18@ab46163d6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/62
Tree-same-pre-rewrite: false
2018-04-19 15:46:02 -07:00
peter klausler
086a7f3596 [flang] Address review comments.
Original-commit: flang-compiler/f18@dbeba37322
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
2018-04-19 13:51:25 -07:00
peter klausler
0acda77554 [flang] Finish repackaging SetOfChars
Original-commit: flang-compiler/f18@37085c0cdd
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:08 -07:00
peter klausler
107aa28930 [flang] More repackaging
Original-commit: flang-compiler/f18@55f4f0505e
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:07 -07:00
peter klausler
376d8f96d4 [flang] repackage SetOfChars as a class type
Original-commit: flang-compiler/f18@bae9199f62
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:06 -07:00
peter klausler
075fe789da [flang] Combine expected character sets of messages ending at same point from two alternatives.
Original-commit: flang-compiler/f18@a006ceef1d
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:04 -07:00
peter klausler
f6accb372b [flang] debugging
Original-commit: flang-compiler/f18@02718dd6ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:04 -07:00
peter klausler
1730085e1b [flang] Define sets of characters; use them in parsing and messages.
Original-commit: flang-compiler/f18@d3ca565b59
Reviewed-on: https://github.com/flang-compiler/f18/pull/61
Tree-same-pre-rewrite: false
2018-04-19 11:21:03 -07:00
peter klausler
af22e07f71 [flang] Revamp messaging. Add ""_err_en_US to denote fatal error messages.
Original-commit: flang-compiler/f18@7ddc807a1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/38
Tree-same-pre-rewrite: false
2018-04-02 15:51:04 -07:00
peter klausler
75b29335ab [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@fb2ff367ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/34
Tree-same-pre-rewrite: false
2018-03-28 15:04:36 -07:00
peter klausler
424ec7b35b [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@38d0404e16
Reviewed-on: https://github.com/flang-compiler/f18/pull/29
Tree-same-pre-rewrite: false
2018-03-23 13:32:55 -07:00
peter klausler
79d044e9b5 [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@8a1a0aa2dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/25
Tree-same-pre-rewrite: false
2018-03-13 16:32:09 -07:00
peter klausler
c3a2d82d3e [flang] Support localizable formatted messages.
Original-commit: flang-compiler/f18@e974321494
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
2018-02-21 12:12:52 -08:00
peter klausler
3b544af6da [flang] Use "..."_en_US for messages.
Original-commit: flang-compiler/f18@fffa881576
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-20 09:57:30 -08:00
peter klausler
206db251b7 [flang] Convert all messages to MessageTexts ("..."_msg).
Original-commit: flang-compiler/f18@33357f3657
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-16 16:57:40 -08:00
peter klausler
5e83ea521c [flang] Define MessageText and "..."_msg.
Original-commit: flang-compiler/f18@6e9e16431c
Reviewed-on: https://github.com/flang-compiler/f18/pull/14
Tree-same-pre-rewrite: false
2018-02-16 15:47:30 -08:00
peter klausler
edbec459fb [flang] Complete provenance tracking through macro calls.
Original-commit: flang-compiler/f18@8c05a6543b
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
3bca5d088e [flang] Restructure inter-class references for clarity.
Original-commit: flang-compiler/f18@1836cd5d06
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler
90c3cad9a7 [flang] Debugging new provenance support.
Original-commit: flang-compiler/f18@1233f666da
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00