Refactoring llvm command line parsing and option registration.
authorChris Bieneman <beanz@apple.com>
Wed, 28 Jan 2015 19:00:25 +0000 (19:00 +0000)
committerChris Bieneman <beanz@apple.com>
Wed, 28 Jan 2015 19:00:25 +0000 (19:00 +0000)
commitd1d9430a051115e12282e8f13b22ce25e7e3cf21
tree33df8a7cc32f981856f11f2f8e93cea05e6b6b3c
parent22e7635dc59f4798a4877f1d044a9d6bd9e4b9df
Refactoring llvm command line parsing and option registration.

Summary:
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.

This patch also removes the RegisteredOptionList global, and the need for cl::Option objects to be linked list nodes.

The changes in CommandLineTest.cpp are required because these changes shift when we validate that options are not duplicated. Before this change duplicate options were only found during certain cl API calls (like cl::ParseCommandLine). With this change duplicate options are found during option construction.

Reviewers: dexonsmith, chandlerc, pete

Reviewed By: pete

Subscribers: pete, majnemer, llvm-commits

Differential Revision: http://reviews.llvm.org/D7132

llvm-svn: 227345
llvm/include/llvm/Support/CommandLine.h
llvm/lib/Support/CommandLine.cpp
llvm/unittests/Support/CommandLineTest.cpp