<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Kinda. There is no way to restrict which options cl::opt will respect. It will always support parsing all options. That is the biggest reason why I recommend people not use it.<div class=""><br class=""></div><div class="">There is however a way to hide options. If you look at clang-format there is an API cl::HideUnrelatedOptions which can be used to hide options that are not in specified categories. That allows you to cater your —help spew.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 20, 2016, at 8:42 AM, Paweł Bylica via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Can the cl::opt be used in the way where all options from LLVM libraries are not exposed by default? I used it for a small project where I try to avoid dependencies other than LLVM. The issue is the result of `my-project -help` is a mix of my options and LLVM options.</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Apr 20, 2016 at 10:29 AM Russell Wallace via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Okay, that makes sense, thanks. I'll go with cl::opt, then.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Apr 20, 2016 at 8:08 AM, Sean Silva <span dir="ltr" class=""><<a href="mailto:chisophugis@gmail.com" target="_blank" class="">chisophugis@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">libOption's key feature is being able implement command line parsing compatible with basically any program under the sun. For example, you have control over distinguishing between `-foo` and `--foo` if you need that. <div class="">It is used in clang for command line parsing compatible cl.exe and gcc.</div><div class="">In LLD it is used for command line option parsing compatible with link.exe, gnu ld, and ld64.<div class=""><div class="">If you're writing a program from scratch, this is probably too heavyweight and not the right choice (e.g. it involves running a TableGen step as part of your build).<div class=""><br class=""></div><div class="">On the other hand, cl::opt has its oddities. But overall cl::opt is a reasonable basic option parsing library I would say. If you just need some basic option parsing, already have LLVM as a dependency, and don't want to roll your own option parsing, it is probably a decent choice.</div><div class=""><br class=""></div><div class="">Overall I would not consider LLVM to provide a general purpose "option parsing" solution. But cl::opt is the closest thing we have.<span class=""><font color="#888888" class=""><br class=""><div class=""><br class=""></div><div class="">-- Sean Silva</div></font></span></div></div></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Tue, Apr 19, 2016 at 5:47 AM, Russell Wallace via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr" class="">I'm given to understand that the recommendation these days is to use libOption instead of cl::opt, on the grounds that it has a number of advantages including more control of which options are made available.<div class=""><br class=""></div><div class="">Is there any information available on how to use libOption, any documentation or example programs? Do any existing programs use it except the clang driver programs? Those customise their commandline handling heavily enough that it's hard to use them as examples.</div></div>
<br class=""></span><span class="">_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
<br class=""></span></blockquote></div><br class=""></div>
</blockquote></div><br class=""></div>
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>