This is an archive of the discontinued LLVM Phabricator instance.

Give frontend dump flags consistent names (*-dump instead of dump-*)
AbandonedPublic

Authored by herzka on Dec 19 2019, 7:54 AM.

Details

Summary

These now match other flags like -ast-dump*

Event Timeline

herzka created this revision.Dec 19 2019, 7:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2019, 7:54 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

@modocache, should I add a unit test for these aliases or would that be too trivial? I don't see unit tests for all the existing flags.

herzka edited the summary of this revision. (Show Details)Dec 19 2019, 9:58 AM
herzka edited the summary of this revision. (Show Details)
herzka updated this revision to Diff 234746.Dec 19 2019, 10:24 AM

Update argument parsing

modocache requested changes to this revision.Dec 19 2019, 10:27 AM
modocache added subscribers: jroelofs, echristo.

Grepping for "dump-tokens", I can see one regression test that exercises this option: clang/test/Lexer/dollar-idents.c. "dump-coverage-mapping" also shows up in a few regression tests. One way to exercise the new option names is to modify these tests to use both the new and old option names. I think this would test that they can be used interchangeably.

As for the unit tests in llvm/unittests or clang/unittests, I agree, I don't think this diff requires any new tests in there.

I'll request changes on this diff because some switch statements in Clang need to be updated to handle the new option names. Also I'll suggest some additional reviewers: @jroelofs (who suggested we create aliases for these), and @echristo (because these options were last modified over 7 years ago and Eric has a long tenure in this codebase).

This revision now requires changes to proceed.Dec 19 2019, 10:27 AM

I worry that repeating all those names in those tests might be noisy. I think I'll switch those to use the new name, but add another test that makes sure both names still work.

herzka updated this revision to Diff 234966.Dec 20 2019, 1:23 PM

change flags in tests

jdoerfert resigned from this revision.Dec 20 2019, 3:27 PM

Ah, I'm sorry I wasn't clear -- instead of changing a lot of tests to use the new names exclusively, my suggestion was to change one or two tests to use the new canonical name, and have the remaining tests keep using the alias. That would keep the patch small, but still exercise both the new option name -tokens-dump as well as the old alias -dump-tokens.

That being said, this change also works for me! I'd be happy to have this landed. But I want to make sure others have input as well. @mehdi_amini commented on this patch on the LLVM Discord, for example:

This patch seems weird to me: with this logic we would shuffle around every possible options (-fdump-vtable-layouts / -fvtable-layouts-dump, -disable-O0-optnone / -O0-optnone-disable, ...) ?

To which I responded:

I'm of the opinion -- and maybe this would be a radical change -- that all "dump" options should either use it as a prefix (-fdump-vtable-layouts) or as a suffix (-fvtable-layouts-dump). I'm not an expert though, so I don't know what would be the polite way to change option names without disrupting end users of LLVM. I thought the patch was good because it adds aliases, so people who are used to -dump-tokens or -ast-dump could still use those option names.

So I think my answer to your question is "no, we shouldn't provide aliases with all permutations of words in options." My take is "for options that dump some sort of intermediate output, dump should appear in a standard place in the option name. Whether it's at the beginning (-dump-ast, -dump-tokens) or at the end (-ast-dump, -tokens-dump) doesn't matter to me, per se, as long as it's consistent." And, my second opinion: "Personally I'd love to change all of these option names right now, but that might be disruptive, I don't know. If it isn't, then let's change them. If it is, then using aliases seems like a good migratory plan."

I'd like to wait and give others the chance to review this patch, so I'll wait a bit to accept it. It would help me personally day to day to have this change landed, because I can never remember the order of options like -tokens-dump and -dump-ast.

herzka updated this revision to Diff 235188.Dec 23 2019, 5:45 PM

rebase, restore changes to CC1Options.td that I left out of last revision

herzka abandoned this revision.Dec 25 2019, 4:13 PM