OSDN Git Service

[clang][cli] Let denormalizer decide how to render the option based on the option...
authorJan Svoboda <jan_svoboda@apple.com>
Fri, 18 Dec 2020 12:55:48 +0000 (13:55 +0100)
committerJan Svoboda <jan_svoboda@apple.com>
Mon, 21 Dec 2020 10:32:47 +0000 (11:32 +0100)
commit70410a264949101ced3ce3458f37dd4cc2f5af85
treea556384161d6a76f1244a6ef7294146ef713dd41
parent27b7d646886d499c70dec3481dfc3c82dfc43dd7
[clang][cli] Let denormalizer decide how to render the option based on the option class

Before this patch, you needed to use `AutoNormalizeEnumJoined` whenever you wanted to **de**normalize joined enum.
Besides the naming confusion, this means the fact the option is joined is specified in two places: in the normalization multiclass and in the `Joined<["-"], ...>` multiclass.
This patch makes this work automatically, taking into account the `OptionClass` of options.

Also, the enum denormalizer now just looks up the spelling of the present enum case in a table and forwards it to the string denormalizer.

I also added more tests that exercise this.

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84189
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Option/OptParser.td