diff options
Diffstat (limited to 'include/llvm/Support/CommandLine.h')
| -rw-r--r-- | include/llvm/Support/CommandLine.h | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 379d06a65741..943d2df37708 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -33,7 +33,6 @@ namespace llvm { -class BumpPtrStringSaver; class StringSaver; /// cl Namespace - This namespace contains all of the command line option @@ -206,9 +205,9 @@ class Option { unsigned AdditionalVals; // Greater than 0 for multi-valued option. public: - const char *ArgStr; // The argument string itself (ex: "help", "o") - const char *HelpStr; // The descriptive text message for -help - const char *ValueStr; // String describing what the value of this option is + StringRef ArgStr; // The argument string itself (ex: "help", "o") + StringRef HelpStr; // The descriptive text message for -help + StringRef ValueStr; // String describing what the value of this option is OptionCategory *Category; // The Category this option belongs to bool FullyInitialized; // Has addArguemnt been called? @@ -229,14 +228,14 @@ public: inline unsigned getNumAdditionalVals() const { return AdditionalVals; } // hasArgStr - Return true if the argstr != "" - bool hasArgStr() const { return ArgStr[0] != 0; } + bool hasArgStr() const { return !ArgStr.empty(); } //-------------------------------------------------------------------------=== // Accessor functions set by OptionModifiers // - void setArgStr(const char *S); - void setDescription(const char *S) { HelpStr = S; } - void setValueStr(const char *S) { ValueStr = S; } + void setArgStr(StringRef S); + void setDescription(StringRef S) { HelpStr = S; } + void setValueStr(StringRef S) { ValueStr = S; } void setNumOccurrencesFlag(enum NumOccurrencesFlag Val) { Occurrences = Val; } void setValueExpectedFlag(enum ValueExpected Val) { Value = Val; } void setHiddenFlag(enum OptionHidden Val) { HiddenFlag = Val; } @@ -276,7 +275,7 @@ public: virtual void printOptionValue(size_t GlobalWidth, bool Force) const = 0; - virtual void getExtraOptionNames(SmallVectorImpl<const char *> &) {} + virtual void getExtraOptionNames(SmallVectorImpl<StringRef> &) {} // addOccurrence - Wrapper around handleOccurrence that enforces Flags. // @@ -606,7 +605,7 @@ public: void initialize() {} - void getExtraOptionNames(SmallVectorImpl<const char *> &OptionNames) { + void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) { // If there has been no argstr specified, that means that we need to add an // argument for every possible option. This ensures that our options are // vectored to us. @@ -715,14 +714,14 @@ public: // class basic_parser_impl { // non-template implementation of basic_parser<t> public: - basic_parser_impl(Option &O) {} + basic_parser_impl(Option &) {} enum ValueExpected getValueExpectedFlagDefault() const { return ValueRequired; } - void getExtraOptionNames(SmallVectorImpl<const char *> &) {} + void getExtraOptionNames(SmallVectorImpl<StringRef> &) {} void initialize() {} @@ -1206,8 +1205,7 @@ class opt : public Option, enum ValueExpected getValueExpectedFlagDefault() const override { return Parser.getValueExpectedFlagDefault(); } - void - getExtraOptionNames(SmallVectorImpl<const char *> &OptionNames) override { + void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override { return Parser.getExtraOptionNames(OptionNames); } @@ -1368,8 +1366,7 @@ class list : public Option, public list_storage<DataType, StorageClass> { enum ValueExpected getValueExpectedFlagDefault() const override { return Parser.getValueExpectedFlagDefault(); } - void - getExtraOptionNames(SmallVectorImpl<const char *> &OptionNames) override { + void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override { return Parser.getExtraOptionNames(OptionNames); } @@ -1508,8 +1505,7 @@ class bits : public Option, public bits_storage<DataType, Storage> { enum ValueExpected getValueExpectedFlagDefault() const override { return Parser.getValueExpectedFlagDefault(); } - void - getExtraOptionNames(SmallVectorImpl<const char *> &OptionNames) override { + void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override { return Parser.getExtraOptionNames(OptionNames); } |
