[PATCH] D87774: [flang] Introduce DiagnosticConsumer classes in libflangFrontend
Andrzej Warzynski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 16 09:12:50 PDT 2020
awarzynski created this revision.
Herald added subscribers: cfe-commits, dang, mgorny.
Herald added a reviewer: DavidTruby.
Herald added a reviewer: sscalpone.
Herald added a project: clang.
awarzynski requested review of this revision.
Currently Flang uses TextDiagnostic, TextDiagnosticPrinter &
TestDiagnosticBuffer from Clang (more specifically, from
libclangFrontend). This patch introduces simplified versions of these
classes in Flang (i.e. it removes the depdendency on libclangFrontend).
Note that currently, Flang needs these diagnostics classes only for the
compiler driver diagnostics. This is unlike in Clang in which similar
diagnostic classes are used for (among others) Lexing/Parsing/Sema
diagnostics. For this reason the implementations introduced here are
rather basic.
This patch also enhances how the diagnostics are printed. In particular,
this is what you'd get _before_ (no text formatting):
$ bin/flang-new
error: no input files
This is what you get _after_ (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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87774
Files:
clang/include/clang/Driver/Options.td
clang/tools/driver/driver.cpp
flang/include/flang/Frontend/CompilerInvocation.h
flang/include/flang/Frontend/TextDiagnostic.h
flang/include/flang/Frontend/TextDiagnosticBuffer.h
flang/include/flang/Frontend/TextDiagnosticPrinter.h
flang/lib/Frontend/CMakeLists.txt
flang/lib/Frontend/CompilerInstance.cpp
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/TextDiagnostic.cpp
flang/lib/Frontend/TextDiagnosticBuffer.cpp
flang/lib/Frontend/TextDiagnosticPrinter.cpp
flang/test/Flang-Driver/driver-error-cc1.c
flang/test/Flang-Driver/driver-error-cc1.cpp
flang/test/Flang-Driver/driver-help.f90
flang/test/Flang-Driver/driver-version.f90
flang/test/Flang-Driver/missing-input.f90
flang/tools/flang-driver/driver.cpp
flang/tools/flang-driver/fc1_main.cpp
flang/unittests/Frontend/CompilerInstanceTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87774.292248.patch
Type: text/x-patch
Size: 28740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200916/924514ca/attachment-0001.bin>
More information about the cfe-commits
mailing list