[CommandLine] Add callbacks to Options
authorDon Hinton <donh@apple.com>
Fri, 6 Dec 2019 22:40:21 +0000 (14:40 -0800)
committerDon Hinton <donh@apple.com>
Fri, 6 Dec 2019 23:16:45 +0000 (15:16 -0800)
commit6555995a6d4545ff59dcf3388f9acfce3b6129a5
treeced9063ae798be396c497a476da6927a7bd1a92c
parent0a717d5b5d31fc2d5bc98ca695031fb09e65beb0
[CommandLine] Add callbacks to Options

Summary:
Add a new cl::callback attribute to Option.

This attribute specifies a callback function that is called when
an option is seen, and can be used to set other options, as in
option A implies option B.  If the option is a `cl::list`, and
`cl::CommaSeparated` is also specified, the callback will fire
once for each value.  This could be used to validate combinations
or selectively set other options.

Reviewers: beanz, thomasfinch, MaskRay, thopre, serge-sans-paille

Reviewed By: beanz

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70620
llvm/docs/CommandLine.rst
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/Support/CommandLine.h
llvm/unittests/Support/CommandLineTest.cpp