Skip to content

Commit 1f52639

Browse files
committed
[Clang-CL][DXC] Expose -fdiagnostic-color= to clang-cl and clang-dxc
1 parent d3508cc commit 1f52639

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group<f_Group>,
19901990
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
19911991
Alias<fno_color_diagnostics>;
19921992
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>,
1993-
Visibility<[ClangOption, FlangOption]>,
1993+
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
19941994
Values<"auto,always,never">,
19951995
HelpText<"When to use colors in diagnostics">;
19961996
def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,

clang/test/Driver/cl-options.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,15 @@
664664
// RUN: not %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
665665
// CFGUARDINVALID: invalid value 'foo' in '/guard:'
666666

667+
// The test doesn't run in a PTY, so "auto" defaults to off.
668+
// RUN: %clang_cl -fdiagnostics-color=auto -### -- %s 2>&1 | FileCheck -check-prefix=NO_COLOR %s
669+
670+
// RUN: %clang_cl -fdiagnostics-color -### -- %s 2>&1 | FileCheck -check-prefix=COLOR %s
671+
// RUN: %clang_cl -fdiagnostics-color=always -### -- %s 2>&1 | FileCheck -check-prefix=COLOR %s
672+
// RUN: %clang_cl -fdiagnostics-color=never -### -- %s 2>&1 | FileCheck -check-prefix=NO_COLOR %s
673+
// COLOR: "-fcolor-diagnostics"
674+
// NO_COLOR-NOT: "-fcolor-diagnostics"
675+
667676
// Accept "core" clang options.
668677
// (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
669678
// RUN: %clang_cl \

clang/test/Driver/dxc_options.hlsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// The test doesn't run in a PTY, so "auto" defaults to off.
2+
// RUN: %clang_dxc -Tlib_6_7 -fdiagnostics-color=auto -### -- %s 2>&1 | FileCheck -check-prefix=NO_COLOR %s
3+
4+
// RUN: %clang_dxc -Tlib_6_7 -fdiagnostics-color -### %s 2>&1 | FileCheck -check-prefix=COLOR %s
5+
// RUN: %clang_dxc -Tlib_6_7 -fdiagnostics-color=always -### %s 2>&1 | FileCheck -check-prefix=COLOR %s
6+
// RUN: %clang_dxc -Tlib_6_7 -fdiagnostics-color=never -### %s 2>&1 | FileCheck -check-prefix=NO_COLOR %s
7+
// COLOR: "-fcolor-diagnostics"
8+
// NO_COLOR-NOT: "-fcolor-diagnostics"

0 commit comments

Comments
 (0)