[LLVMdev] required command line options

Ryan M. Lefever lefever at crhc.uiuc.edu
Thu Mar 8 04:08:05 PST 2007


In the CommandLine parser there is a way to specify that a command line 
option is required.  Is there a way to specify that the option is 
required only if some other option is set?

In particular, I want to build a transformation T that opt loads.  So, I 
when I register T with opt a boolean command line option is created.  If 
the option is set by the user, then the transformation is run.  However, 
T requires the user to specify the names of some files.  So, I can use 
cl::opt<string> to create command line options F1, F2, and F3 with which 
the user can specify those file names.  If I define F1, F2, and F3 as 
cl::required, they are required even if transform T is not being run. 
Is there a way to make the file command line arguments required 
contingent on the presence of transform T's command line flag?

Thanks in advance,
Ryan



More information about the llvm-dev mailing list