aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Parser/executable-parsers.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-11-21[flang] Better recovery from errors in a loop control (#117025)Peter Klausler1-4/+11
When there's an error in a DO statement loop control, error recovery isn't great. A bare "DO" is a valid statement, so a failure to parse its loop control doesn't fail on the whole statement. Its partial parse ends after the keyword, and as some other statement parsers can get further into the input before failing, errors in the loop control can lead to confusing error messages about bad pointer assignment statements and others. So just check that a bare "DO" is followed by the end of the statement.
2024-11-12[flang][cuda] Make launch configuration optional for cuf kernel (#115947)Valentin Clement (バレンタイン クレメン)1-3/+7
2024-07-30[flang][parser] Better error recovery for misplaced declaration (#100482)Peter Klausler1-13/+12
When a declaration construct appears in the execution part of a block or subprogram body, report it as such rather than as a misleading syntax error on the executable statement that it somehow matched the most.
2024-05-30[flang] Add parsing of DO CONCURRENT REDUCE clause (#92518)khaki31-0/+4
Derived from #92480. This PR supports parsing of the DO CONCURRENT REDUCE clause in Fortran 2023. Following the style of the OpenMP parser in MLIR, the front end accepts both arbitrary operations and procedures for the REDUCE clause. But later Semantics can notify type errors and resolve procedure names.
2024-05-15[flang] Parse REDUCE clauses in !$CUF KERNEL DO (#92154)Peter Klausler1-7/+16
A !$CUF KERNEL DO directive is allowed to have advisory REDUCE clauses similar to those in OpenACC and DO CONCURRENT. Parse and represent them. Semantic validation will follow.
2024-03-15[flang] Parse !$CUF KERNEL DO <<< (*) (#85338)Peter Klausler1-10/+10
Accept and represent asterisks within the parenthesized grid and block specification lists.
2024-01-02[flang] Add notify-type and notify-wait-stmt (#76594)Katherine Rasmussen1-7/+14
Add `notify-type` to `iso_fortran_env` module. Add `notify-wait-stmt` to the parser and add checks for constraints on the statement, `C1177` and `C1178`, from the Fortran 2023 standard. Add three semantics tests for `notify-wait-stmt`.
2023-10-16[flang] Fix construct names on labeled DO (#67622)Peter Klausler1-3/+7
Fortran requires that a DO construct with a construct name end with an END DO statement bearing the same name. This is true even if the DO construct begins with a label DO statement; e.g., "constrName: do 10 j=1,10" must end with "10 end do constrName". The compiler presently basically ignores construct names that appear on label DO statements, because only non-label DO statements can be parsed as DO constructs. This causes us to miss some errors, and (worse) breaks the usage of the construct name on CYCLE and EXIT statements. To fix this, this patch changes the parse tree and parser so that a DO construct name on a putative label DO statement causes it to be parsed as a "non-label" DO statement... with a label. Only true old-style labeled DO statements without construct names are now parsed as such. I did not change the class name NonLabelDoStmt -- it's widely used across the front-end, and is the name of a production in the standard's grammar. But now it basically means DoConstructDoStmt. Fixes https://github.com/llvm/llvm-project/issues/67283.
2023-06-13[flang][openacc] Relax rule for end directive on combined constructValentin Clement1-2/+1
Make the keyword `loop` optional for the end driective on combined construct. This done to extend compatibility with other compiler that allow this. Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D151856
2023-05-31[flang] CUDA Fortran - part 1/5: parsingPeter Klausler1-23/+50
Begin upstreaming of CUDA Fortran support in LLVM Flang. This first patch implements parsing for CUDA Fortran syntax, including: - a new LanguageFeature enum value for CUDA Fortran - driver change to enable that feature for *.cuf and *.CUF source files - parse tree representation of CUDA Fortran syntax - dumping and unparsing of the parse tree - the actual parsers for CUDA Fortran syntax - prescanning support for !@CUF and !$CUF - basic sanity testing via unparsing and parse tree dumps ... along with any minimized changes elsewhere to make these work, mostly no-op cases in common::visitors instances in semantics and lowering to allow them to compile in the face of new types in variant<> instances in the parse tree. Because CUDA Fortran allows the kernel launch chevron syntax ("call foo<<<blocks, threads>>>()") only on CALL statements and not on function references, the parse tree nodes for CallStmt, FunctionReference, and their shared Call were rearranged a bit; this caused a fair amount of one-line changes in many files. More patches will follow that implement CUDA Fortran in the symbol table and name resolution, and then semantic checking. Differential Revision: https://reviews.llvm.org/D150159
2023-05-18[flang] Better error recovery for missing THEN in IF constructPeter Klausler1-1/+2
Presented with "IF (...)" with no following tokens in the statement, diagnose a missing "THEN" instead of complaining about all of the possible action statement initial tokens that could have been there for a non-construct IF statement. Fixes https://github.com/llvm/llvm-project/issues/62299. Differential Revision: https://reviews.llvm.org/D150783
2022-10-29[flang] Improve error recovery for bad/missing construct END statementsPeter Klausler1-10/+9
When a multi-statement construct should end with a particular END statement like "END SELECT", and that construct's END statement is missing or unrecognizable, the error recovery productions should not misinterpret a program unit END statement that follows and consume it as a misspelled construct END statement. Doing so leads to cascading errors or a failed parse. Differential Revision: https://reviews.llvm.org/D136896
2022-03-18[flang] Add explanatory messages to grammar for language extensionsPeter Klausler1-0/+1
Extend "extension<LanguageFeature>()" to incorporate an explanatory message better than the current generic "nonstandard usage:". Differential Revision: https://reviews.llvm.org/D122035
2021-10-04[flang] Better error recovery for missing THEN in ELSE IFpeter klausler1-1/+1
The THEN keyword in the "ELSE IF (test) THEN" statement is useless syntactically, and to omit it is a common error (at least for me!) that has poor error recovery. This patch changes the parser to cough up a simple "expected 'THEN'" and still recognize the rest of the IF construct. Differential Revision: https://reviews.llvm.org/D110952
2020-08-13[flang][openacc] Handle optional end directive in combined constructValentin Clement1-1/+2
OpenACC combined construct can have an optional end directive. This patch handle this case in the parsing/unparsing with a canonicalization step. Unlike OmpEndLoopDirective, this doesn't need a special treatment in the pre-fir tree as there is no clause attached to a AccEndCombinedDirective. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D84481
2020-07-14[flang][openacc] OpenACC 3.0 parserValentin Clement1-0/+1
Summary: This patch introduce the parser for OpenACC 3.0 in Flang. It uses the same TableGen mechanism than OpenMP. Reviewers: nvdatian, sscalpone, tskeith, klausler, ichoyjx, jdoerfert, DavidTruby Reviewed By: klausler Subscribers: MaskRay, SouraVX, mgorny, hiraditya, jfb, sstefan1, llvm-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D83649
2020-07-13Revert "[flang][openacc] OpenACC 3.0 parser"Valentin Clement1-1/+0
This reverts commit 65049d16100af360674659fb56e8f9bec96a0836. Buildbot failure clang-ppc64le-rhel
2020-07-13[flang][openacc] OpenACC 3.0 parserValentin Clement1-0/+1
Summary: This patch introduce the parser for OpenACC 3.0 in Flang. It uses the same TableGen mechanism than OpenMP. Reviewers: nvdatian, sscalpone, tskeith, klausler, ichoyjx, jdoerfert, DavidTruby Reviewed By: klausler Subscribers: SouraVX, mgorny, hiraditya, jfb, sstefan1, llvm-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D83649
2020-03-28[flang] Reformat with latest clang-format and .clang-formatTim Keith1-3/+3
Original-commit: flang-compiler/f18@9fe84f45d7fd685051004678d6b5775dcc4c6f8f Reviewed-on: https://github.com/flang-compiler/f18/pull/1094
2020-02-25[flang] [LLVMify F18] Compiler module folders should have capitalised names ↵CarolineConcatto1-0/+525
(flang-compiler/f18#980) This patch renames the modules in f18 to use a capital letter in the module name Signed-off-by: Caroline Concatto <caroline.concatto@arm.com> Original-commit: flang-compiler/f18@d2eb7a1c443d1539ef12b6f027074a0eb15b1ea0 Reviewed-on: https://github.com/flang-compiler/f18/pull/980