[PATCH] D70620: [CommandLine] Add callbacks to Options

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 10:55:43 PST 2019


hintonda added a comment.

I'd just like to acknowledge a few issues with this patch, and request feedback:

- the current version of Callback returns void, so it can't really be used to validate -- other than via `assert`/`abort`.  If it returned a bool, it could be used to validate a specific value during parsing, but that doesn't apply to assignment, i.e., either directly or via nested callbacks -- that would require an `assert`/`abort`.
- the Callback won't be invoked if the `cl::location` attribute is used and the location is mutated directly.

Given these limitations, I wonder if adding a callback to `cl::ParseCommandLineOptions`, and doing the validation there, might not be a better solution.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70620





More information about the llvm-commits mailing list