[PATCH] D101630: [HIP] Fix device-only compilation

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 4 09:29:55 PDT 2021


tra added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:977
   NegFlag<SetFalse>>;
+defm hip_bundle_device_output : BoolFOption<"hip-bundle-device-output", EmptyKPM, DefaultTrue,
+  PosFlag<SetTrue, []>,
----------------
jansvoboda11 wrote:
> The TableGen marshalling infrastructure (`BoolFOption` et. al.) is only intended for flags that map to the `-cc1` frontend and its `CompilerInvocation` class. (`EmptyKPM` that disables this mapping shouldn't even exist anymore.)
> 
> Since these flags only work on the driver level, use something like this instead:
> 
> ```
> def fhip_bundle_device_output : Flag<["-"], "fhip-bundle-device-output">, Group<f_Group>;
> def fno_hip_bundle_device_output : Flag<["-"], "fno-hip-bundle-device-output">, Group<f_Group>, HelpText<"Do not bundle output files of HIP device compilation">;
> ```
<offtopic>
It would be great if `BoolFOption` would at least document that assumption.
It would be even better if it would be allowed to be used to implement a driver-only option, maybe with a flag.
The class is very useful to handle -fsomething/-fno-something and restricting it to cc1 only will continue to be a constant source of this kind of confusion. I think we've already seen handful of them in reviews since the flag tablegen got overhauled.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101630/new/

https://reviews.llvm.org/D101630



More information about the cfe-commits mailing list