diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2016-10-08 19:41:06 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-10-08 19:41:06 +0000 |
| commit | 732afdd09a7ff0e8ec60fc9503ed947a9b7b7eca (patch) | |
| tree | 17fc2ccb250922e11410849638641e52007b211d /llvm/tools | |
| parent | 30cbd1ab84a26e688ee7910a32e13722feabfb57 (diff) | |
| download | bcm5719-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/tools')
| -rw-r--r-- | llvm/tools/bugpoint/ExecutionDriver.cpp | 6 | ||||
| -rw-r--r-- | llvm/tools/lli/OrcLazyJIT.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/lli/lli.cpp | 12 | ||||
| -rw-r--r-- | llvm/tools/llvm-ar/llvm-ar.cpp | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm-cov/CodeCoverage.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm-lto/llvm-lto.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-mc/llvm-mc.cpp | 12 | ||||
| -rw-r--r-- | llvm/tools/llvm-nm/llvm-nm.cpp | 4 | ||||
| -rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 7 | ||||
| -rw-r--r-- | llvm/tools/llvm-readobj/llvm-readobj.cpp | 2 | ||||
| -rw-r--r-- | llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-size/llvm-size.cpp | 7 | ||||
| -rw-r--r-- | llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/sancov/sancov.cc | 2 |
17 files changed, 29 insertions, 48 deletions
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp index b0f3880fa74..b26ba93cd61 100644 --- a/llvm/tools/bugpoint/ExecutionDriver.cpp +++ b/llvm/tools/bugpoint/ExecutionDriver.cpp @@ -60,8 +60,7 @@ cl::opt<OutputType> InterpreterSel( "compile the bitcode. Useful to avoid linking."), clEnumValN(Custom, "run-custom", "Use -exec-command to define a command to execute " - "the bitcode. Useful for cross-compilation."), - clEnumValEnd), + "the bitcode. Useful for cross-compilation.")), cl::init(AutoPick)); cl::opt<OutputType> SafeInterpreterSel( @@ -70,8 +69,7 @@ cl::opt<OutputType> SafeInterpreterSel( clEnumValN(RunLLC, "safe-run-llc", "Compile with LLC"), clEnumValN(Custom, "safe-run-custom", "Use -exec-command to define a command to execute " - "the bitcode. Useful for cross-compilation."), - clEnumValEnd), + "the bitcode. Useful for cross-compilation.")), cl::init(AutoPick)); cl::opt<std::string> SafeInterpreterPath( diff --git a/llvm/tools/lli/OrcLazyJIT.cpp b/llvm/tools/lli/OrcLazyJIT.cpp index de69a269887..40c9a5c4dc6 100644 --- a/llvm/tools/lli/OrcLazyJIT.cpp +++ b/llvm/tools/lli/OrcLazyJIT.cpp @@ -37,8 +37,7 @@ namespace { "mods-to-disk", "Dump modules to the current " "working directory. (WARNING: " - "will overwrite existing files)."), - clEnumValEnd), + "will overwrite existing files).")), cl::Hidden); cl::opt<bool> OrcInlineStubs("orc-lazy-inline-stubs", diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 00ae52d35e2..2bbd2287734 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -91,8 +91,7 @@ namespace { "Orc-based MCJIT replacement"), clEnumValN(JITKind::OrcLazy, "orc-lazy", - "Orc-based lazy JIT."), - clEnumValEnd)); + "Orc-based lazy JIT."))); // The MCJIT supports building for a target address space separate from // the JIT compilation process. Use a forked process and a copying @@ -194,8 +193,7 @@ namespace { clEnumValN(Reloc::PIC_, "pic", "Fully relocatable, position independent code"), clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", - "Relocatable external references, non-relocatable code"), - clEnumValEnd)); + "Relocatable external references, non-relocatable code"))); cl::opt<llvm::CodeModel::Model> CMModel("code-model", @@ -210,8 +208,7 @@ namespace { clEnumValN(CodeModel::Medium, "medium", "Medium code model"), clEnumValN(CodeModel::Large, "large", - "Large code model"), - clEnumValEnd)); + "Large code model"))); cl::opt<bool> GenerateSoftFloatCalls("soft-float", @@ -228,8 +225,7 @@ namespace { clEnumValN(FloatABI::Soft, "soft", "Soft float ABI (implied by -soft-float)"), clEnumValN(FloatABI::Hard, "hard", - "Hard float ABI (uses FP registers)"), - clEnumValEnd)); + "Hard float ABI (uses FP registers)"))); ExitOnError ExitOnErr; } diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp index 40e4a3a493c..b7cb95972d5 100644 --- a/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/llvm/tools/llvm-ar/llvm-ar.cpp @@ -93,7 +93,7 @@ static cl::opt<Format> FormatOpt("format", cl::desc("Archive format to create"), cl::values(clEnumValN(Default, "default", "default"), clEnumValN(GNU, "gnu", "gnu"), - clEnumValN(BSD, "bsd", "bsd"), clEnumValEnd)); + clEnumValN(BSD, "bsd", "bsd"))); static std::string Options; diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp index 96543bb6da2..b3457a9148d 100644 --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -485,8 +485,7 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { cl::values(clEnumValN(CoverageViewOptions::OutputFormat::Text, "text", "Text output"), clEnumValN(CoverageViewOptions::OutputFormat::HTML, "html", - "HTML output"), - clEnumValEnd), + "HTML output")), cl::init(CoverageViewOptions::OutputFormat::Text)); cl::opt<bool> FilenameEquivalence( diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index bbf36793e6d..429df622ef5 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -72,7 +72,7 @@ static cl::opt<DIDumpType> DumpType( ".debug_str_offsets.dwo"), clEnumValN(DIDT_CUIndex, "cu_index", ".debug_cu_index"), clEnumValN(DIDT_GdbIndex, "gdb_index", ".gdb_index"), - clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index"), clEnumValEnd)); + clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index"))); static void error(StringRef Filename, std::error_code EC) { if (!EC) diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index ddaedd04c93..483d5013233 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -102,8 +102,7 @@ cl::opt<ThinLTOModes> ThinLTOMode( "(requires -thinlto-index)."), clEnumValN(THINOPT, "optimize", "Perform ThinLTO optimizations."), clEnumValN(THINCODEGEN, "codegen", "CodeGen (expected to match llc)"), - clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end"), - clEnumValEnd)); + clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end"))); static cl::opt<std::string> ThinLTOIndex("thinlto-index", diff --git a/llvm/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp b/llvm/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp index df8e0112af5..e31ea762add 100644 --- a/llvm/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp +++ b/llvm/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp @@ -31,8 +31,7 @@ Action(cl::desc("Action to perform:"), cl::values(clEnumValN(AC_Assemble, "assemble", "Assemble a .s file (default)"), clEnumValN(AC_Disassemble, "disassemble", - "Disassemble strings of hex bytes"), - clEnumValEnd)); + "Disassemble strings of hex bytes"))); static cl::opt<std::string> TripleName("triple", cl::desc("Target triple to assemble for, " diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp index 78ad8765960..58eb33aa1f3 100644 --- a/llvm/tools/llvm-mc/llvm-mc.cpp +++ b/llvm/tools/llvm-mc/llvm-mc.cpp @@ -66,8 +66,7 @@ CompressDebugSections("compress-debug-sections", cl::ValueOptional, clEnumValN(DebugCompressionType::DCT_Zlib, "zlib", "Use zlib compression"), clEnumValN(DebugCompressionType::DCT_ZlibGnu, "zlib-gnu", - "Use zlib-gnu compression (deprecated)"), - clEnumValEnd)); + "Use zlib-gnu compression (deprecated)"))); static cl::opt<bool> ShowInst("show-inst", cl::desc("Show internal instruction representation")); @@ -105,8 +104,7 @@ FileType("filetype", cl::init(OFT_AssemblyFile), clEnumValN(OFT_Null, "null", "Don't emit anything (for timing purposes)"), clEnumValN(OFT_ObjectFile, "obj", - "Emit a native object ('.o') file"), - clEnumValEnd)); + "Emit a native object ('.o') file"))); static cl::list<std::string> IncludeDirs("I", cl::desc("Directory of include files"), @@ -148,8 +146,7 @@ CMModel("code-model", clEnumValN(CodeModel::Medium, "medium", "Medium code model"), clEnumValN(CodeModel::Large, "large", - "Large code model"), - clEnumValEnd)); + "Large code model"))); static cl::opt<bool> NoInitialTextSection("n", cl::desc("Don't assume assembly file starts " @@ -190,8 +187,7 @@ Action(cl::desc("Action to perform:"), clEnumValN(AC_Disassemble, "disassemble", "Disassemble strings of hex bytes"), clEnumValN(AC_MDisassemble, "mdis", - "Marked up disassembly of strings of hex bytes"), - clEnumValEnd)); + "Marked up disassembly of strings of hex bytes"))); static const Target *GetTarget(const char *ProgName) { // Figure out the target triple. diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index 936a5c36d7a..0477dd13e02 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -56,7 +56,7 @@ cl::opt<OutputFormatTy> OutputFormat( "format", cl::desc("Specify output format"), cl::values(clEnumVal(bsd, "BSD format"), clEnumVal(sysv, "System V format"), clEnumVal(posix, "POSIX.2 format"), - clEnumVal(darwin, "Darwin -m format"), clEnumValEnd), + clEnumVal(darwin, "Darwin -m format")), cl::init(bsd)); cl::alias OutputFormat2("f", cl::desc("Alias for --format"), cl::aliasopt(OutputFormat)); @@ -143,7 +143,7 @@ enum Radix { d, o, x }; cl::opt<Radix> AddressRadix("radix", cl::desc("Radix (o/d/x) for printing symbol Values"), cl::values(clEnumVal(d, "decimal"), clEnumVal(o, "octal"), - clEnumVal(x, "hexadecimal"), clEnumValEnd), + clEnumVal(x, "hexadecimal")), cl::init(x)); cl::alias RadixAlias("t", cl::desc("Alias for --radix"), cl::aliasopt(AddressRadix)); diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 9dbce9726f5..43a9a7aaacc 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -188,8 +188,7 @@ cl::opt<bool> PrintFaultMaps("fault-map-section", cl::opt<DIDumpType> llvm::DwarfDumpType( "dwarf", cl::init(DIDT_Null), cl::desc("Dump of dwarf debug sections:"), - cl::values(clEnumValN(DIDT_Frames, "frames", ".debug_frame"), - clEnumValEnd)); + cl::values(clEnumValN(DIDT_Frames, "frames", ".debug_frame"))); cl::opt<bool> PrintSource( "source", diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 059c4dc79c8..08f74d955c6 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -393,14 +393,13 @@ static int merge_main(int argc, const char *argv[]) { cl::opt<ProfileKinds> ProfileKind( cl::desc("Profile kind:"), cl::init(instr), cl::values(clEnumVal(instr, "Instrumentation profile (default)"), - clEnumVal(sample, "Sample profile"), clEnumValEnd)); + clEnumVal(sample, "Sample profile"))); cl::opt<ProfileFormat> OutputFormat( cl::desc("Format of output profile"), cl::init(PF_Binary), cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding (default)"), clEnumValN(PF_Text, "text", "Text encoding"), clEnumValN(PF_GCC, "gcc", - "GCC encoding (only meaningful for -sample)"), - clEnumValEnd)); + "GCC encoding (only meaningful for -sample)"))); cl::opt<bool> OutputSparse("sparse", cl::init(false), cl::desc("Generate a sparse profile (only meaningful for -instr)")); cl::opt<unsigned> NumThreads( @@ -622,7 +621,7 @@ static int show_main(int argc, const char *argv[]) { cl::opt<ProfileKinds> ProfileKind( cl::desc("Profile kind:"), cl::init(instr), cl::values(clEnumVal(instr, "Instrumentation profile (default)"), - clEnumVal(sample, "Sample profile"), clEnumValEnd)); + clEnumVal(sample, "Sample profile"))); cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n"); diff --git a/llvm/tools/llvm-readobj/llvm-readobj.cpp b/llvm/tools/llvm-readobj/llvm-readobj.cpp index ab51b64fd8c..caf44311a9c 100644 --- a/llvm/tools/llvm-readobj/llvm-readobj.cpp +++ b/llvm/tools/llvm-readobj/llvm-readobj.cpp @@ -264,7 +264,7 @@ namespace opts { cl::opt<OutputStyleTy> Output("elf-output-style", cl::desc("Specify ELF dump style"), cl::values(clEnumVal(LLVM, "LLVM default style"), - clEnumVal(GNU, "GNU readelf style"), clEnumValEnd), + clEnumVal(GNU, "GNU readelf style")), cl::init(LLVM)); } // namespace opts diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index f1b0e6d63c0..92c1ce6ab6a 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -66,8 +66,7 @@ Action(cl::desc("Action to perform:"), clEnumValN(AC_PrintObjectLineInfo, "printobjline", "Like -printlineinfo but does not load the object first"), clEnumValN(AC_Verify, "verify", - "Load, link and verify the resulting memory image."), - clEnumValEnd)); + "Load, link and verify the resulting memory image."))); static cl::opt<std::string> EntryPoint("entry", diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp index 3cf76cd8864..c274649190b 100644 --- a/llvm/tools/llvm-size/llvm-size.cpp +++ b/llvm/tools/llvm-size/llvm-size.cpp @@ -40,14 +40,14 @@ static cl::opt<OutputFormatTy> OutputFormat("format", cl::desc("Specify output format"), cl::values(clEnumVal(sysv, "System V format"), clEnumVal(berkeley, "Berkeley format"), - clEnumVal(darwin, "Darwin -m format"), clEnumValEnd), + clEnumVal(darwin, "Darwin -m format")), cl::init(berkeley)); static cl::opt<OutputFormatTy> OutputFormatShort( cl::desc("Specify output format"), cl::values(clEnumValN(sysv, "A", "System V format"), clEnumValN(berkeley, "B", "Berkeley format"), - clEnumValN(darwin, "m", "Darwin -m format"), clEnumValEnd), + clEnumValN(darwin, "m", "Darwin -m format")), cl::init(berkeley)); static bool BerkeleyHeaderPrinted = false; @@ -81,8 +81,7 @@ static cl::opt<RadixTy> RadixShort(cl::desc("Print size in radix:"), cl::values(clEnumValN(octal, "o", "Print size in octal"), clEnumValN(decimal, "d", "Print size in decimal"), - clEnumValN(hexadecimal, "x", "Print size in hexadecimal"), - clEnumValEnd), + clEnumValN(hexadecimal, "x", "Print size in hexadecimal")), cl::init(decimal)); static cl::opt<bool> diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp index 7ee4ba19603..fc37dea4c48 100644 --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -46,8 +46,7 @@ static cl::opt<FunctionNameKind> ClPrintFunctions( clEnumValN(FunctionNameKind::ShortName, "short", "print short function name"), clEnumValN(FunctionNameKind::LinkageName, "linkage", - "print function linkage name"), - clEnumValEnd)); + "print function linkage name"))); static cl::opt<bool> ClUseRelativeAddress("relative-address", cl::init(false), diff --git a/llvm/tools/sancov/sancov.cc b/llvm/tools/sancov/sancov.cc index 9479fe76758..8dd9ecc95ca 100644 --- a/llvm/tools/sancov/sancov.cc +++ b/llvm/tools/sancov/sancov.cc @@ -92,7 +92,7 @@ cl::opt<ActionType> Action( "REMOVED. Use -symbolize & coverage-report-server.py."), clEnumValN(SymbolizeAction, "symbolize", "Produces a symbolized JSON report from binary report."), - clEnumValN(MergeAction, "merge", "Merges reports."), clEnumValEnd)); + clEnumValN(MergeAction, "merge", "Merges reports."))); static cl::list<std::string> ClInputFiles(cl::Positional, cl::OneOrMore, |

