diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/Option | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/Option')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Option/ArgList.h | 8 | ||||
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Option/OptParser.td | 146 | ||||
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Option/OptTable.h | 52 | ||||
-rw-r--r-- | contrib/libs/llvm12/include/llvm/Option/Option.h | 16 |
4 files changed, 111 insertions, 111 deletions
diff --git a/contrib/libs/llvm12/include/llvm/Option/ArgList.h b/contrib/libs/llvm12/include/llvm/Option/ArgList.h index b6efeb641d..efb1880dde 100644 --- a/contrib/libs/llvm12/include/llvm/Option/ArgList.h +++ b/contrib/libs/llvm12/include/llvm/Option/ArgList.h @@ -419,10 +419,10 @@ public: return ArgStrings[Index]; } - void replaceArgString(unsigned Index, const Twine &S) { - ArgStrings[Index] = MakeArgString(S); - } - + void replaceArgString(unsigned Index, const Twine &S) { + ArgStrings[Index] = MakeArgString(S); + } + unsigned getNumInputArgStrings() const override { return NumInputArgStrings; } diff --git a/contrib/libs/llvm12/include/llvm/Option/OptParser.td b/contrib/libs/llvm12/include/llvm/Option/OptParser.td index 9a179c511b..ef4ac4e05e 100644 --- a/contrib/libs/llvm12/include/llvm/Option/OptParser.td +++ b/contrib/libs/llvm12/include/llvm/Option/OptParser.td @@ -13,7 +13,7 @@ // Define the kinds of options. -class OptionKind<string name, int precedence = 0, bit sentinel = false> { +class OptionKind<string name, int precedence = 0, bit sentinel = false> { string Name = name; // The kind precedence, kinds with lower precedence are matched first. int Precedence = precedence; @@ -24,9 +24,9 @@ class OptionKind<string name, int precedence = 0, bit sentinel = false> { // An option group. def KIND_GROUP : OptionKind<"Group">; // The input option kind. -def KIND_INPUT : OptionKind<"Input", 1, true>; +def KIND_INPUT : OptionKind<"Input", 1, true>; // The unknown option kind. -def KIND_UNKNOWN : OptionKind<"Unknown", 2, true>; +def KIND_UNKNOWN : OptionKind<"Unknown", 2, true>; // A flag with no values. def KIND_FLAG : OptionKind<"Flag">; // An option which prefixes its (single) value. @@ -97,19 +97,19 @@ class Option<list<string> prefixes, string name, OptionKind kind> { OptionGroup Group = ?; Option Alias = ?; list<string> AliasArgs = []; - code MacroPrefix = ""; + code MacroPrefix = ""; code KeyPath = ?; code DefaultValue = ?; - code ImpliedValue = ?; - code ImpliedCheck = "false"; - code ShouldParse = "true"; - bit ShouldAlwaysEmit = false; + code ImpliedValue = ?; + code ImpliedCheck = "false"; + code ShouldParse = "true"; + bit ShouldAlwaysEmit = false; code NormalizerRetTy = ?; code NormalizedValuesScope = ""; code Normalizer = ""; code Denormalizer = ""; - code ValueMerger = "mergeForwardValue"; - code ValueExtractor = "extractForwardValue"; + code ValueMerger = "mergeForwardValue"; + code ValueExtractor = "extractForwardValue"; list<code> NormalizedValues = ?; } @@ -146,75 +146,75 @@ class ValuesCode<code valuecode> { code ValuesCode = valuecode; } // Helpers for defining marshalling information. -class KeyPathAndMacro<string key_path_prefix, string key_path_base, - string macro_prefix = ""> { - code KeyPath = !strconcat(key_path_prefix, key_path_base); - code MacroPrefix = macro_prefix; -} - -def EmptyKPM : KeyPathAndMacro<"", "">; - -class ImpliedByAnyOf<list<string> key_paths, code value = "true"> { - code ImpliedCheck = !foldl("false", key_paths, accumulator, key_path, - !strconcat(accumulator, " || ", key_path)); - code ImpliedValue = value; -} - -class MarshallingInfo<KeyPathAndMacro kpm, code defaultvalue> { - code KeyPath = kpm.KeyPath; - code MacroPrefix = kpm.MacroPrefix; +class KeyPathAndMacro<string key_path_prefix, string key_path_base, + string macro_prefix = ""> { + code KeyPath = !strconcat(key_path_prefix, key_path_base); + code MacroPrefix = macro_prefix; +} + +def EmptyKPM : KeyPathAndMacro<"", "">; + +class ImpliedByAnyOf<list<string> key_paths, code value = "true"> { + code ImpliedCheck = !foldl("false", key_paths, accumulator, key_path, + !strconcat(accumulator, " || ", key_path)); + code ImpliedValue = value; +} + +class MarshallingInfo<KeyPathAndMacro kpm, code defaultvalue> { + code KeyPath = kpm.KeyPath; + code MacroPrefix = kpm.MacroPrefix; code DefaultValue = defaultvalue; } - -class MarshallingInfoString<KeyPathAndMacro kpm, code defaultvalue="std::string()"> - : MarshallingInfo<kpm, defaultvalue> { - code Normalizer = "normalizeString"; - code Denormalizer = "denormalizeString"; -} - -class MarshallingInfoStringInt<KeyPathAndMacro kpm, code defaultvalue="0", code type="unsigned"> - : MarshallingInfo<kpm, defaultvalue> { - code Normalizer = "normalizeStringIntegral<"#type#">"; - code Denormalizer = "denormalizeString"; -} - -class MarshallingInfoStringVector<KeyPathAndMacro kpm> - : MarshallingInfo<kpm, "std::vector<std::string>({})"> { - code Normalizer = "normalizeStringVector"; - code Denormalizer = "denormalizeStringVector"; -} - -class MarshallingInfoFlag<KeyPathAndMacro kpm, code defaultvalue = "false"> - : MarshallingInfo<kpm, defaultvalue> { - code Normalizer = "normalizeSimpleFlag"; - code Denormalizer = "denormalizeSimpleFlag"; -} - -class MarshallingInfoNegativeFlag<KeyPathAndMacro kpm, code defaultvalue = "true"> - : MarshallingInfo<kpm, defaultvalue> { - code Normalizer = "normalizeSimpleNegativeFlag"; - code Denormalizer = "denormalizeSimpleFlag"; -} - -class MarshallingInfoBitfieldFlag<KeyPathAndMacro kpm, code value> - : MarshallingInfoFlag<kpm, "0u"> { - code Normalizer = "makeFlagToValueNormalizer("#value#")"; - code ValueMerger = "mergeMaskValue"; - code ValueExtractor = "(extractMaskValue<unsigned, decltype("#value#"), "#value#">)"; + +class MarshallingInfoString<KeyPathAndMacro kpm, code defaultvalue="std::string()"> + : MarshallingInfo<kpm, defaultvalue> { + code Normalizer = "normalizeString"; + code Denormalizer = "denormalizeString"; } -// Marshalling info for booleans. Applied to the flag setting keypath to false. -class MarshallingInfoBooleanFlag<KeyPathAndMacro kpm, code defaultvalue, code value, code name, - code other_value, code other_name> - : MarshallingInfoFlag<kpm, defaultvalue> { - code Normalizer = "makeBooleanOptionNormalizer("#value#", "#other_value#", OPT_"#other_name#")"; - code Denormalizer = "makeBooleanOptionDenormalizer("#value#")"; +class MarshallingInfoStringInt<KeyPathAndMacro kpm, code defaultvalue="0", code type="unsigned"> + : MarshallingInfo<kpm, defaultvalue> { + code Normalizer = "normalizeStringIntegral<"#type#">"; + code Denormalizer = "denormalizeString"; } +class MarshallingInfoStringVector<KeyPathAndMacro kpm> + : MarshallingInfo<kpm, "std::vector<std::string>({})"> { + code Normalizer = "normalizeStringVector"; + code Denormalizer = "denormalizeStringVector"; +} + +class MarshallingInfoFlag<KeyPathAndMacro kpm, code defaultvalue = "false"> + : MarshallingInfo<kpm, defaultvalue> { + code Normalizer = "normalizeSimpleFlag"; + code Denormalizer = "denormalizeSimpleFlag"; +} + +class MarshallingInfoNegativeFlag<KeyPathAndMacro kpm, code defaultvalue = "true"> + : MarshallingInfo<kpm, defaultvalue> { + code Normalizer = "normalizeSimpleNegativeFlag"; + code Denormalizer = "denormalizeSimpleFlag"; +} + +class MarshallingInfoBitfieldFlag<KeyPathAndMacro kpm, code value> + : MarshallingInfoFlag<kpm, "0u"> { + code Normalizer = "makeFlagToValueNormalizer("#value#")"; + code ValueMerger = "mergeMaskValue"; + code ValueExtractor = "(extractMaskValue<unsigned, decltype("#value#"), "#value#">)"; +} + +// Marshalling info for booleans. Applied to the flag setting keypath to false. +class MarshallingInfoBooleanFlag<KeyPathAndMacro kpm, code defaultvalue, code value, code name, + code other_value, code other_name> + : MarshallingInfoFlag<kpm, defaultvalue> { + code Normalizer = "makeBooleanOptionNormalizer("#value#", "#other_value#", OPT_"#other_name#")"; + code Denormalizer = "makeBooleanOptionDenormalizer("#value#")"; +} + // Mixins for additional marshalling attributes. -class ShouldParseIf<code condition> { code ShouldParse = condition; } -class AlwaysEmit { bit ShouldAlwaysEmit = true; } +class ShouldParseIf<code condition> { code ShouldParse = condition; } +class AlwaysEmit { bit ShouldAlwaysEmit = true; } class Normalizer<code normalizer> { code Normalizer = normalizer; } class Denormalizer<code denormalizer> { code Denormalizer = denormalizer; } class NormalizedValuesScope<code scope> { code NormalizedValuesScope = scope; } @@ -223,8 +223,8 @@ class AutoNormalizeEnum { code Normalizer = "normalizeSimpleEnum"; code Denormalizer = "denormalizeSimpleEnum"; } -class ValueMerger<code merger> { code ValueMerger = merger; } -class ValueExtractor<code extractor> { code ValueExtractor = extractor; } +class ValueMerger<code merger> { code ValueMerger = merger; } +class ValueExtractor<code extractor> { code ValueExtractor = extractor; } // Predefined options. diff --git a/contrib/libs/llvm12/include/llvm/Option/OptTable.h b/contrib/libs/llvm12/include/llvm/Option/OptTable.h index f7553d2b4b..6bc5d4b66f 100644 --- a/contrib/libs/llvm12/include/llvm/Option/OptTable.h +++ b/contrib/libs/llvm12/include/llvm/Option/OptTable.h @@ -20,7 +20,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/Option/OptSpecifier.h" -#include "llvm/Support/StringSaver.h" +#include "llvm/Support/StringSaver.h" #include <cassert> #include <string> #include <vector> @@ -28,7 +28,7 @@ namespace llvm { class raw_ostream; -template <typename Fn> class function_ref; +template <typename Fn> class function_ref; namespace opt { @@ -57,7 +57,7 @@ public: unsigned ID; unsigned char Kind; unsigned char Param; - unsigned int Flags; + unsigned int Flags; unsigned short GroupID; unsigned short AliasID; const char *AliasArgs; @@ -68,8 +68,8 @@ private: /// The option information table. std::vector<Info> OptionInfos; bool IgnoreCase; - bool GroupedShortOptions = false; - const char *EnvVar = nullptr; + bool GroupedShortOptions = false; + const char *EnvVar = nullptr; unsigned TheInputOptionID = 0; unsigned TheUnknownOptionID = 0; @@ -90,8 +90,8 @@ private: return OptionInfos[id - 1]; } - Arg *parseOneArgGrouped(InputArgList &Args, unsigned &Index) const; - + Arg *parseOneArgGrouped(InputArgList &Args, unsigned &Index) const; + protected: OptTable(ArrayRef<Info> OptionInfos, bool IgnoreCase = false); @@ -133,12 +133,12 @@ public: return getInfo(id).MetaVar; } - /// Specify the environment variable where initial options should be read. - void setInitialOptionsFromEnvironment(const char *E) { EnvVar = E; } - - /// Support grouped short options. e.g. -ab represents -a -b. - void setGroupedShortOptions(bool Value) { GroupedShortOptions = Value; } - + /// Specify the environment variable where initial options should be read. + void setInitialOptionsFromEnvironment(const char *E) { EnvVar = E; } + + /// Support grouped short options. e.g. -ab represents -a -b. + void setGroupedShortOptions(bool Value) { GroupedShortOptions = Value; } + /// Find possible value for given flags. This is used for shell /// autocompletion. /// @@ -159,7 +159,7 @@ public: /// /// \return The vector of flags which start with Cur. std::vector<std::string> findByPrefix(StringRef Cur, - unsigned int DisableFlags) const; + unsigned int DisableFlags) const; /// Find the OptTable option that most closely matches the given string. /// @@ -232,18 +232,18 @@ public: unsigned &MissingArgCount, unsigned FlagsToInclude = 0, unsigned FlagsToExclude = 0) const; - /// A convenience helper which handles optional initial options populated from - /// an environment variable, expands response files recursively and parses - /// options. - /// - /// \param ErrorFn - Called on a formatted error message for missing arguments - /// or unknown options. - /// \return An InputArgList; on error this will contain all the options which - /// could be parsed. - InputArgList parseArgs(int Argc, char *const *Argv, OptSpecifier Unknown, - StringSaver &Saver, - function_ref<void(StringRef)> ErrorFn) const; - + /// A convenience helper which handles optional initial options populated from + /// an environment variable, expands response files recursively and parses + /// options. + /// + /// \param ErrorFn - Called on a formatted error message for missing arguments + /// or unknown options. + /// \return An InputArgList; on error this will contain all the options which + /// could be parsed. + InputArgList parseArgs(int Argc, char *const *Argv, OptSpecifier Unknown, + StringSaver &Saver, + function_ref<void(StringRef)> ErrorFn) const; + /// Render the help text for an option table. /// /// \param OS - The stream to write the help text to. diff --git a/contrib/libs/llvm12/include/llvm/Option/Option.h b/contrib/libs/llvm12/include/llvm/Option/Option.h index 6bc4436754..87b0505e8a 100644 --- a/contrib/libs/llvm12/include/llvm/Option/Option.h +++ b/contrib/libs/llvm12/include/llvm/Option/Option.h @@ -220,16 +220,16 @@ public: /// Index to the position where argument parsing should resume /// (even if the argument is missing values). /// - /// \p CurArg The argument to be matched. It may be shorter than the - /// underlying storage to represent a Joined argument. - /// \p GroupedShortOption If true, we are handling the fallback case of - /// parsing a prefix of the current argument as a short option. - Arg *accept(const ArgList &Args, StringRef CurArg, bool GroupedShortOption, - unsigned &Index) const; + /// \p CurArg The argument to be matched. It may be shorter than the + /// underlying storage to represent a Joined argument. + /// \p GroupedShortOption If true, we are handling the fallback case of + /// parsing a prefix of the current argument as a short option. + Arg *accept(const ArgList &Args, StringRef CurArg, bool GroupedShortOption, + unsigned &Index) const; private: - Arg *acceptInternal(const ArgList &Args, StringRef CurArg, - unsigned &Index) const; + Arg *acceptInternal(const ArgList &Args, StringRef CurArg, + unsigned &Index) const; public: void print(raw_ostream &O) const; |