[clang] [Clang][NFC] Introduce `--offloadlib` positive flag for `nogpulib` and alias to `--no-offloadlib` (PR #126567)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 15:58:36 PST 2025


================
@@ -5618,9 +5618,17 @@ def nogpuinc : Flag<["-"], "nogpuinc">, Group<IncludePath_Group>,
 def nohipwrapperinc : Flag<["-"], "nohipwrapperinc">, Group<IncludePath_Group>,
   HelpText<"Do not include the default HIP wrapper headers and include paths">;
 def : Flag<["-"], "nocudainc">, Alias<nogpuinc>;
-def nogpulib : Flag<["-"], "nogpulib">, MarshallingInfoFlag<LangOpts<"NoGPULib">>,
-  Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
-  HelpText<"Do not link device library for CUDA/HIP device compilation">;
+def nogpulib
+    : Flag<["--"], "no-offloadlib">,
+      MarshallingInfoFlag<LangOpts<"NoGPULib">>,
+      Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
+      HelpText<"Do not link device library for CUDA/HIP device compilation">;
+def gpulib : Flag<["--"], "offloadlib">,
+             Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
+             HelpText<"Link device libraries for GPU device compilation">;
+def : Flag<["-"], "nogpulib">,
+      Alias<nogpulib>,
+      Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
----------------
Artem-B wrote:

What's the point keeping tablegen record name `nogpulib` ? We're changing each and every `OPT_nogpu` use anyways. When I look for an option use in the source code I usually go searching for `OPT_<option>` and there will be no `OPT_offloadlib`. 

I'd just follow the standard convention of keeping record name and the option spelling in sync, and then make `nogpulib` record an alias.

https://github.com/llvm/llvm-project/pull/126567


More information about the cfe-commits mailing list