These now match other flags like -ast-dump*
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 42781 Build 43350: arc lint + arc unit
Event Timeline
@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.
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).
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.
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.