mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms
Summary: And migrate opt<unsigned long long> to opt<uint64_t> Fixes PR19665 Differential Revision: https://reviews.llvm.org/D60933 llvm-svn: 359068
This commit is contained in:
parent
f33f2288a0
commit
ab080c1a07
@ -972,6 +972,29 @@ public:
|
||||
|
||||
extern template class basic_parser<unsigned>;
|
||||
|
||||
//--------------------------------------------------
|
||||
// parser<unsigned long>
|
||||
//
|
||||
template <>
|
||||
class parser<unsigned long> final : public basic_parser<unsigned long> {
|
||||
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<unsigned long>;
|
||||
|
||||
//--------------------------------------------------
|
||||
// parser<unsigned long long>
|
||||
//
|
||||
@ -986,7 +1009,7 @@ public:
|
||||
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;
|
||||
|
@ -54,6 +54,7 @@ template class basic_parser<bool>;
|
||||
template class basic_parser<boolOrDefault>;
|
||||
template class basic_parser<int>;
|
||||
template class basic_parser<unsigned>;
|
||||
template class basic_parser<unsigned long>;
|
||||
template class basic_parser<unsigned long long>;
|
||||
template class basic_parser<double>;
|
||||
template class basic_parser<float>;
|
||||
@ -78,6 +79,7 @@ void parser<bool>::anchor() {}
|
||||
void parser<boolOrDefault>::anchor() {}
|
||||
void parser<int>::anchor() {}
|
||||
void parser<unsigned>::anchor() {}
|
||||
void parser<unsigned long>::anchor() {}
|
||||
void parser<unsigned long long>::anchor() {}
|
||||
void parser<double>::anchor() {}
|
||||
void parser<float>::anchor() {}
|
||||
@ -1663,6 +1665,16 @@ bool parser<unsigned>::parse(Option &O, StringRef ArgName, StringRef Arg,
|
||||
return false;
|
||||
}
|
||||
|
||||
// parser<unsigned long> implementation
|
||||
//
|
||||
bool parser<unsigned long>::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<unsigned long long> implementation
|
||||
//
|
||||
bool parser<unsigned long long>::parse(Option &O, StringRef ArgName,
|
||||
@ -1670,7 +1682,7 @@ bool parser<unsigned long long>::parse(Option &O, StringRef ArgName,
|
||||
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(bool)
|
||||
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)
|
||||
|
@ -26,13 +26,9 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "rng"
|
||||
|
||||
// Tracking BUG: 19665
|
||||
// http://llvm.org/bugs/show_bug.cgi?id=19665
|
||||
//
|
||||
// Do not change to cl::opt<uint64_t> since this silently breaks argument parsing.
|
||||
static cl::opt<unsigned long long>
|
||||
Seed("rng-seed", cl::value_desc("seed"), cl::Hidden,
|
||||
cl::desc("Seed for the random number generator"), cl::init(0));
|
||||
static cl::opt<uint64_t> 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()
|
||||
|
@ -321,10 +321,10 @@ static cl::opt<int> ClMappingScale("asan-mapping-scale",
|
||||
cl::desc("scale of asan shadow mapping"),
|
||||
cl::Hidden, cl::init(0));
|
||||
|
||||
static cl::opt<unsigned long long> ClMappingOffset(
|
||||
"asan-mapping-offset",
|
||||
cl::desc("offset of asan shadow mapping [EXPERIMENTAL]"), cl::Hidden,
|
||||
cl::init(0));
|
||||
static cl::opt<uint64_t>
|
||||
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.
|
||||
|
@ -124,10 +124,10 @@ static cl::opt<bool> ClEnableKhwasan(
|
||||
// is accessed. The shadow mapping looks like:
|
||||
// Shadow = (Mem >> scale) + offset
|
||||
|
||||
static cl::opt<unsigned long long> ClMappingOffset(
|
||||
"hwasan-mapping-offset",
|
||||
cl::desc("HWASan shadow mapping offset [EXPERIMENTAL]"), cl::Hidden,
|
||||
cl::init(0));
|
||||
static cl::opt<uint64_t>
|
||||
ClMappingOffset("hwasan-mapping-offset",
|
||||
cl::desc("HWASan shadow mapping offset [EXPERIMENTAL]"),
|
||||
cl::Hidden, cl::init(0));
|
||||
|
||||
static cl::opt<bool>
|
||||
ClWithIfunc("hwasan-with-ifunc",
|
||||
|
@ -304,21 +304,21 @@ static cl::opt<bool> ClWithComdat("msan-with-comdat",
|
||||
|
||||
// These options allow to specify custom memory map parameters
|
||||
// See MemoryMapParams for details.
|
||||
static cl::opt<unsigned long long> ClAndMask("msan-and-mask",
|
||||
cl::desc("Define custom MSan AndMask"),
|
||||
cl::Hidden, cl::init(0));
|
||||
static cl::opt<uint64_t> ClAndMask("msan-and-mask",
|
||||
cl::desc("Define custom MSan AndMask"),
|
||||
cl::Hidden, cl::init(0));
|
||||
|
||||
static cl::opt<unsigned long long> ClXorMask("msan-xor-mask",
|
||||
cl::desc("Define custom MSan XorMask"),
|
||||
cl::Hidden, cl::init(0));
|
||||
static cl::opt<uint64_t> ClXorMask("msan-xor-mask",
|
||||
cl::desc("Define custom MSan XorMask"),
|
||||
cl::Hidden, cl::init(0));
|
||||
|
||||
static cl::opt<unsigned long long> ClShadowBase("msan-shadow-base",
|
||||
cl::desc("Define custom MSan ShadowBase"),
|
||||
cl::Hidden, cl::init(0));
|
||||
static cl::opt<uint64_t> ClShadowBase("msan-shadow-base",
|
||||
cl::desc("Define custom MSan ShadowBase"),
|
||||
cl::Hidden, cl::init(0));
|
||||
|
||||
static cl::opt<unsigned long long> ClOriginBase("msan-origin-base",
|
||||
cl::desc("Define custom MSan OriginBase"),
|
||||
cl::Hidden, cl::init(0));
|
||||
static cl::opt<uint64_t> 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";
|
||||
|
@ -38,17 +38,17 @@ using Instr = llvm::cfi_verify::FileAnalysis::Instr;
|
||||
namespace llvm {
|
||||
namespace cfi_verify {
|
||||
|
||||
unsigned long long SearchLengthForUndef;
|
||||
unsigned long long SearchLengthForConditionalBranch;
|
||||
uint64_t SearchLengthForUndef;
|
||||
uint64_t SearchLengthForConditionalBranch;
|
||||
|
||||
static cl::opt<unsigned long long, true> SearchLengthForUndefArg(
|
||||
static cl::opt<uint64_t, true> 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<unsigned long long, true> SearchLengthForConditionalBranchArg(
|
||||
static cl::opt<uint64_t, true> SearchLengthForConditionalBranchArg(
|
||||
"search-length-cb",
|
||||
cl::desc("Specify the maximum amount of instructions "
|
||||
"to inspect when searching for a conditional "
|
||||
|
@ -46,8 +46,8 @@ using Instr = llvm::cfi_verify::FileAnalysis::Instr;
|
||||
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;
|
||||
|
@ -154,7 +154,8 @@ static list<std::string> Name(
|
||||
"the -regex option <pattern> is interpreted as a regular expression."),
|
||||
value_desc("pattern"), cat(DwarfDumpCategory));
|
||||
static alias NameAlias("n", desc("Alias for -name"), aliasopt(Name));
|
||||
static opt<unsigned long long> Lookup("lookup",
|
||||
static opt<uint64_t>
|
||||
Lookup("lookup",
|
||||
desc("Lookup <address> in the debug information and print out any "
|
||||
"available file, function, block and line table details."),
|
||||
value_desc("address"), cat(DwarfDumpCategory));
|
||||
|
@ -157,8 +157,8 @@ static cl::opt<int>
|
||||
ThinLTOCachePruningInterval("thinlto-cache-pruning-interval",
|
||||
cl::init(1200), cl::desc("Set ThinLTO cache pruning interval."));
|
||||
|
||||
static cl::opt<unsigned long long>
|
||||
ThinLTOCacheMaxSizeBytes("thinlto-cache-max-size-bytes",
|
||||
static cl::opt<uint64_t> ThinLTOCacheMaxSizeBytes(
|
||||
"thinlto-cache-max-size-bytes",
|
||||
cl::desc("Set ThinLTO cache pruning directory maximum size in bytes."));
|
||||
|
||||
static cl::opt<int>
|
||||
|
@ -87,7 +87,7 @@ extern cl::opt<bool> Rebase;
|
||||
extern cl::opt<bool> UniversalHeaders;
|
||||
extern cl::opt<bool> WeakBind;
|
||||
|
||||
static cl::opt<unsigned long long> AdjustVMA(
|
||||
static cl::opt<uint64_t> AdjustVMA(
|
||||
"adjust-vma",
|
||||
cl::desc("Increase the displayed address by the specified offset"),
|
||||
cl::value_desc("offset"), cl::init(0));
|
||||
@ -271,12 +271,13 @@ static cl::alias PrintSourceShort("S", cl::desc("Alias for -source"),
|
||||
cl::NotHidden, cl::Grouping,
|
||||
cl::aliasopt(PrintSource));
|
||||
|
||||
static cl::opt<unsigned long long>
|
||||
static cl::opt<uint64_t>
|
||||
StartAddress("start-address", cl::desc("Disassemble beginning at address"),
|
||||
cl::value_desc("address"), cl::init(0));
|
||||
static cl::opt<unsigned long long>
|
||||
StopAddress("stop-address", cl::desc("Stop disassembly at address"),
|
||||
cl::value_desc("address"), cl::init(UINT64_MAX));
|
||||
static cl::opt<uint64_t> StopAddress("stop-address",
|
||||
cl::desc("Stop disassembly at address"),
|
||||
cl::value_desc("address"),
|
||||
cl::init(UINT64_MAX));
|
||||
|
||||
cl::opt<bool> SymbolTable("syms", cl::desc("Display the symbol table"));
|
||||
static cl::alias SymbolTableShort("t", cl::desc("Alias for --syms"),
|
||||
|
@ -91,35 +91,28 @@ CheckFiles("check",
|
||||
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<uint64_t> since this silently breaks
|
||||
// argument parsing.
|
||||
static cl::opt<unsigned long long>
|
||||
PreallocMemory("preallocate",
|
||||
cl::desc("Allocate memory upfront rather than on-demand"),
|
||||
cl::init(0));
|
||||
static cl::opt<uint64_t>
|
||||
PreallocMemory("preallocate",
|
||||
cl::desc("Allocate memory upfront rather than on-demand"),
|
||||
cl::init(0));
|
||||
|
||||
static cl::opt<unsigned long long>
|
||||
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<uint64_t> 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<unsigned long long>
|
||||
TargetAddrEnd("target-addr-end",
|
||||
cl::desc("For -verify only: end of phony target address range."),
|
||||
cl::init(~0ULL),
|
||||
cl::Hidden);
|
||||
static cl::opt<uint64_t> TargetAddrEnd(
|
||||
"target-addr-end",
|
||||
cl::desc("For -verify only: end of phony target address range."),
|
||||
cl::init(~0ULL), cl::Hidden);
|
||||
|
||||
static cl::opt<unsigned long long>
|
||||
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<uint64_t> 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<std::string>
|
||||
SpecificSectionMappings("map-section",
|
||||
|
@ -134,7 +134,7 @@ static cl::opt<bool> ClVerbose("verbose", cl::init(false),
|
||||
cl::desc("Print verbose line info"));
|
||||
|
||||
// -adjust-vma
|
||||
static cl::opt<unsigned long long>
|
||||
static cl::opt<uint64_t>
|
||||
ClAdjustVMA("adjust-vma", cl::init(0), cl::value_desc("offset"),
|
||||
cl::desc("Add specified offset to object file addresses"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user