[PATCH] D115433: [CommandLine] Reset option to its default if its Default field is undefined

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 08:55:44 PST 2022


beanz added a comment.

In D115433#3231665 <https://reviews.llvm.org/D115433#3231665>, @greened wrote:

> What is the motivation for this change?  I can argue for maintaining the current behavior.,  If I pass a `cl::init` to an option and call `ResetAllOptionOccurrences` I would expect that `cl::init` value to be used to reset the option.  There are compiler flows that rely on that behavior.

IIUC, the point of this change is not to alter the behavior for options that have a `cl::init`, but rather to alter behavior for options that _don't_ have a default provided. Right now, those options don't get reset when `ResetAllOptionOccurrences` is called. With this patch, options _without_ `cl::init` should get reset to the default-constructed value of the option type, and options with `cl::init` get initialized to the default value.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115433/new/

https://reviews.llvm.org/D115433



More information about the llvm-commits mailing list