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

garvit gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 11:07:48 PDT 2023


garvitgupta08 added a comment.





================
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:
> 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.


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