Mercurial > hg > CbC > CbC_llvm
diff docs/CommandLine.rst @ 120:1172e4bd9c6f
update 4.0.0
author | mir3636 |
---|---|
date | Fri, 25 Nov 2016 19:14:25 +0900 |
parents | afa8332a0e37 |
children | 803732b1fca8 |
line wrap: on
line diff
--- a/docs/CommandLine.rst Tue Jan 26 22:56:36 2016 +0900 +++ b/docs/CommandLine.rst Fri Nov 25 19:14:25 2016 +0900 @@ -355,8 +355,7 @@ clEnumVal(g , "No optimizations, enable debugging"), clEnumVal(O1, "Enable trivial optimizations"), clEnumVal(O2, "Enable default optimizations"), - clEnumVal(O3, "Enable expensive optimizations"), - clEnumValEnd)); + clEnumVal(O3, "Enable expensive optimizations"))); ... if (OptimizationLevel >= O2) doPartialRedundancyElimination(...); @@ -364,8 +363,7 @@ This declaration defines a variable "``OptimizationLevel``" of the "``OptLevel``" enum type. This variable can be assigned any of the values that -are listed in the declaration (Note that the declaration list must be terminated -with the "``clEnumValEnd``" argument!). The CommandLine library enforces that +are listed in the declaration. The CommandLine library enforces that the user can only specify one of the options, and it ensure that only valid enum values can be specified. The "``clEnumVal``" macros ensure that the command line arguments matched the enum values. With this option added, our help output @@ -401,8 +399,7 @@ clEnumValN(Debug, "g", "No optimizations, enable debugging"), clEnumVal(O1 , "Enable trivial optimizations"), clEnumVal(O2 , "Enable default optimizations"), - clEnumVal(O3 , "Enable expensive optimizations"), - clEnumValEnd)); + clEnumVal(O3 , "Enable expensive optimizations"))); ... if (OptimizationLevel == Debug) outputDebugInfo(...); @@ -436,8 +433,7 @@ cl::values( clEnumValN(nodebuginfo, "none", "disable debug information"), clEnumVal(quick, "enable quick debug information"), - clEnumVal(detailed, "enable detailed debug information"), - clEnumValEnd)); + clEnumVal(detailed, "enable detailed debug information"))); This definition defines an enumerated command line variable of type "``enum DebugLev``", which works exactly the same way as before. The difference here is @@ -498,8 +494,7 @@ clEnumVal(dce , "Dead Code Elimination"), clEnumVal(constprop , "Constant Propagation"), clEnumValN(inlining, "inline", "Procedure Integration"), - clEnumVal(strip , "Strip Symbols"), - clEnumValEnd)); + clEnumVal(strip , "Strip Symbols"))); This defines a variable that is conceptually of the type "``std::vector<enum Opts>``". Thus, you can access it with standard vector @@ -558,8 +553,7 @@ clEnumVal(dce , "Dead Code Elimination"), clEnumVal(constprop , "Constant Propagation"), clEnumValN(inlining, "inline", "Procedure Integration"), - clEnumVal(strip , "Strip Symbols"), - clEnumValEnd)); + clEnumVal(strip , "Strip Symbols"))); To test to see if ``constprop`` was specified, we can use the ``cl:bits::isSet`` function: @@ -967,11 +961,10 @@ .. _cl::values: * The **cl::values** attribute specifies the string-to-value mapping to be used - by the generic parser. It takes a **clEnumValEnd terminated** list of - (option, value, description) triplets that specify the option name, the value - mapped to, and the description shown in the ``-help`` for the tool. Because - the generic parser is used most frequently with enum values, two macros are - often useful: + by the generic parser. It takes a list of (option, value, description) + triplets that specify the option name, the value mapped to, and the + description shown in the ``-help`` for the tool. Because the generic parser + is used most frequently with enum values, two macros are often useful: #. The **clEnumVal** macro is used as a nice simple way to specify a triplet for an enum. This macro automatically makes the option name be the same as @@ -1296,8 +1289,7 @@ int main(int argc, char **argv) { cl::OptionCategory AnotherCategory("Some options"); - StringMap<cl::Option*> Map; - cl::getRegisteredOptions(Map); + StringMap<cl::Option*> &Map = cl::getRegisteredOptions(); //Unhide useful option and put it in a different category assert(Map.count("print-all-options") > 0);