Index: llvm/trunk/include/llvm/Support/CommandLine.h =================================================================== --- llvm/trunk/include/llvm/Support/CommandLine.h +++ llvm/trunk/include/llvm/Support/CommandLine.h @@ -973,6 +973,29 @@ extern template class basic_parser; //-------------------------------------------------- +// parser +// +template <> +class parser final : public basic_parser { +public: + parser(Option &O) : basic_parser(O) {} + + // parse - Return true on error. + bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long &Val); + + // getValueName - Overload in subclass to provide a better default value. + StringRef getValueName() const override { return "ulong"; } + + void printOptionDiff(const Option &O, unsigned long V, OptVal Default, + size_t GlobalWidth) const; + + // An out-of-line virtual method to provide a 'home' for this class. + void anchor() override; +}; + +extern template class basic_parser; + +//-------------------------------------------------- // parser // template <> @@ -986,7 +1009,7 @@ unsigned long long &Val); // getValueName - Overload in subclass to provide a better default value. - StringRef getValueName() const override { return "uint"; } + StringRef getValueName() const override { return "ulong"; } void printOptionDiff(const Option &O, unsigned long long V, OptVal Default, size_t GlobalWidth) const; Index: llvm/trunk/lib/Support/CommandLine.cpp =================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp +++ llvm/trunk/lib/Support/CommandLine.cpp @@ -54,6 +54,7 @@ template class basic_parser; template class basic_parser; template class basic_parser; +template class basic_parser; template class basic_parser; template class basic_parser; template class basic_parser; @@ -78,6 +79,7 @@ void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} +void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} @@ -1663,6 +1665,16 @@ return false; } +// parser implementation +// +bool parser::parse(Option &O, StringRef ArgName, StringRef Arg, + unsigned long &Value) { + + if (Arg.getAsInteger(0, Value)) + return O.error("'" + Arg + "' value invalid for ulong argument!"); + return false; +} + // parser implementation // bool parser::parse(Option &O, StringRef ArgName, @@ -1670,7 +1682,7 @@ unsigned long long &Value) { if (Arg.getAsInteger(0, Value)) - return O.error("'" + Arg + "' value invalid for uint argument!"); + return O.error("'" + Arg + "' value invalid for ullong argument!"); return false; } @@ -1851,6 +1863,7 @@ PRINT_OPT_DIFF(boolOrDefault) PRINT_OPT_DIFF(int) PRINT_OPT_DIFF(unsigned) +PRINT_OPT_DIFF(unsigned long) PRINT_OPT_DIFF(unsigned long long) PRINT_OPT_DIFF(double) PRINT_OPT_DIFF(float) Index: llvm/trunk/lib/Support/RandomNumberGenerator.cpp =================================================================== --- llvm/trunk/lib/Support/RandomNumberGenerator.cpp +++ llvm/trunk/lib/Support/RandomNumberGenerator.cpp @@ -26,13 +26,9 @@ #define DEBUG_TYPE "rng" -// Tracking BUG: 19665 -// http://llvm.org/bugs/show_bug.cgi?id=19665 -// -// Do not change to cl::opt since this silently breaks argument parsing. -static cl::opt - Seed("rng-seed", cl::value_desc("seed"), cl::Hidden, - cl::desc("Seed for the random number generator"), cl::init(0)); +static cl::opt Seed("rng-seed", cl::value_desc("seed"), cl::Hidden, + cl::desc("Seed for the random number generator"), + cl::init(0)); RandomNumberGenerator::RandomNumberGenerator(StringRef Salt) { LLVM_DEBUG(if (Seed == 0) dbgs() Index: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -321,10 +321,10 @@ cl::desc("scale of asan shadow mapping"), cl::Hidden, cl::init(0)); -static cl::opt ClMappingOffset( - "asan-mapping-offset", - cl::desc("offset of asan shadow mapping [EXPERIMENTAL]"), cl::Hidden, - cl::init(0)); +static cl::opt + ClMappingOffset("asan-mapping-offset", + cl::desc("offset of asan shadow mapping [EXPERIMENTAL]"), + cl::Hidden, cl::init(0)); // Optimization flags. Not user visible, used mostly for testing // and benchmarking the tool. Index: llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp @@ -124,10 +124,10 @@ // is accessed. The shadow mapping looks like: // Shadow = (Mem >> scale) + offset -static cl::opt ClMappingOffset( - "hwasan-mapping-offset", - cl::desc("HWASan shadow mapping offset [EXPERIMENTAL]"), cl::Hidden, - cl::init(0)); +static cl::opt + ClMappingOffset("hwasan-mapping-offset", + cl::desc("HWASan shadow mapping offset [EXPERIMENTAL]"), + cl::Hidden, cl::init(0)); static cl::opt ClWithIfunc("hwasan-with-ifunc", Index: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -304,21 +304,21 @@ // These options allow to specify custom memory map parameters // See MemoryMapParams for details. -static cl::opt ClAndMask("msan-and-mask", - cl::desc("Define custom MSan AndMask"), - cl::Hidden, cl::init(0)); - -static cl::opt ClXorMask("msan-xor-mask", - cl::desc("Define custom MSan XorMask"), - cl::Hidden, cl::init(0)); - -static cl::opt ClShadowBase("msan-shadow-base", - cl::desc("Define custom MSan ShadowBase"), - cl::Hidden, cl::init(0)); - -static cl::opt ClOriginBase("msan-origin-base", - cl::desc("Define custom MSan OriginBase"), - cl::Hidden, cl::init(0)); +static cl::opt ClAndMask("msan-and-mask", + cl::desc("Define custom MSan AndMask"), + cl::Hidden, cl::init(0)); + +static cl::opt ClXorMask("msan-xor-mask", + cl::desc("Define custom MSan XorMask"), + cl::Hidden, cl::init(0)); + +static cl::opt ClShadowBase("msan-shadow-base", + cl::desc("Define custom MSan ShadowBase"), + cl::Hidden, cl::init(0)); + +static cl::opt ClOriginBase("msan-origin-base", + cl::desc("Define custom MSan OriginBase"), + cl::Hidden, cl::init(0)); static const char *const kMsanModuleCtorName = "msan.module_ctor"; static const char *const kMsanInitName = "__msan_init"; Index: llvm/trunk/tools/llvm-cfi-verify/lib/GraphBuilder.h =================================================================== --- llvm/trunk/tools/llvm-cfi-verify/lib/GraphBuilder.h +++ llvm/trunk/tools/llvm-cfi-verify/lib/GraphBuilder.h @@ -46,8 +46,8 @@ namespace llvm { namespace cfi_verify { -extern unsigned long long SearchLengthForUndef; -extern unsigned long long SearchLengthForConditionalBranch; +extern uint64_t SearchLengthForUndef; +extern uint64_t SearchLengthForConditionalBranch; struct ConditionalBranchNode { uint64_t Address; Index: llvm/trunk/tools/llvm-cfi-verify/lib/GraphBuilder.cpp =================================================================== --- llvm/trunk/tools/llvm-cfi-verify/lib/GraphBuilder.cpp +++ llvm/trunk/tools/llvm-cfi-verify/lib/GraphBuilder.cpp @@ -38,17 +38,17 @@ namespace llvm { namespace cfi_verify { -unsigned long long SearchLengthForUndef; -unsigned long long SearchLengthForConditionalBranch; +uint64_t SearchLengthForUndef; +uint64_t SearchLengthForConditionalBranch; -static cl::opt SearchLengthForUndefArg( +static cl::opt SearchLengthForUndefArg( "search-length-undef", cl::desc("Specify the maximum amount of instructions " "to inspect when searching for an undefined " "instruction from a conditional branch."), cl::location(SearchLengthForUndef), cl::init(2)); -static cl::opt SearchLengthForConditionalBranchArg( +static cl::opt SearchLengthForConditionalBranchArg( "search-length-cb", cl::desc("Specify the maximum amount of instructions " "to inspect when searching for a conditional " Index: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp =================================================================== --- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -154,7 +154,8 @@ "the -regex option is interpreted as a regular expression."), value_desc("pattern"), cat(DwarfDumpCategory)); static alias NameAlias("n", desc("Alias for -name"), aliasopt(Name)); -static opt Lookup("lookup", +static opt + Lookup("lookup", desc("Lookup
in the debug information and print out any " "available file, function, block and line table details."), value_desc("address"), cat(DwarfDumpCategory)); Index: llvm/trunk/tools/llvm-lto/llvm-lto.cpp =================================================================== --- llvm/trunk/tools/llvm-lto/llvm-lto.cpp +++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp @@ -157,8 +157,8 @@ ThinLTOCachePruningInterval("thinlto-cache-pruning-interval", cl::init(1200), cl::desc("Set ThinLTO cache pruning interval.")); -static cl::opt - ThinLTOCacheMaxSizeBytes("thinlto-cache-max-size-bytes", +static cl::opt ThinLTOCacheMaxSizeBytes( + "thinlto-cache-max-size-bytes", cl::desc("Set ThinLTO cache pruning directory maximum size in bytes.")); static cl::opt Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp +++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp @@ -87,7 +87,7 @@ extern cl::opt UniversalHeaders; extern cl::opt WeakBind; -static cl::opt AdjustVMA( +static cl::opt AdjustVMA( "adjust-vma", cl::desc("Increase the displayed address by the specified offset"), cl::value_desc("offset"), cl::init(0)); @@ -271,12 +271,13 @@ cl::NotHidden, cl::Grouping, cl::aliasopt(PrintSource)); -static cl::opt +static cl::opt StartAddress("start-address", cl::desc("Disassemble beginning at address"), cl::value_desc("address"), cl::init(0)); -static cl::opt - StopAddress("stop-address", cl::desc("Stop disassembly at address"), - cl::value_desc("address"), cl::init(UINT64_MAX)); +static cl::opt StopAddress("stop-address", + cl::desc("Stop disassembly at address"), + cl::value_desc("address"), + cl::init(UINT64_MAX)); cl::opt SymbolTable("syms", cl::desc("Display the symbol table")); static cl::alias SymbolTableShort("t", cl::desc("Alias for --syms"), Index: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp =================================================================== --- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -91,35 +91,28 @@ cl::desc("File containing RuntimeDyld verifier checks."), cl::ZeroOrMore); -// Tracking BUG: 19665 -// http://llvm.org/bugs/show_bug.cgi?id=19665 -// -// Do not change these options to cl::opt since this silently breaks -// argument parsing. -static cl::opt -PreallocMemory("preallocate", - cl::desc("Allocate memory upfront rather than on-demand"), - cl::init(0)); - -static cl::opt -TargetAddrStart("target-addr-start", - cl::desc("For -verify only: start of phony target address " - "range."), - cl::init(4096), // Start at "page 1" - no allocating at "null". - cl::Hidden); - -static cl::opt -TargetAddrEnd("target-addr-end", - cl::desc("For -verify only: end of phony target address range."), - cl::init(~0ULL), - cl::Hidden); - -static cl::opt -TargetSectionSep("target-section-sep", - cl::desc("For -verify only: Separation between sections in " - "phony target address space."), - cl::init(0), - cl::Hidden); +static cl::opt + PreallocMemory("preallocate", + cl::desc("Allocate memory upfront rather than on-demand"), + cl::init(0)); + +static cl::opt TargetAddrStart( + "target-addr-start", + cl::desc("For -verify only: start of phony target address " + "range."), + cl::init(4096), // Start at "page 1" - no allocating at "null". + cl::Hidden); + +static cl::opt TargetAddrEnd( + "target-addr-end", + cl::desc("For -verify only: end of phony target address range."), + cl::init(~0ULL), cl::Hidden); + +static cl::opt TargetSectionSep( + "target-section-sep", + cl::desc("For -verify only: Separation between sections in " + "phony target address space."), + cl::init(0), cl::Hidden); static cl::list SpecificSectionMappings("map-section", Index: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp =================================================================== --- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -134,7 +134,7 @@ cl::desc("Print verbose line info")); // -adjust-vma -static cl::opt +static cl::opt ClAdjustVMA("adjust-vma", cl::init(0), cl::value_desc("offset"), cl::desc("Add specified offset to object file addresses"));