[cfe-dev] Removing '-g' as an option to cc1 and cc1as

Douglas Katzman via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 1 08:18:34 PDT 2015


Hi,

I have a patch up on Phabricator which regularizes some 'g' arguments in
the tool frontends by trusting the clang Driver to handle
toolchain-specific choices about the option family, such as when the
toolchain defaults to Dwarf 2 vs Dwarf 4 and/or when -fstandalone-debug
should be assumed.

The internal option name for setting DebugInfoKind is
"-di-kind={full|limited|line-tables}" which directly sets the codegen opts
to the enum value whose name is as given.
Similarly there's a dwarf-version option.  So the '-g' group options will
be stripped out by the driver and not passed along to cc1 or cc1as.
Specifically, the '-gdwarf', '-gline-tables-only', and '-g' options will be
rejected if seen in {cc1,cc1as} invocations that were hand-crafted in a lot
of regression tests.

I don't think this should be controversial, as the cc1 invocation is not
considered a public API, but maybe some folks would prefer that '-g' still
have some meaning.
So I'd like to ask whether that's the case, as well as invite a little bit
of "bikeshed" discussion as to whether the option name I've introduced
makes sense.

The names "limited" and "full" have slightly strange connotations even
though they have the right semantics.
"limited" is the normal level of debugging, whereas "full" means
"-fstandalone" because the debugger is unable to cope with "limited".
So it would also be totally reasonable to name these choices
{standalone,normal,line-tables} which unfortunately don't coincide with
names of DebugInfoKind.
I chose the names that matched, but I find them unappealing.

So for what it's worth, could some folks maybe express an opinion, and/or
take a crack at reviewing this?
 http://reviews.llvm.org/D13221

Also I'll note one pro and one con for keeping '-g' as an option to {cc1,
cc1as}.
Pro: some of the tests that were affected in the above change could remain
untouched.
Con: it's better to visibly fail than to silently accept an option whose
meaning differs, which is to say, if people expected that the
CompilerInvocation would automatically use Dwarf 2 on Darwin when you give
'-g' in the cc1 invocation, that is most definitely no longer true.

Thanks and regards,
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151001/363f5f7d/attachment.html>


More information about the cfe-dev mailing list