summaryrefslogtreecommitdiffstats
path: root/llvm/docs
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-10-08 19:41:06 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-10-08 19:41:06 +0000
commit732afdd09a7ff0e8ec60fc9503ed947a9b7b7eca (patch)
tree17fc2ccb250922e11410849638641e52007b211d /llvm/docs
parent30cbd1ab84a26e688ee7910a32e13722feabfb57 (diff)
downloadbcm5719-llvm-732afdd09a7ff0e8ec60fc9503ed947a9b7b7eca.tar.gz
bcm5719-llvm-732afdd09a7ff0e8ec60fc9503ed947a9b7b7eca.zip
Turn cl::values() (for enum) from a vararg function to using C++ variadic template
The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/CommandLine.rst15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst
index 556c302501e..66a96eefbae 100644
--- a/llvm/docs/CommandLine.rst
+++ b/llvm/docs/CommandLine.rst
@@ -355,8 +355,7 @@ library fill it in with the appropriate level directly, which is used like this:
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(...);
@@ -401,8 +400,7 @@ program. Because of this, we can alternatively write this example like this:
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 +434,7 @@ the code looks like this:
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 +495,7 @@ Then define your "``cl::list``" variable:
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 +554,7 @@ Reworking the above list example, we could replace `cl::list`_ with `cl::bits`_:
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:
OpenPOWER on IntegriCloud