[PATCH] Part 1 of Many: Refactoring llvm command line parsing

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Jan 20 18:07:51 PST 2015


> On 2015 Jan 20, at 17:23, Chris Bieneman <beanz at apple.com> wrote:
> 
>> On Jan 20, 2015, at 4:40 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>> 
>> 
>>> On 2015 Jan 20, at 16:09, Chris Bieneman <beanz at apple.com> wrote:
>>> 
>>> Hi chandlerc,
>>> 
>>> The primary goal of this patch is to remove the need for MarkOptionsChanged(). That goal is accomplished by having addOption and removeOption properly sort the options.
>>> 
>>> This patch puts the new add and remove functionality on a CommandLineParser class that is a placeholder. Some of the functionality in this class will need to be merged into the OptionRegistry, and other bits can hopefully be in a better abstraction.
>>> 
>>> Other changes:
>>> * Minor changes to MachinePassRegistry.cpp, LegacyPassNameParser.cpp, and Pass.cpp to support changes to Parser.Initailize()
>>> * Exposed a new API for tools to hide unrelated options (I have patches for clang to adopt)
>>> *Fixed an issue with CommandLineTest caused by the new registration model.
>> 
>> Can any of these be split out (particularly the new API seems like
>> a candidate)?
> 
> There are a few things I can carve out into separate patches. As it is now, it all kind of organically grew out of my attempt to eliminate MarkOptionsChanged().
> 
> Basically the three bullets at the end could be carved out separately. They are changes that were needed in order for me to be able to eliminate MarkOptionsChanged, but they aren’t intrinsically bound to the change.
> 
> The new API came about because with this change the previous implementation of cl::getRegisteredOptions didn’t make sense. In changing that API I noticed that the two places it was in use by clang were both doing the same thing. It made more sense to me to add a new API (cl::HideUnrelatedOptions) rather than keeping clang tied to how cl::opt was implemented.

Sounds great.



More information about the llvm-commits mailing list