@@ -577,7 +577,8 @@ multiclass BoolWOption<string flag_base, KeyPathAndMacro kpm,
577577// Works like BoolOption except without marshalling
578578multiclass BoolOptionWithoutMarshalling<string prefix = "", string spelling_base,
579579 FlagDef flag1_base, FlagDef flag2_base,
580- BothFlags suffix = BothFlags<[]>> {
580+ BothFlags suffix = BothFlags<[]>,
581+ list<string> flag_prefix = ["-"]> {
581582 defvar flag1 = FlagDefExpanded<ApplySuffix<flag1_base, suffix>.Result, prefix,
582583 NAME, spelling_base>;
583584
@@ -598,12 +599,12 @@ multiclass BoolOptionWithoutMarshalling<string prefix = "", string spelling_base
598599
599600 defvar implied = !if(flag1.CanBeImplied, flag1, flag2);
600601
601- def flag1.RecordName : Flag<["-"] , flag1.Spelling>, Flags<flag1.OptionFlags>,
602+ def flag1.RecordName : Flag<flag_prefix , flag1.Spelling>, Flags<flag1.OptionFlags>,
602603 Visibility<flag1.OptionVisibility>,
603604 HelpText<flag1.Help>,
604605 ImpliedByAnyOf<implied.ImpliedBy, implied.ValueAsCode>
605606 {}
606- def flag2.RecordName : Flag<["-"] , flag2.Spelling>, Flags<flag2.OptionFlags>,
607+ def flag2.RecordName : Flag<flag_prefix , flag2.Spelling>, Flags<flag2.OptionFlags>,
607608 Visibility<flag2.OptionVisibility>,
608609 HelpText<flag2.Help>,
609610 ImpliedByAnyOf<implied.ImpliedBy, implied.ValueAsCode>
@@ -5756,12 +5757,17 @@ def nobuiltininc : Flag<["-"], "nobuiltininc">,
57565757 Group<IncludePath_Group>,
57575758 HelpText<"Disable builtin #include directories only">,
57585759 MarshallingInfoNegativeFlag<HeaderSearchOpts<"UseBuiltinIncludes">>;
5759- def nogpuinc : Flag<["-"], "nogpuinc">, Group<IncludePath_Group>,
5760- HelpText<"Do not add include paths for CUDA/HIP and"
5761- " do not include the default CUDA/HIP wrapper headers">;
5760+ defm offload_inc: BoolOptionWithoutMarshalling<"", "offload-inc",
5761+ PosFlag<SetTrue, [], [ClangOption], "Add include paths for CUDA/HIP and"
5762+ " include the default CUDA/HIP wrapper headers (default)">,
5763+ NegFlag<SetFalse, [], [ClangOption], "Do not add include paths for CUDA/HIP"
5764+ " and include the default CUDA/HIP wrapper headers">,
5765+ BothFlags<[]>, ["--"]>, Group<IncludePath_Group>;
5766+ def : Flag<["-"], "nogpuinc">, Alias<no_offload_inc>;
5767+
57625768def nohipwrapperinc : Flag<["-"], "nohipwrapperinc">, Group<IncludePath_Group>,
57635769 HelpText<"Do not include the default HIP wrapper headers and include paths">;
5764- def : Flag<["-"], "nocudainc">, Alias<nogpuinc >;
5770+ def : Flag<["-"], "nocudainc">, Alias<no_offload_inc >;
57655771def no_offloadlib
57665772 : Flag<["--"], "no-offloadlib">,
57675773 MarshallingInfoFlag<LangOpts<"NoGPULib">>,
0 commit comments