Skip to content

[Clang-CL][DXC] Expose -fdiagnostic-color= to clang-cl and clang-dxc #120644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ New Compiler Flags
- The ``-Warray-compare-cxx26`` warning has been added to warn about array comparison
starting from C++26, this warning is enabled as an error by default.

- clang-cl and clang-dxc now support ``-fdiagnostics-color=[auto|never|always]``
in addition to ``-f[no-]color-diagnostics``.

Deprecated Compiler Flags
-------------------------

Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group<f_Group>,
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
Alias<fno_color_diagnostics>;
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>,
Visibility<[ClangOption, FlangOption]>,
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
Values<"auto,always,never">,
HelpText<"When to use colors in diagnostics">;
def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,
Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/cl-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@
// RUN: -fcoverage-mapping \
// RUN: -fno-coverage-mapping \
// RUN: -fdiagnostics-color \
// RUN: -fdiagnostics-color=auto \
// RUN: -fno-diagnostics-color \
// RUN: -fdebug-compilation-dir . \
// RUN: -fdebug-compilation-dir=. \
Expand Down
8 changes: 8 additions & 0 deletions clang/test/Driver/dxc_options.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %clang_dxc \
// RUN: -fcolor-diagnostics \
// RUN: -fno-color-diagnostics \
// RUN: -fdiagnostics-color \
// RUN: -fno-diagnostics-color \
// RUN: -fdiagnostics-color=auto \
// RUN: -Tlib_6_7 -Vd -fdriver-only -- %s 2>&1 |count 0

4 changes: 0 additions & 4 deletions clang/test/Driver/unknown-arg-drivermodes.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %clang_cl \
// RUN: --config \
// RUN: -fdiagnostics-color=auto \
// RUN: -fno-record-command-line \
// RUN: -frecord-command-line \
// RUN: -nodefaultlibs \
Expand All @@ -15,7 +14,6 @@

// RUN: not %clang_dxc \
// RUN: --config \
// RUN: -fdiagnostics-color=auto \
// RUN: -fno-record-command-line \
// RUN: -frecord-command-line \
// RUN: -nodefaultlibs \
Expand All @@ -30,7 +28,6 @@
// RUN: | FileCheck %s --check-prefix=DXC --implicit-check-not="error:"

// CL: warning: unknown argument ignored in clang-cl: '--config'
// CL: warning: unknown argument ignored in clang-cl: '-fdiagnostics-color=auto'
// CL: warning: unknown argument ignored in clang-cl: '-fno-record-command-line'
// CL: warning: unknown argument ignored in clang-cl: '-frecord-command-line'
// CL: warning: unknown argument ignored in clang-cl: '-nodefaultlibs'
Expand All @@ -42,7 +39,6 @@
// CL: warning: unknown argument ignored in clang-cl: '-Xoffload-linker'

// DXC: error: unknown argument: '--config'
// DXC: error: unknown argument: '-fdiagnostics-color=auto'
// DXC: error: unknown argument: '-fno-record-command-line'
// DXC: error: unknown argument: '-frecord-command-line'
// DXC: error: unknown argument: '-nodefaultlibs'
Expand Down
Loading