MaskRay created this revision. MaskRay added reviewers: jhuber6, rnk. Herald added subscribers: jeroen.dobbelaere, StephenFan. Herald added a project: All. MaskRay requested review of this revision. Herald added a reviewer: jdoerfert. Herald added subscribers: cfe-commits, sstefan1. Herald added a project: clang.
Driver options taking a value typically use `=` as the separator, instead of a space. Not using a space also helps a dozen compiler driver wrappers which don't want to know which options are `Separate`. Unfortunately many older driver options do not stick with the rule, but I find -Xclang used a lot and will provide convenience when -Xclang= is supported. For build systems using a string array instead of a string to indicate compiler options, `["-Xclang=-foo"]` is more convenient than `["-Xclang", "-foo"]`. Note: there is a `=` precedence for `-X*` option: `-Xopenmp-target=`. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D131455 Files: clang/include/clang/Driver/Options.td clang/test/Driver/disable-llvm.c Index: clang/test/Driver/disable-llvm.c =================================================================== --- clang/test/Driver/disable-llvm.c +++ clang/test/Driver/disable-llvm.c @@ -1,6 +1,10 @@ // We support a CC1 option for disabling LLVM's passes. // RUN: %clang -O2 -Xclang -disable-llvm-passes -### %s 2>&1 \ // RUN: | FileCheck --check-prefix=DISABLED %s + +// Try -Xclang=. +// RUN: %clang -O2 -Xclang=-disable-llvm-passes -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=DISABLED %s // DISABLED: -cc1 // DISABLED-NOT: "-mllvm" "-disable-llvm-passes" // DISABLED: "-disable-llvm-passes" Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -817,6 +817,9 @@ def Xclang : Separate<["-"], "Xclang">, HelpText<"Pass <arg> to the clang compiler">, MetaVarName<"<arg>">, Flags<[NoXarchOption, CoreOption]>, Group<CompileOnly_Group>; +def : Joined<["-"], "Xclang=">, + HelpText<"Pass <arg> to the clang compiler">, MetaVarName<"<arg>">, + Flags<[NoXarchOption, CoreOption]>, Group<CompileOnly_Group>, Alias<Xclang>; def Xcuda_fatbinary : Separate<["-"], "Xcuda-fatbinary">, HelpText<"Pass <arg> to fatbinary invocation">, MetaVarName<"<arg>">; def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
Index: clang/test/Driver/disable-llvm.c =================================================================== --- clang/test/Driver/disable-llvm.c +++ clang/test/Driver/disable-llvm.c @@ -1,6 +1,10 @@ // We support a CC1 option for disabling LLVM's passes. // RUN: %clang -O2 -Xclang -disable-llvm-passes -### %s 2>&1 \ // RUN: | FileCheck --check-prefix=DISABLED %s + +// Try -Xclang=. +// RUN: %clang -O2 -Xclang=-disable-llvm-passes -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=DISABLED %s // DISABLED: -cc1 // DISABLED-NOT: "-mllvm" "-disable-llvm-passes" // DISABLED: "-disable-llvm-passes" Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -817,6 +817,9 @@ def Xclang : Separate<["-"], "Xclang">, HelpText<"Pass <arg> to the clang compiler">, MetaVarName<"<arg>">, Flags<[NoXarchOption, CoreOption]>, Group<CompileOnly_Group>; +def : Joined<["-"], "Xclang=">, + HelpText<"Pass <arg> to the clang compiler">, MetaVarName<"<arg>">, + Flags<[NoXarchOption, CoreOption]>, Group<CompileOnly_Group>, Alias<Xclang>; def Xcuda_fatbinary : Separate<["-"], "Xcuda-fatbinary">, HelpText<"Pass <arg> to fatbinary invocation">, MetaVarName<"<arg>">; def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits