[all-commits] [llvm/llvm-project] 8d51d3: [flang] Introduce DiagnosticConsumer classes in li...
Andrzej WarzyĆski via All-commits
all-commits at lists.llvm.org
Mon Oct 5 09:51:46 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 8d51d37e0628bde3eb5a3200507ba7135dfc2751
https://github.com/llvm/llvm-project/commit/8d51d37e0628bde3eb5a3200507ba7135dfc2751
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2020-10-05 (Mon, 05 Oct 2020)
Changed paths:
M clang/include/clang/Driver/Options.td
M flang/include/flang/Frontend/CompilerInvocation.h
A flang/include/flang/Frontend/TextDiagnostic.h
A flang/include/flang/Frontend/TextDiagnosticBuffer.h
A flang/include/flang/Frontend/TextDiagnosticPrinter.h
M flang/lib/Frontend/CMakeLists.txt
M flang/lib/Frontend/CompilerInstance.cpp
M flang/lib/Frontend/CompilerInvocation.cpp
A flang/lib/Frontend/TextDiagnostic.cpp
A flang/lib/Frontend/TextDiagnosticBuffer.cpp
A flang/lib/Frontend/TextDiagnosticPrinter.cpp
M flang/test/Flang-Driver/driver-error-cc1.c
M flang/test/Flang-Driver/driver-error-cc1.cpp
M flang/test/Flang-Driver/driver-help.f90
M flang/test/Flang-Driver/driver-version.f90
M flang/test/Flang-Driver/missing-input.f90
M flang/tools/flang-driver/driver.cpp
M flang/tools/flang-driver/fc1_main.cpp
M flang/unittests/Frontend/CompilerInstanceTest.cpp
Log Message:
-----------
[flang] Introduce DiagnosticConsumer classes in libflangFrontend
Currently Flang uses TextDiagnostic, TextDiagnosticPrinter &
TestDiagnosticBuffer classes from Clang (more specifically, from
libclangFrontend). This patch introduces simplified equivalents of these
classes in Flang (i.e. it removes the dependency on libclangFrontend).
Flang only needs these diagnostics classes for the compiler driver
diagnostics. This is unlike in Clang in which similar diagnostic classes
are used for e.g. Lexing/Parsing/Sema diagnostics. For this reason, the
implementations introduced here are relatively basic. We can extend them
in the future if this is required.
This patch also enhances how the diagnostics are printed. In particular,
this is the diagnostic that you'd get _before_ the changes introduced here
(no text formatting):
```
$ bin/flang-new
error: no input files
```
This is the diagnostic that you get _after_ the changes introduced here
(in terminals that support it, the text is formatted - bold + red):
```
$ bin/flang-new
flang-new: error: no input files
```
Tests are updated accordingly and options related to enabling/disabling
color diagnostics are flagged as supported by Flang.
Reviewed By: sameeranjoshi, CarolineConcatto
Differential Revision: https://reviews.llvm.org/D87774
More information about the All-commits
mailing list