mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
convert a bunch of std::strings to use StringRef. This should eliminate
a massive number of temporary strings created when parsing a command line. More still left to eliminate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82318 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -21,18 +21,17 @@
|
|||||||
#define LLVM_SUPPORT_COMMANDLINE_H
|
#define LLVM_SUPPORT_COMMANDLINE_H
|
||||||
|
|
||||||
#include "llvm/Support/type_traits.h"
|
#include "llvm/Support/type_traits.h"
|
||||||
#include "llvm/Support/DataTypes.h"
|
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
|
#include "llvm/ADT/Twine.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
/// cl Namespace - This namespace contains all of the command line option
|
/// cl Namespace - This namespace contains all of the command line option
|
||||||
/// processing machinery. It is intentionally a short name to make qualified
|
/// processing machinery. It is intentionally a short name to make qualified
|
||||||
/// usage concise.
|
/// usage concise.
|
||||||
@@ -144,7 +143,7 @@ class Option {
|
|||||||
// argument and the program should exit.
|
// argument and the program should exit.
|
||||||
//
|
//
|
||||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||||
const std::string &Arg) = 0;
|
StringRef Arg) = 0;
|
||||||
|
|
||||||
virtual enum ValueExpected getValueExpectedFlagDefault() const {
|
virtual enum ValueExpected getValueExpectedFlagDefault() const {
|
||||||
return ValueOptional;
|
return ValueOptional;
|
||||||
@@ -215,8 +214,7 @@ protected:
|
|||||||
getOptionHiddenFlag() != 0 && "Not all default flags specified!");
|
getOptionHiddenFlag() != 0 && "Not all default flags specified!");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setNumAdditionalVals(unsigned n)
|
inline void setNumAdditionalVals(unsigned n) { AdditionalVals = n; }
|
||||||
{ AdditionalVals = n; }
|
|
||||||
public:
|
public:
|
||||||
// addArgument - Register this argument with the commandline system.
|
// addArgument - Register this argument with the commandline system.
|
||||||
//
|
//
|
||||||
@@ -237,10 +235,10 @@ public:
|
|||||||
// addOccurrence - Wrapper around handleOccurrence that enforces Flags
|
// addOccurrence - Wrapper around handleOccurrence that enforces Flags
|
||||||
//
|
//
|
||||||
bool addOccurrence(unsigned pos, const char *ArgName,
|
bool addOccurrence(unsigned pos, const char *ArgName,
|
||||||
const std::string &Value, bool MultiArg = false);
|
StringRef Value, bool MultiArg = false);
|
||||||
|
|
||||||
// Prints option name followed by message. Always returns true.
|
// Prints option name followed by message. Always returns true.
|
||||||
bool error(std::string Message, const char *ArgName = 0);
|
bool error(const Twine &Message, const char *ArgName = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline int getNumOccurrences() const { return NumOccurrences; }
|
inline int getNumOccurrences() const { return NumOccurrences; }
|
||||||
@@ -458,9 +456,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *ArgName, const std::string &Arg,
|
bool parse(Option &O, const char *ArgName, StringRef Arg, DataType &V) {
|
||||||
DataType &V) {
|
StringRef ArgVal;
|
||||||
std::string ArgVal;
|
|
||||||
if (hasArgStr)
|
if (hasArgStr)
|
||||||
ArgVal = Arg;
|
ArgVal = Arg;
|
||||||
else
|
else
|
||||||
@@ -468,7 +465,7 @@ public:
|
|||||||
|
|
||||||
for (unsigned i = 0, e = static_cast<unsigned>(Values.size());
|
for (unsigned i = 0, e = static_cast<unsigned>(Values.size());
|
||||||
i != e; ++i)
|
i != e; ++i)
|
||||||
if (ArgVal == Values[i].first) {
|
if (Values[i].first == ArgVal) {
|
||||||
V = Values[i].second.first;
|
V = Values[i].second.first;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -541,7 +538,7 @@ class parser<bool> : public basic_parser<bool> {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val);
|
bool parse(Option &O, const char *ArgName, StringRef Arg, bool &Val);
|
||||||
|
|
||||||
template <class Opt>
|
template <class Opt>
|
||||||
void initialize(Opt &O) {
|
void initialize(Opt &O) {
|
||||||
@@ -568,8 +565,7 @@ template<>
|
|||||||
class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
|
class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *ArgName, const std::string &Arg,
|
bool parse(Option &O, const char *ArgName, StringRef Arg, boolOrDefault &Val);
|
||||||
boolOrDefault &Val);
|
|
||||||
|
|
||||||
enum ValueExpected getValueExpectedFlagDefault() const {
|
enum ValueExpected getValueExpectedFlagDefault() const {
|
||||||
return ValueOptional;
|
return ValueOptional;
|
||||||
@@ -591,7 +587,7 @@ template<>
|
|||||||
class parser<int> : public basic_parser<int> {
|
class parser<int> : public basic_parser<int> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *ArgName, const std::string &Arg, int &Val);
|
bool parse(Option &O, const char *ArgName, StringRef Arg, int &Val);
|
||||||
|
|
||||||
// getValueName - Overload in subclass to provide a better default value.
|
// getValueName - Overload in subclass to provide a better default value.
|
||||||
virtual const char *getValueName() const { return "int"; }
|
virtual const char *getValueName() const { return "int"; }
|
||||||
@@ -610,7 +606,7 @@ template<>
|
|||||||
class parser<unsigned> : public basic_parser<unsigned> {
|
class parser<unsigned> : public basic_parser<unsigned> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *AN, const std::string &Arg, unsigned &Val);
|
bool parse(Option &O, const char *AN, StringRef Arg, unsigned &Val);
|
||||||
|
|
||||||
// getValueName - Overload in subclass to provide a better default value.
|
// getValueName - Overload in subclass to provide a better default value.
|
||||||
virtual const char *getValueName() const { return "uint"; }
|
virtual const char *getValueName() const { return "uint"; }
|
||||||
@@ -628,7 +624,7 @@ template<>
|
|||||||
class parser<double> : public basic_parser<double> {
|
class parser<double> : public basic_parser<double> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *AN, const std::string &Arg, double &Val);
|
bool parse(Option &O, const char *AN, StringRef Arg, double &Val);
|
||||||
|
|
||||||
// getValueName - Overload in subclass to provide a better default value.
|
// getValueName - Overload in subclass to provide a better default value.
|
||||||
virtual const char *getValueName() const { return "number"; }
|
virtual const char *getValueName() const { return "number"; }
|
||||||
@@ -646,7 +642,7 @@ template<>
|
|||||||
class parser<float> : public basic_parser<float> {
|
class parser<float> : public basic_parser<float> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &O, const char *AN, const std::string &Arg, float &Val);
|
bool parse(Option &O, const char *AN, StringRef Arg, float &Val);
|
||||||
|
|
||||||
// getValueName - Overload in subclass to provide a better default value.
|
// getValueName - Overload in subclass to provide a better default value.
|
||||||
virtual const char *getValueName() const { return "number"; }
|
virtual const char *getValueName() const { return "number"; }
|
||||||
@@ -664,9 +660,8 @@ template<>
|
|||||||
class parser<std::string> : public basic_parser<std::string> {
|
class parser<std::string> : public basic_parser<std::string> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &, const char *, const std::string &Arg,
|
bool parse(Option &, const char *, StringRef Arg, std::string &Value) {
|
||||||
std::string &Value) {
|
Value = Arg.str();
|
||||||
Value = Arg;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,8 +681,7 @@ template<>
|
|||||||
class parser<char> : public basic_parser<char> {
|
class parser<char> : public basic_parser<char> {
|
||||||
public:
|
public:
|
||||||
// parse - Return true on error.
|
// parse - Return true on error.
|
||||||
bool parse(Option &, const char *, const std::string &Arg,
|
bool parse(Option &, const char *, StringRef Arg, char &Value) {
|
||||||
char &Value) {
|
|
||||||
Value = Arg[0];
|
Value = Arg[0];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -834,7 +828,7 @@ class opt : public Option,
|
|||||||
ParserClass Parser;
|
ParserClass Parser;
|
||||||
|
|
||||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||||
const std::string &Arg) {
|
StringRef Arg) {
|
||||||
typename ParserClass::parser_data_type Val =
|
typename ParserClass::parser_data_type Val =
|
||||||
typename ParserClass::parser_data_type();
|
typename ParserClass::parser_data_type();
|
||||||
if (Parser.parse(*this, ArgName, Arg, Val))
|
if (Parser.parse(*this, ArgName, Arg, Val))
|
||||||
@@ -1007,7 +1001,7 @@ class list : public Option, public list_storage<DataType, Storage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||||
const std::string &Arg) {
|
StringRef Arg) {
|
||||||
typename ParserClass::parser_data_type Val =
|
typename ParserClass::parser_data_type Val =
|
||||||
typename ParserClass::parser_data_type();
|
typename ParserClass::parser_data_type();
|
||||||
if (Parser.parse(*this, ArgName, Arg, Val))
|
if (Parser.parse(*this, ArgName, Arg, Val))
|
||||||
@@ -1207,7 +1201,7 @@ class bits : public Option, public bits_storage<DataType, Storage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
virtual bool handleOccurrence(unsigned pos, const char *ArgName,
|
||||||
const std::string &Arg) {
|
StringRef Arg) {
|
||||||
typename ParserClass::parser_data_type Val =
|
typename ParserClass::parser_data_type Val =
|
||||||
typename ParserClass::parser_data_type();
|
typename ParserClass::parser_data_type();
|
||||||
if (Parser.parse(*this, ArgName, Arg, Val))
|
if (Parser.parse(*this, ArgName, Arg, Val))
|
||||||
@@ -1308,7 +1302,7 @@ public:
|
|||||||
class alias : public Option {
|
class alias : public Option {
|
||||||
Option *AliasFor;
|
Option *AliasFor;
|
||||||
virtual bool handleOccurrence(unsigned pos, const char * /*ArgName*/,
|
virtual bool handleOccurrence(unsigned pos, const char * /*ArgName*/,
|
||||||
const std::string &Arg) {
|
StringRef Arg) {
|
||||||
return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
|
return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
|
||||||
}
|
}
|
||||||
// Handle printing stuff...
|
// Handle printing stuff...
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "llvm/System/Path.h"
|
#include "llvm/System/Path.h"
|
||||||
#include "llvm/ADT/OwningPtr.h"
|
#include "llvm/ADT/OwningPtr.h"
|
||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
@@ -193,7 +194,7 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName,
|
|||||||
|
|
||||||
if (Value)
|
if (Value)
|
||||||
return Handler->error("does not allow a value! '" +
|
return Handler->error("does not allow a value! '" +
|
||||||
std::string(Value) + "' specified.");
|
Twine(Value) + "' specified.");
|
||||||
break;
|
break;
|
||||||
case ValueOptional:
|
case ValueOptional:
|
||||||
break;
|
break;
|
||||||
@@ -205,34 +206,31 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this isn't a multi-arg option, just run the handler.
|
// If this isn't a multi-arg option, just run the handler.
|
||||||
if (NumAdditionalVals == 0) {
|
if (NumAdditionalVals == 0)
|
||||||
return Handler->addOccurrence(i, ArgName, Value ? Value : "");
|
return Handler->addOccurrence(i, ArgName, Value ? Value : "");
|
||||||
}
|
|
||||||
// If it is, run the handle several times.
|
// If it is, run the handle several times.
|
||||||
else {
|
bool MultiArg = false;
|
||||||
bool MultiArg = false;
|
|
||||||
|
|
||||||
if (Value) {
|
if (Value) {
|
||||||
if (Handler->addOccurrence(i, ArgName, Value, MultiArg))
|
if (Handler->addOccurrence(i, ArgName, Value, MultiArg))
|
||||||
return true;
|
return true;
|
||||||
--NumAdditionalVals;
|
--NumAdditionalVals;
|
||||||
MultiArg = true;
|
MultiArg = true;
|
||||||
}
|
|
||||||
|
|
||||||
while (NumAdditionalVals > 0) {
|
|
||||||
|
|
||||||
if (i+1 < argc) {
|
|
||||||
Value = argv[++i];
|
|
||||||
} else {
|
|
||||||
return Handler->error("not enough values!");
|
|
||||||
}
|
|
||||||
if (Handler->addOccurrence(i, ArgName, Value, MultiArg))
|
|
||||||
return true;
|
|
||||||
MultiArg = true;
|
|
||||||
--NumAdditionalVals;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (NumAdditionalVals > 0) {
|
||||||
|
|
||||||
|
if (i+1 >= argc)
|
||||||
|
return Handler->error("not enough values!");
|
||||||
|
Value = argv[++i];
|
||||||
|
|
||||||
|
if (Handler->addOccurrence(i, ArgName, Value, MultiArg))
|
||||||
|
return true;
|
||||||
|
MultiArg = true;
|
||||||
|
--NumAdditionalVals;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ProvidePositionalOption(Option *Handler, const std::string &Arg,
|
static bool ProvidePositionalOption(Option *Handler, const std::string &Arg,
|
||||||
@@ -763,7 +761,7 @@ void cl::ParseCommandLineOptions(int argc, char **argv,
|
|||||||
// Option Base class implementation
|
// Option Base class implementation
|
||||||
//
|
//
|
||||||
|
|
||||||
bool Option::error(std::string Message, const char *ArgName) {
|
bool Option::error(const Twine &Message, const char *ArgName) {
|
||||||
if (ArgName == 0) ArgName = ArgStr;
|
if (ArgName == 0) ArgName = ArgStr;
|
||||||
if (ArgName[0] == 0)
|
if (ArgName[0] == 0)
|
||||||
errs() << HelpStr; // Be nice for positional arguments
|
errs() << HelpStr; // Be nice for positional arguments
|
||||||
@@ -775,8 +773,7 @@ bool Option::error(std::string Message, const char *ArgName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Option::addOccurrence(unsigned pos, const char *ArgName,
|
bool Option::addOccurrence(unsigned pos, const char *ArgName,
|
||||||
const std::string &Value,
|
StringRef Value, bool MultiArg) {
|
||||||
bool MultiArg) {
|
|
||||||
if (!MultiArg)
|
if (!MultiArg)
|
||||||
NumOccurrences++; // Increment the number of times we have been seen
|
NumOccurrences++; // Increment the number of times we have been seen
|
||||||
|
|
||||||
@@ -860,42 +857,47 @@ void basic_parser_impl::printOptionInfo(const Option &O,
|
|||||||
// parser<bool> implementation
|
// parser<bool> implementation
|
||||||
//
|
//
|
||||||
bool parser<bool>::parse(Option &O, const char *ArgName,
|
bool parser<bool>::parse(Option &O, const char *ArgName,
|
||||||
const std::string &Arg, bool &Value) {
|
StringRef Arg, bool &Value) {
|
||||||
if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
|
if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
|
||||||
Arg == "1") {
|
Arg == "1") {
|
||||||
Value = true;
|
Value = true;
|
||||||
} else if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") {
|
return false;
|
||||||
Value = false;
|
|
||||||
} else {
|
|
||||||
return O.error("'" + Arg +
|
|
||||||
"' is invalid value for boolean argument! Try 0 or 1");
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") {
|
||||||
|
Value = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return O.error("'" + Arg +
|
||||||
|
"' is invalid value for boolean argument! Try 0 or 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// parser<boolOrDefault> implementation
|
// parser<boolOrDefault> implementation
|
||||||
//
|
//
|
||||||
bool parser<boolOrDefault>::parse(Option &O, const char *ArgName,
|
bool parser<boolOrDefault>::parse(Option &O, const char *ArgName,
|
||||||
const std::string &Arg, boolOrDefault &Value) {
|
StringRef Arg, boolOrDefault &Value) {
|
||||||
if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
|
if (Arg == "" || Arg == "true" || Arg == "TRUE" || Arg == "True" ||
|
||||||
Arg == "1") {
|
Arg == "1") {
|
||||||
Value = BOU_TRUE;
|
Value = BOU_TRUE;
|
||||||
} else if (Arg == "false" || Arg == "FALSE"
|
return false;
|
||||||
|| Arg == "False" || Arg == "0") {
|
|
||||||
Value = BOU_FALSE;
|
|
||||||
} else {
|
|
||||||
return O.error("'" + Arg +
|
|
||||||
"' is invalid value for boolean argument! Try 0 or 1");
|
|
||||||
}
|
}
|
||||||
return false;
|
if (Arg == "false" || Arg == "FALSE" || Arg == "False" || Arg == "0") {
|
||||||
|
Value = BOU_FALSE;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return O.error("'" + Arg +
|
||||||
|
"' is invalid value for boolean argument! Try 0 or 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// parser<int> implementation
|
// parser<int> implementation
|
||||||
//
|
//
|
||||||
bool parser<int>::parse(Option &O, const char *ArgName,
|
bool parser<int>::parse(Option &O, const char *ArgName,
|
||||||
const std::string &Arg, int &Value) {
|
StringRef Arg, int &Value) {
|
||||||
char *End;
|
char *End;
|
||||||
Value = (int)strtol(Arg.c_str(), &End, 0);
|
// FIXME: Temporary.
|
||||||
|
std::string TMP = Arg.str();
|
||||||
|
Value = (int)strtol(TMP.c_str(), &End, 0);
|
||||||
if (*End != 0)
|
if (*End != 0)
|
||||||
return O.error("'" + Arg + "' value invalid for integer argument!");
|
return O.error("'" + Arg + "' value invalid for integer argument!");
|
||||||
return false;
|
return false;
|
||||||
@@ -904,10 +906,13 @@ bool parser<int>::parse(Option &O, const char *ArgName,
|
|||||||
// parser<unsigned> implementation
|
// parser<unsigned> implementation
|
||||||
//
|
//
|
||||||
bool parser<unsigned>::parse(Option &O, const char *ArgName,
|
bool parser<unsigned>::parse(Option &O, const char *ArgName,
|
||||||
const std::string &Arg, unsigned &Value) {
|
StringRef Arg, unsigned &Value) {
|
||||||
char *End;
|
char *End;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
unsigned long V = strtoul(Arg.c_str(), &End, 0);
|
|
||||||
|
// FIXME: Temporary.
|
||||||
|
std::string TMP = Arg.str();
|
||||||
|
unsigned long V = strtoul(TMP.c_str(), &End, 0);
|
||||||
Value = (unsigned)V;
|
Value = (unsigned)V;
|
||||||
if (((V == ULONG_MAX) && (errno == ERANGE))
|
if (((V == ULONG_MAX) && (errno == ERANGE))
|
||||||
|| (*End != 0)
|
|| (*End != 0)
|
||||||
@@ -918,8 +923,11 @@ bool parser<unsigned>::parse(Option &O, const char *ArgName,
|
|||||||
|
|
||||||
// parser<double>/parser<float> implementation
|
// parser<double>/parser<float> implementation
|
||||||
//
|
//
|
||||||
static bool parseDouble(Option &O, const std::string &Arg, double &Value) {
|
static bool parseDouble(Option &O, StringRef Arg, double &Value) {
|
||||||
const char *ArgStart = Arg.c_str();
|
// FIXME: Temporary.
|
||||||
|
std::string TMP = Arg.str();
|
||||||
|
|
||||||
|
const char *ArgStart = TMP.c_str();
|
||||||
char *End;
|
char *End;
|
||||||
Value = strtod(ArgStart, &End);
|
Value = strtod(ArgStart, &End);
|
||||||
if (*End != 0)
|
if (*End != 0)
|
||||||
@@ -928,12 +936,12 @@ static bool parseDouble(Option &O, const std::string &Arg, double &Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool parser<double>::parse(Option &O, const char *AN,
|
bool parser<double>::parse(Option &O, const char *AN,
|
||||||
const std::string &Arg, double &Val) {
|
StringRef Arg, double &Val) {
|
||||||
return parseDouble(O, Arg, Val);
|
return parseDouble(O, Arg, Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parser<float>::parse(Option &O, const char *AN,
|
bool parser<float>::parse(Option &O, const char *AN,
|
||||||
const std::string &Arg, float &Val) {
|
StringRef Arg, float &Val) {
|
||||||
double dVal;
|
double dVal;
|
||||||
if (parseDouble(O, Arg, dVal))
|
if (parseDouble(O, Arg, dVal))
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user