[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/Maetveis closed https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/tarunprabhu approved this pull request. Thanks for adding the test as well. LGTM. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: ping @MaskRay https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/Maetveis updated https://github.com/llvm/llvm-project/pull/118640 From c2efb475c557dd4ad1018e261a9659b1c4f16b83 Mon Sep 17 00:00:00 2001 From: Gergely Meszaros Date: Wed, 4 Dec 2024 05:44:19 -0800 Subject: [PATCH 1/4] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. --- clang/include/clang/Driver/Options.td | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4bc0b97ea68f2f..aa705f95ca399a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the linker">, MetaVarName<"">, Group; def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the offload linkers or the ones identified by -">, MetaVarName<" ">, Group; def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group, @@ -1175,7 +1175,7 @@ def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; @@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, @@ -2015,10 +2015,10 @@ argument are escaped with backslashes. This format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. This option is currently only supported on ELF targets.}]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def fno_record_command_line : Flag<["-"], "fno-record-command-line">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def : Flag<["-"], "frecord-gcc-switches">, Alias; def : Flag<["-"], "fno-record-gcc-switches">, Alias; def fcommon : Flag<["-"], "fcommon">, Group, @@ -5643,7 +5643,7 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">, - Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>; + Visibility<[ClangOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5665,10 +5665,10 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def stdlib : Flag<["-"], "stdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; @@ -5782,7 +5782,7 @@ def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/bob80905 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
@@ -0,0 +1,53 @@ +// RUN: %clang_cl \ +// RUN: --config \ +// RUN: -fdiagnostics-color=auto \ +// RUN: -fno-record-command-line \ +// RUN: -frecord-command-line \ +// RUN: -nodefaultlibs \ +// RUN: -nostdlib \ +// RUN: -rpath \ +// RUN: -shared\ +// RUN: -static\ +// RUN: -stdlib\ +// RUN: -Xoffload-linker \ +// RUN: -### -x c++ -c - < /dev/null 2>&1 | FileCheck %s --check-prefix=CL MaskRay wrote: need --implicit-check-not=warning: https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
HaohaiWen wrote: @MaskRay, may need to merge https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/fprofile-sample-use.c to clang/test/Driver/unknown-arg-drivermodes.test https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/HaohaiWen approved this pull request. LGTM for -Xlinker. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: @HaohaiWen can you review and approve if it looks good now for clang-cl? I'll try pinging discord and waiting a little bit for HLSL people before merging. Gentle ping @bob80905. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: > Can we keep this flag for CL in this PR and open an issue to discuss whether > it should be disabled for CL? Sure, see latest commit and https://github.com/llvm/llvm-project/issues/119179. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/Maetveis updated https://github.com/llvm/llvm-project/pull/118640 From c2efb475c557dd4ad1018e261a9659b1c4f16b83 Mon Sep 17 00:00:00 2001 From: Gergely Meszaros Date: Wed, 4 Dec 2024 05:44:19 -0800 Subject: [PATCH 1/3] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. --- clang/include/clang/Driver/Options.td | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4bc0b97ea68f2f..aa705f95ca399a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the linker">, MetaVarName<"">, Group; def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the offload linkers or the ones identified by -">, MetaVarName<" ">, Group; def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group, @@ -1175,7 +1175,7 @@ def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; @@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, @@ -2015,10 +2015,10 @@ argument are escaped with backslashes. This format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. This option is currently only supported on ELF targets.}]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def fno_record_command_line : Flag<["-"], "fno-record-command-line">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def : Flag<["-"], "frecord-gcc-switches">, Alias; def : Flag<["-"], "fno-record-gcc-switches">, Alias; def fcommon : Flag<["-"], "fcommon">, Group, @@ -5643,7 +5643,7 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">, - Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>; + Visibility<[ClangOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5665,10 +5665,10 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def stdlib : Flag<["-"], "stdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; @@ -5782,7 +5782,7 @@ def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
HaohaiWen wrote: > > Better to double check with author who specified those CLOption. > > Do you mean the person that added `CLOption` to these flags? That was > @tarunprabhu, but IIUC that was by mistake; his intention was to extend these > flags only to Flang. > > Otherwise `-Xlinker` has been around for very long. I guess I will revert > these flags to be clang and flang only, then open issues for the discussion > of potentially enabling them to clang-cl. Some of our project have already used -Xlinker on Windows. Is there any equivalent flag for CL? Can we keep this flag for CL in this PR and open an issue to discuss whether it should be disabled for CL? https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
tarunprabhu wrote: > > Better to double check with author who specified those CLOption. > > Do you mean the person that added `CLOption` to these flags? That was > @tarunprabhu, but IIUC that was by mistake; his intention was to extend these > flags only to Flang. That is correct, the intention was to extend those flags only to Flang https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Mészáros Gergely (Maetveis) Changes When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. This is marked as draft because I would like to discuss if any of these options should remain, and once that is done add tests to ensure they or are not supported for the relevant driver modes. --- Full diff: https://github.com/llvm/llvm-project/pull/118640.diff 2 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+12-12) - (added) clang/test/Driver/unknown-arg-drivermodes.test (+55) ``diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4bc0b97ea68f2f..aa705f95ca399a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the linker">, MetaVarName<"">, Group; def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the offload linkers or the ones identified by -">, MetaVarName<" ">, Group; def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group, @@ -1175,7 +1175,7 @@ def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; @@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, @@ -2015,10 +2015,10 @@ argument are escaped with backslashes. This format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. This option is currently only supported on ELF targets.}]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def fno_record_command_line : Flag<["-"], "fno-record-command-line">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def : Flag<["-"], "frecord-gcc-switches">, Alias; def : Flag<["-"], "fno-record-gcc-switches">, Alias; def fcommon : Flag<["-"], "fcommon">, Group, @@ -5643,7 +5643,7 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">, - Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>; + Visibility<[ClangOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5665,10 +5665,10 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def stdlib : Flag<["-"], "stdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; @@ -5782,7 +5782,7 @@ def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def rpath : Separate<["-"], "rpath">, Flags<[Li
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mészáros Gergely (Maetveis) Changes When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. This is marked as draft because I would like to discuss if any of these options should remain, and once that is done add tests to ensure they or are not supported for the relevant driver modes. --- Full diff: https://github.com/llvm/llvm-project/pull/118640.diff 2 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+12-12) - (added) clang/test/Driver/unknown-arg-drivermodes.test (+55) ``diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4bc0b97ea68f2f..aa705f95ca399a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the linker">, MetaVarName<"">, Group; def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the offload linkers or the ones identified by -">, MetaVarName<" ">, Group; def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group, @@ -1175,7 +1175,7 @@ def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; @@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, @@ -2015,10 +2015,10 @@ argument are escaped with backslashes. This format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. This option is currently only supported on ELF targets.}]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def fno_record_command_line : Flag<["-"], "fno-record-command-line">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def : Flag<["-"], "frecord-gcc-switches">, Alias; def : Flag<["-"], "fno-record-gcc-switches">, Alias; def fcommon : Flag<["-"], "fcommon">, Group, @@ -5643,7 +5643,7 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">, - Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>; + Visibility<[ClangOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5665,10 +5665,10 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def stdlib : Flag<["-"], "stdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; @@ -5782,7 +5782,7 @@ def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def rpath : Separate<["-"], "rpath">, Flags<[LinkerInp
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/Maetveis ready_for_review https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/Maetveis updated https://github.com/llvm/llvm-project/pull/118640 From c2efb475c557dd4ad1018e261a9659b1c4f16b83 Mon Sep 17 00:00:00 2001 From: Gergely Meszaros Date: Wed, 4 Dec 2024 05:44:19 -0800 Subject: [PATCH 1/2] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. --- clang/include/clang/Driver/Options.td | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4bc0b97ea68f2f..aa705f95ca399a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the linker">, MetaVarName<"">, Group; def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the offload linkers or the ones identified by -">, MetaVarName<" ">, Group; def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group, @@ -1175,7 +1175,7 @@ def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; @@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, @@ -2015,10 +2015,10 @@ argument are escaped with backslashes. This format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. This option is currently only supported on ELF targets.}]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def fno_record_command_line : Flag<["-"], "fno-record-command-line">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def : Flag<["-"], "frecord-gcc-switches">, Alias; def : Flag<["-"], "fno-record-gcc-switches">, Alias; def fcommon : Flag<["-"], "fcommon">, Group, @@ -5643,7 +5643,7 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">, - Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>; + Visibility<[ClangOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5665,10 +5665,10 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def stdlib : Flag<["-"], "stdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; @@ -5782,7 +5782,7 @@ def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: > I checked and I don't think there are any others that have been accidentally > enabled. Thanks. > Are there any tests that check to these options produce warnings? If not, it > might be worth adding them. What do you think? No there aren't any, and yes I agree, I will add them to this PR once we figure out if I should include `-Xlinker` and `-fdiagnostics-color=`. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: > Better to double check with author who specified those CLOption. Do you mean the person that added `CLOption` to these flags? That was @tarunprabhu, but IIUC that was by mistake; his intention was to extend these flags only to Flang. Otherwise `-Xlinker` has been around for very long. I guess I will revert these flags to be clang and flang only, then open issues for the discussion of potentially enabling them to clang-cl. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/HaohaiWen edited https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
HaohaiWen wrote: Better to double check with author who specified those CL flags. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
@@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HaohaiWen wrote: For clang-cl, /link would pass all args after it to linker and that would cause some trouble when using cmake. e.g. cmake may use clang-cl as "linker" and append some args after flags specified by CMAKE_EXE_LINKER_FLAGS. In that case, -Xlinker is better choice. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
tarunprabhu wrote: I checked and I don't think there are any others that have been accidentally enabled. Are there any tests that check to these options produce warnings? If not, it might be worth adding them. What do you think? https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
tarunprabhu wrote: Thanks for this. I think you have caught all everything I changed. But I'll take another look to see if there was anything else. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: @HaohaiWen can you check if this makes sense for clang-cl? @bob80905 same for DXC please. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
Maetveis wrote: @tarunprabhu Continuing [our discussion on #108868](https://github.com/llvm/llvm-project/pull/108868/files/612b93eda5695306293bb8ca6e27a810b06adf3d#r1867949328) here. These are what I found, by searching for commits that added both `FlangOption` and `CLOption` to Options.td and were still reachable in the blame of the file. It is possible that this is not all of them. The default can get quite confusing to track because IIUC the `OptionGroup`'s `Visibility` gets unioned with the visibility defined on the record. https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
@@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Maetveis wrote: I think this is also reasonable given that both `-fdiagnostic-color` and `-fno-diagnostic-color` were already exposed to `clang-cl` (prior to being exposed to flang). https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
@@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Maetveis wrote: I believe this and `-Xoffload-linker` could maybe stay if it works for `clang-cl`. For example CMake has been thinking about using such an option if it were available (though this is already possible with `clang-cl` as `-Xclang -Xlinker`): > MSVC cl doesn't support driving the linker, or at least didn't when all this > was developed. EDIT: at least not with sufficient control of the linker > command line. (https://gitlab.kitware.com/cmake/cmake/-/issues/24243#note_1289518) https://github.com/llvm/llvm-project/pull/118640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake (PR #118640)
https://github.com/Maetveis created https://github.com/llvm/llvm-project/pull/118640 When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. This is marked as draft because I would like to discuss if any of these options should remain, and once that is done add tests to ensure they or are not supported for the relevant driver modes. From c2efb475c557dd4ad1018e261a9659b1c4f16b83 Mon Sep 17 00:00:00 2001 From: Gergely Meszaros Date: Wed, 4 Dec 2024 05:44:19 -0800 Subject: [PATCH] [clang-cl][flang][dxc] Fix opts exposed to clang-cl/dxc by mistake When these options were enabled for flang the visibility was also extended to clang-cl and dxc. I believe this was due to a misunderstanding of the default value for `Visibility`. --- clang/include/clang/Driver/Options.td | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4bc0b97ea68f2f..aa705f95ca399a 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1055,11 +1055,11 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>, def offload_link : Flag<["--"], "offload-link">, Group, HelpText<"Use the new offloading linker to perform the link job.">; def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the linker">, MetaVarName<"">, Group; def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, HelpText<"Pass to the offload linkers or the ones identified by -">, MetaVarName<" ">, Group; def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group, @@ -1175,7 +1175,7 @@ def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; @@ -1989,7 +1989,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, @@ -2015,10 +2015,10 @@ argument are escaped with backslashes. This format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. This option is currently only supported on ELF targets.}]>, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def fno_record_command_line : Flag<["-"], "fno-record-command-line">, Group, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>; + Visibility<[ClangOption, FlangOption]>; def : Flag<["-"], "frecord-gcc-switches">, Alias; def : Flag<["-"], "fno-record-gcc-switches">, Alias; def fcommon : Flag<["-"], "fcommon">, Group, @@ -5643,7 +5643,7 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO HelpText<"Link the LLVM C Library for GPUs">; def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">, - Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>; + Visibility<[ClangOption, FlangOption]>; def nodriverkitlib : Flag<["-"], "nodriverkitlib">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -5665,10 +5665,10 @@ def nostdincxx : Flag<["-"], "nostdinc++">, Visibility<[ClangOption, CC1Option]> HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def stdlib : Flag<["-"], "stdlib">, - Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>, + Visibility<[ClangOption, FlangOption]>, Group; def nostdlibxx : Flag<["-"]