[PATCH] D69822: [clang] Add new -fdebug-default-version flag.

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 15:12:13 PST 2019


probinson added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:1955
   Flags<[CC1Option]>;
+def fdebug_default_version: Joined<["-"], "fdebug-default-version=">, Group<f_Group>;
 def fdebug_prefix_map_EQ
----------------
If this is specifically the default DWARF version, I think the word "dwarf" ought to be in the option name.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3148
   // decision should be made in the driver as well though.
+  unsigned DefaultDWARFVersion = ParseDebugDefaultVersion(TC, Args);
   unsigned DWARFVersion = 0;
----------------
I would rather see all the DWARF version weirdness all in one place (i.e., please move this down to the rest of it) particularly given that the "default" DWARF version now means two different things (something from the command line, and something based on the toolchain).


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3250
   // -gline-directives-only supported only for the DWARF debug info.
   if (DWARFVersion == 0 && DebugInfoKind == codegenoptions::DebugDirectivesOnly)
     DebugInfoKind = codegenoptions::NoDebugInfo;
----------------
After setting DWARFVersion above, when nothing was requested, this looks peculiar.  Is `DWARFVersion == 0` a proxy for `-gcodeview` ?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6174
+    DwarfVersion = ParseDebugDefaultVersion(getToolChain(), Args);
+
   if (DwarfVersion == 0)
----------------
I have to say, this sequence is a whole lot easier to follow than what's up in RenderDebugOptions.  It would be nice if they were both so easy to understand.

Although it makes me wonder, does `-fdebug-default-version` go unclaimed here if there's a `-gdwarf-2` on the command line?


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

https://reviews.llvm.org/D69822





More information about the cfe-commits mailing list