[PATCH] D145726: Fix assembler error when -g and -gdwarf-* is passed with -fno-integrated-as.

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 11:51:50 PDT 2023


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);
----------------
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?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145726



More information about the cfe-commits mailing list