[all-commits] [llvm/llvm-project] 8df63a: [flang] Support the color diagnostics on scanning, ...

PeixinQiao via All-commits all-commits at lists.llvm.org
Wed Jul 27 08:46:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8df63a23d2fa6c9e30bae199f5073ef5df777b04
      https://github.com/llvm/llvm-project/commit/8df63a23d2fa6c9e30bae199f5073ef5df777b04
  Author: Peixin Qiao <qiaopeixin at huawei.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M flang/docs/ReleaseNotes.md
    M flang/include/flang/Parser/parsing.h
    M flang/include/flang/Parser/provenance.h
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Parser/message.cpp
    M flang/lib/Parser/parsing.cpp
    M flang/lib/Parser/provenance.cpp
    A flang/test/Driver/color-diagnostics-parse.f90
    A flang/test/Driver/color-diagnostics-scan.f
    A flang/test/Driver/color-diagnostics-sema.f90
    M flang/tools/bbc/bbc.cpp
    M flang/tools/f18-parse-demo/f18-parse-demo.cpp

  Log Message:
  -----------
  [flang] Support the color diagnostics on scanning, parsing, and semantics

The options -f{no-}color-diagnostics have been supported in driver. This
supports the behaviors in scanning, parsing, and semantics, and the
behaviors are exactly the same as the driver.

To illustrate the added behaviour, consider the following input file:
```! file.f90
program m
  integer :: i = k
end
```
In the following invocations, "error: Must be a constant value" _will be_
formatted:
```
$ flang-new file.f90
error: Semantic errors in file.f90
./file.f90:2:18: error: Must be a constant value
    integer :: i = k
```
Note that "error: Semantic errors in file.f90" is also formatted, which
is supported in https://reviews.llvm.org/D126164.

Also note that only "error", "warning" and "portability" are formatted.
Check the following input file:
```! file2.f90
program m
  integer :: i =
end
```
```
$ flang-new test2.f90
error: Could not parse test2.f90
./test2.f90:2:11: error: expected '('
    integer :: i =
            ^
./test2.f90:2:3: in the context: statement function definition
    integer :: i =
    ^
...
```
The "error: Could not parse test2.f90" and "error: expected '('" are
formatted. Others such as "in the context" are not formatted yet, which
may or may not be supported.

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D126166




More information about the All-commits mailing list