Support: Fix option handling when using cl::Required with aliasopt
authorJustin Bogner <mail@justinbogner.com>
Mon, 14 Jul 2014 20:53:57 +0000 (20:53 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 14 Jul 2014 20:53:57 +0000 (20:53 +0000)
commit759645ea89e1185868034637172a255ca9cf799c
tree5c37b33c5cb8df8b829b0773fd2b7be9e2397bd1
parentb8f435ca7035b4ac1113457ef47354d69431306d
Support: Fix option handling when using cl::Required with aliasopt

Until now, attempting to create an alias of a required option would
complain if the user supplied the alias, because the required option
didn't have a value. Similarly, if you said the alias was required,
then using the base option would complain that the alias wasn't
supplied. Lastly, if you put required on both, *neither* option would
work.

By changning alias to overload addOccurrence and setting cl::Required
on the original option, we can get this to behave in a more useful
way. I've also added a test and updated a user that was getting this
wrong.

llvm-svn: 212986
llvm/include/llvm/Support/CommandLine.h
llvm/tools/llvm-profdata/llvm-profdata.cpp
llvm/unittests/Support/CommandLineTest.cpp