[clang] [Clang][Docs] Document -Xarch_ better (PR #127890)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 15:52:55 PST 2025


================
@@ -932,9 +932,18 @@ def W_Joined : Joined<["-"], "W">, Group<W_Group>,
 def Xanalyzer : Separate<["-"], "Xanalyzer">,
   HelpText<"Pass <arg> to the static analyzer">, MetaVarName<"<arg>">,
   Group<StaticAnalyzer_Group>;
-def Xarch__ : JoinedAndSeparate<["-"], "Xarch_">, Flags<[NoXarchOption]>,
-  HelpText<"Pass <arg> to the compiliation if the target matches <arch>">,
-  MetaVarName<"<arch> <arg>">;
+def Xarch__
+    : JoinedAndSeparate<["-"], "Xarch_">,
+      Flags<[NoXarchOption]>,
+      HelpText<"Pass <arg> to the compilation if the target matches <arch>">,
+      DocBrief<
+          [{Specifies that the argument should only be used if the compilation
+  target matches the specified architecture. This can be used with the target
+  CPU, triple architecture, or offloading host and device. It is most useful
+  for separating behavior undesirable on one of the targets when combining many
+  compilation jobs, as is commong with offloading. For example, -Xarch_x86_64,
+  -Xarch_gfx90a, and -Xarch_device are all valid selectors.}]>,
+      MetaVarName<"<arch> <arg>">;
----------------
Artem-B wrote:

We do have them defined below as separate options, and you do already mention `Xarch_device` in the help message.
To the user unfamiliar with the implementation they all look like the same `-Xarch_*` option, but somehow get separate help message and treatment. It would be good to document a coherent picture of how it all fits together.

> Can we make the help a separate record and use it for all -Xarch* option variants consistently?

Scratch that, it's a docBrief, so a single instance is fine, I just want to expand it to include the `wildcard` host/device pseud-arches that `-Xarch` effectively accepts.


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


More information about the cfe-commits mailing list