r283671 - Turn cl::values() (for enum) from a vararg function to using C++ variadic template

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 8 12:41:07 PDT 2016


Author: mehdi_amini
Date: Sat Oct  8 14:41:06 2016
New Revision: 283671

URL: http://llvm.org/viewvc/llvm-project?rev=283671&view=rev
Log:
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

Modified:
    cfe/trunk/tools/c-index-test/core_main.cpp
    cfe/trunk/utils/TableGen/TableGen.cpp

Modified: cfe/trunk/tools/c-index-test/core_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/core_main.cpp?rev=283671&r1=283670&r2=283671&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/core_main.cpp (original)
+++ cfe/trunk/tools/c-index-test/core_main.cpp Sat Oct  8 14:41:06 2016
@@ -41,8 +41,7 @@ static cl::opt<ActionType>
 Action(cl::desc("Action:"), cl::init(ActionType::None),
        cl::values(
           clEnumValN(ActionType::PrintSourceSymbols,
-                     "print-source-symbols", "Print symbols from source"),
-          clEnumValEnd),
+                     "print-source-symbols", "Print symbols from source")),
        cl::cat(IndexTestCoreCategory));
 
 static cl::extrahelp MoreHelp(

Modified: cfe/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/TableGen.cpp?rev=283671&r1=283670&r2=283671&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/TableGen.cpp (original)
+++ cfe/trunk/utils/TableGen/TableGen.cpp Sat Oct  8 14:41:06 2016
@@ -135,8 +135,7 @@ cl::opt<ActionType> Action(
         clEnumValN(GenAttrDocs, "gen-attr-docs",
                    "Generate attribute documentation"),
         clEnumValN(GenDiagDocs, "gen-diag-docs",
-                   "Generate attribute documentation"),
-        clEnumValEnd));
+                   "Generate attribute documentation")));
 
 cl::opt<std::string>
 ClangComponent("clang-component",




More information about the cfe-commits mailing list