[PATCH] D41674: [Support] CommandLine API -- Allow creating custom parsers for fundamental types

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 00:45:31 PDT 2018


chandlerc added a comment.

In https://reviews.llvm.org/D41674#1048966, @serge-sans-paille wrote:

> We (= the Quarkslab firm) have two use cases for extending the parsers:
>
> - using floating point numbers for obfuscation rations (as in « obfuscate n % of the constants). sometimes the ratio is 0.001 or such
> - using regular expression over function names. In that case it is also convenient to be able to type the option as a regexp and not only a string.


Is this for debugging / tuning / development?

If so, seems reasonable to use a an integer / 1000 (or larger) for ratios.

Not sure why the regexp option wouldn't be best suited to a custom type anyways. Seems like you don't need custom parsers for fundamental types there.

> These options are used from regular passes. Is the Option library a good alternative in that case?

If you expect these to be customized outside of debugging / development of the passes themselves, they should be designed as part of hte API of the pass for library consumers. Then, when constructing the pass you can parameterize it in whatever way you want using data parsed out of whatever commandline library you want?


https://reviews.llvm.org/D41674





More information about the llvm-commits mailing list