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

Caroline Tice via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 11:52:31 PST 2019


cmtice added a comment.

Hmmm...I'm having upload issues.



================
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;
----------------
dblaikie wrote:
> probinson wrote:
> > After setting DWARFVersion above, when nothing was requested, this looks peculiar.  Is `DWARFVersion == 0` a proxy for `-gcodeview` ?
> Yep, DWARFVersion shouldn't be set when none was requested - see discussion above between myself & @cmtice - that should leave this code fine/correct.
DWARFVersion is (will be) only set when the debug info kind is DWARF, i.e. when EmitDwarf is True. I apologize for the confusion -- David Blaikie and I has some misunderstandings about the original implementation intent.  DWARFVersion == 0 ought only to result in codeview being generated/used if the user specified -g and codeview is the default debug format for the platform.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6174
+    DwarfVersion = ParseDebugDefaultVersion(getToolChain(), Args);
+
   if (DwarfVersion == 0)
----------------
dblaikie wrote:
> probinson wrote:
> > 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?
> Once the "else if (DefaultDWARFVersion != 0)" clause is removed, and the ParseDebugDefaultVersion call is sunk down into the "if (EmitDwarf)" case - hopefully that'll simplify the RenderDebugOptions code enough to be reasonable?
> 
> I think the complication there is that "-g" can imply CodeView if nothing explicitly requests DWARF & the target is windows, whereas there's no support for that kind of CV fallback here? So some of that might be inherent.
> 
> & agreed - worth testing that -fdebug-default-version doesn't get a -Wunused warning if someone says "-fdebug-default-version 4 -gdwarf-2". @cmtice is that tested? You might be able to add -Werror to the existing test case's RUN lines to demonstrate that no such warnings are produced?
The thought is that if the user actually chose a specific dwarf version, e.g. -gdwarf-2, then that value should override the general default, specified with -fdebug-default-version (soon to be 
-fdwarf-default-version).


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

https://reviews.llvm.org/D69822





More information about the cfe-commits mailing list