[flang-commits] [clang] [clang-tools-extra] [flang] [lld] [llvm] [flang][clang] Add Visibility specific help text for options (PR #81869)

Andrzej WarzyƄski via flang-commits flang-commits at lists.llvm.org
Mon Mar 11 11:16:42 PDT 2024


================
@@ -3382,10 +3382,19 @@ def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>,
   HelpText<"Parse OpenMP pragmas and generate parallel code.">;
 def fno_openmp : Flag<["-"], "fno-openmp">, Group<f_Group>,
   Flags<[NoArgumentUnused]>;
+class OpenMPVersionHelp<string program, string default> {
+  string str = !strconcat(
+    "Set OpenMP version (e.g. 45 for OpenMP 4.5, 51 for OpenMP 5.1). Default value is ",
+    default, " for ", program);
+}
 def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, Group<f_Group>,
   Flags<[NoArgumentUnused]>,
   Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
-  HelpText<"Set OpenMP version (e.g. 45 for OpenMP 4.5, 51 for OpenMP 5.1). Default value is 51 for Clang">;
+  HelpText<OpenMPVersionHelp<"Clang", "51">.str>,
+  HelpTextForVisibilities<[
+    HelpTextForVisibility<FlangOption, OpenMPVersionHelp<"Flang", "11">.str>,
+    HelpTextForVisibility<FC1Option,   OpenMPVersionHelp<"Flang", "11">.str>,
----------------
banach-space wrote:

I don't envisage the semantics changing depending on whether `flang-new` or `flang-new -fc1` is used. Ideally, this should be just one field with 2 visibilities set.

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


More information about the flang-commits mailing list