aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorPeixin Qiao <qiaopeixin@huawei.com>2022-07-27 23:45:41 +0800
committerPeixin Qiao <qiaopeixin@huawei.com>2022-07-27 23:45:41 +0800
commit8df63a23d2fa6c9e30bae199f5073ef5df777b04 (patch)
tree46b1b4ae419aff9d6e591570a33690b5047e17b9 /flang/lib/Frontend/CompilerInvocation.cpp
parent02761e3faebd01416607d0985e0df5ad576b33d4 (diff)
downloadllvm-8df63a23d2fa6c9e30bae199f5073ef5df777b04.zip
llvm-8df63a23d2fa6c9e30bae199f5073ef5df777b04.tar.gz
llvm-8df63a23d2fa6c9e30bae199f5073ef5df777b04.tar.bz2
[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
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index af6deb2..f794eb7 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -769,6 +769,9 @@ void CompilerInvocation::setFortranOpts() {
if (frontendOptions.instrumentedParse)
fortranOptions.instrumentedParse = true;
+ if (frontendOptions.showColors)
+ fortranOptions.showColors = true;
+
if (frontendOptions.needProvenanceRangeToCharBlockMappings)
fortranOptions.needProvenanceRangeToCharBlockMappings = true;