nickdesaulniers added inline comments.
================ Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:978-986 + if (Arg *A = Args.getLastArg(options::OPT_g_Flag, options::OPT_gN_Group, + options::OPT_gdwarf_2, options::OPT_gdwarf_3, + options::OPT_gdwarf_4, options::OPT_gdwarf_5, + options::OPT_gdwarf)) + if (!A->getOption().matches(options::OPT_g0)) { + Args.AddLastArg(CmdArgs, options::OPT_g_Flag); + unsigned DwarfVersion = getDwarfVersion(getToolChain(), Args); ---------------- nickdesaulniers wrote: > garvitgupta08 wrote: > > nickdesaulniers wrote: > > > Isn't this potentially going to add `-gdwarf-` repeatedly if there's many > > > inputs? > > > > > > Wouldn't it be better to scan the inputs to see if there's any .S or .s > > > files, then add the flags once? > > Let me know if this is fine. > I don't think the current implementation addresses my point. Having > `CmdArgs.push_back` be called in a loop on the number of inputs will > potentially add the arg repeatedly. > > I think you should simply check if the `InputType` is asm or asm-with-cpp in > the loop, potentially setting a boolean scoped outside the loop. Then, after > the loop, decide whether to add the cmd arg. Specifically, if `llvm::any_of` the inputs are asm or asm-with-cpp, then we might want to modify the command line flags passed to the external assembler. We don't want to pass additional flags per input. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145726/new/ https://reviews.llvm.org/D145726 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits