[flang-commits] [clang] [flang] [flang][driver] add negative from of -fsave-main-program (PR #124110)

via flang-commits flang-commits at lists.llvm.org
Thu Jan 23 07:08:29 PST 2025


================
@@ -6968,8 +6968,8 @@ defm unsigned : OptInFC1FFlag<"unsigned", "Enables UNSIGNED type">;
 def fno_automatic : Flag<["-"], "fno-automatic">, Group<f_Group>,
   HelpText<"Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE">;
 
-def fsave_main_program : Flag<["-"], "fsave-main-program">, Group<f_Group>,
-  HelpText<"Place all variables from the main program in static memory (otherwise scalars may be placed on the stack)">;
+defm save_main_program : OptInFC1FFlag<"save-main-program",
----------------
jeanPerier wrote:

It does. I just copied from other usages, but looking into it, I think that is the intention for this from.

The prefixes are for the help messages and only the positive from of the flag is printed in the help since the negative is the default behavior (hence the "OptIn"). So this sets the help message of the positive form via `pos_prefix` and leaves the negative from help text empty (`neg_prefix # help`)).

But I actually want the negative from to be printed, I am not a fan of hidden options, so I changed to `BoolOptionWithoutMarshalling`. Thanks for raising the question!

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


More information about the flang-commits mailing list