MaskRay accepted this revision. MaskRay added a comment. This revision is now accepted and ready to land.
> This patch adds the ability to use -mllvm options in the linker wrapper when > performing bitcode linking or the module compilation. This is done by passing > in the LLVM argument to the clang-linker-wrapper ... The description can be simplified. "This patch adds the ability to " can be simplified as "Add ..." (imperative). > The actual arguments to the linker wrapper are parsed using the Opt library > instead. It is called `LLVMOption`. You can also refer to it as `llvm/lib/Option`. > As far as I can tell this is the easiest way to forward arguments to LLVM > tool invocations. If there is a better way to pass these arguments (such as > through the LTO config) let me know. This is how `Clang::ConstructJob` handles -mllvm, too. ================ Comment at: clang/lib/Driver/ToolChains/Clang.cpp:8466 + // Forward `-mllvm` arguments to the LLVM invocations if present. + for (auto *Arg : Args.filtered(options::OPT_mllvm)) { + CmdArgs.push_back("-mllvm"); ---------------- ================ Comment at: clang/lib/Driver/ToolChains/Clang.cpp:8467 + for (auto *Arg : Args.filtered(options::OPT_mllvm)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back(Arg->getValue()); ---------------- Add `A->claim();` ================ Comment at: clang/test/Driver/openmp-offload.c:676 + +// CHK-NEW-DRIVER-MLLVM: clang-linker-wrapper{{.*}}"-abc ---------------- Just add the ending `"` ================ Comment at: clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td:74 +// Arguments for the LLVM backend. +def mllvm : Separate<["--", "-"], "mllvm">, Flags<[WrapperOnlyOption]>, + MetaVarName<"<arg>">, HelpText<"Arguments passed to the LLVM invocation">; ---------------- Just keep `"-"` and remove `"--"`. clang doesn't support --mllvm. There is no need making users choose different spellings. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129424/new/ https://reviews.llvm.org/D129424 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits