[PATCH] D142933: Add -print-multi-selection-flags argument

Joseph Faulls via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 2 06:15:33 PST 2023


Joe added a comment.



> Thanks for explaining. I found that when I was writing a regex to match flags it was helpful to have a part of the string I could be sure would be there to avoid matching the wrong type of flag, and `march=` helped with that. I also worry that names from different types of flags could clash without some kind of namespacing.

Understandable about the flag names clashing. The scope of riscv multilibs was just arch/abi, so there was no concern about clashing/matching the wrong type of flag. Would it be weird for one target to have the `march=` but anothers not?



================
Comment at: clang/lib/Driver/Driver.cpp:2213
+  if (C.getArgs().hasArg(options::OPT_print_multi_selection_flags)) {
+    for (StringRef Attr : TC.getMultiSelectionFlags(C.getArgs()))
+      llvm::outs() << Attr << '\n';
----------------
Do we want to parse the multilib.yaml here so we can print out custom flags as well? It could help diagnose issues people have with them.


================
Comment at: clang/lib/Driver/ToolChain.cpp:204
+    Result.push_back(
+        clang::driver::getDriverOptTable().getOptionName(Option).str());
+  }
----------------
> 
>> the form `x=y` is already broken when you add the flags from the flag list.
> 
> Can you give an example of what you mean by that? Sounds like something that might need fixing.
For example the option name for OPT_fexceptions is just `fexceptions`, and this is added directly to `Results`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142933



More information about the cfe-commits mailing list