[PATCH] D136707: [clang][Toolchains][Gnu] pass -gdwarf-* through to assembler

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 16:20:26 PDT 2022


MaskRay added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:7966
   }
+  unsigned DwarfVersion = GetDwarfVersion(getToolChain(), Args);
   RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion,
----------------
Consider `const` if this variable is not modified.


================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.h:114
+const llvm::opt::Arg *getDwarfNArg(const llvm::opt::ArgList &Args);
+unsigned GetDwarfVersion(const ToolChain &TC, const llvm::opt::ArgList &Args);
 
----------------
If this patch touches all use cases of `GetDwarfVersion`, consider switching the case to `getDwarfVersion`.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:979
+      unsigned DwarfVersion = GetDwarfVersion(getToolChain(), Args);
+      std::string DV = "-gdwarf-" + std::to_string(DwarfVersion);
+      CmdArgs.push_back(Args.MakeArgString(DV));
----------------
MakeArgString accepts a Twine. Just use `"-gdwarf-" + Twine(DwarfVersion);` as the argument.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136707



More information about the cfe-commits mailing list