aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/lib/Support/CommandLine.cpp
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Support/CommandLine.cpp')
-rw-r--r--contrib/libs/llvm12/lib/Support/CommandLine.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/contrib/libs/llvm12/lib/Support/CommandLine.cpp b/contrib/libs/llvm12/lib/Support/CommandLine.cpp
index 123a23a524..fef6bc3687 100644
--- a/contrib/libs/llvm12/lib/Support/CommandLine.cpp
+++ b/contrib/libs/llvm12/lib/Support/CommandLine.cpp
@@ -464,7 +464,7 @@ void Option::addCategory(OptionCategory &C) {
// must be explicitly added if you want multiple categories that include it.
if (&C != &GeneralCategory && Categories[0] == &GeneralCategory)
Categories[0] = &C;
- else if (!is_contained(Categories, &C))
+ else if (!is_contained(Categories, &C))
Categories.push_back(&C);
}
@@ -531,7 +531,7 @@ Option *CommandLineParser::LookupOption(SubCommand &Sub, StringRef &Arg,
// If we have an equals sign, remember the value.
if (EqualPos == StringRef::npos) {
// Look up the option.
- return Sub.OptionsMap.lookup(Arg);
+ return Sub.OptionsMap.lookup(Arg);
}
// If the argument before the = is a valid option name and the option allows
@@ -828,7 +828,7 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringSaver &Saver,
// Consume runs of whitespace.
if (Token.empty()) {
while (I != E && isWhitespace(Src[I])) {
- // Mark the end of lines in response files.
+ // Mark the end of lines in response files.
if (MarkEOLs && Src[I] == '\n')
NewArgv.push_back(nullptr);
++I;
@@ -865,9 +865,9 @@ void cl::TokenizeGNUCommandLine(StringRef Src, StringSaver &Saver,
if (isWhitespace(C)) {
if (!Token.empty())
NewArgv.push_back(Saver.save(StringRef(Token)).data());
- // Mark the end of lines in response files.
- if (MarkEOLs && C == '\n')
- NewArgv.push_back(nullptr);
+ // Mark the end of lines in response files.
+ if (MarkEOLs && C == '\n')
+ NewArgv.push_back(nullptr);
Token.clear();
continue;
}
@@ -955,8 +955,8 @@ tokenizeWindowsCommandLineImpl(StringRef Src, StringSaver &Saver,
// No special characters: slice out the substring and start the next
// token. Copy the string if the caller asks us to.
AddToken(AlwaysCopy ? Saver.save(NormalChars) : NormalChars);
- if (I < E && Src[I] == '\n')
- MarkEOL();
+ if (I < E && Src[I] == '\n')
+ MarkEOL();
} else if (Src[I] == '\"') {
Token += NormalChars;
State = QUOTED;
@@ -1204,7 +1204,7 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
};
// Check for recursive response files.
- if (any_of(drop_begin(FileStack), IsEquivalent)) {
+ if (any_of(drop_begin(FileStack), IsEquivalent)) {
// This file is recursive, so we leave it in the argument stream and
// move on.
AllExpanded = false;
@@ -1247,22 +1247,22 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
return AllExpanded;
}
-bool cl::expandResponseFiles(int Argc, const char *const *Argv,
- const char *EnvVar, StringSaver &Saver,
- SmallVectorImpl<const char *> &NewArgv) {
- auto Tokenize = Triple(sys::getProcessTriple()).isOSWindows()
- ? cl::TokenizeWindowsCommandLine
- : cl::TokenizeGNUCommandLine;
- // The environment variable specifies initial options.
- if (EnvVar)
- if (llvm::Optional<std::string> EnvValue = sys::Process::GetEnv(EnvVar))
- Tokenize(*EnvValue, Saver, NewArgv, /*MarkEOLs=*/false);
-
- // Command line options can override the environment variable.
- NewArgv.append(Argv + 1, Argv + Argc);
- return ExpandResponseFiles(Saver, Tokenize, NewArgv);
-}
-
+bool cl::expandResponseFiles(int Argc, const char *const *Argv,
+ const char *EnvVar, StringSaver &Saver,
+ SmallVectorImpl<const char *> &NewArgv) {
+ auto Tokenize = Triple(sys::getProcessTriple()).isOSWindows()
+ ? cl::TokenizeWindowsCommandLine
+ : cl::TokenizeGNUCommandLine;
+ // The environment variable specifies initial options.
+ if (EnvVar)
+ if (llvm::Optional<std::string> EnvValue = sys::Process::GetEnv(EnvVar))
+ Tokenize(*EnvValue, Saver, NewArgv, /*MarkEOLs=*/false);
+
+ // Command line options can override the environment variable.
+ NewArgv.append(Argv + 1, Argv + Argc);
+ return ExpandResponseFiles(Saver, Tokenize, NewArgv);
+}
+
bool cl::readConfigFile(StringRef CfgFile, StringSaver &Saver,
SmallVectorImpl<const char *> &Argv) {
SmallString<128> AbsPath;
@@ -1726,19 +1726,19 @@ void Option::printHelpStr(StringRef HelpStr, size_t Indent,
}
}
-void Option::printEnumValHelpStr(StringRef HelpStr, size_t BaseIndent,
- size_t FirstLineIndentedBy) {
- const StringRef ValHelpPrefix = " ";
- assert(BaseIndent >= FirstLineIndentedBy);
- std::pair<StringRef, StringRef> Split = HelpStr.split('\n');
- outs().indent(BaseIndent - FirstLineIndentedBy)
- << ArgHelpPrefix << ValHelpPrefix << Split.first << "\n";
- while (!Split.second.empty()) {
- Split = Split.second.split('\n');
- outs().indent(BaseIndent + ValHelpPrefix.size()) << Split.first << "\n";
- }
-}
-
+void Option::printEnumValHelpStr(StringRef HelpStr, size_t BaseIndent,
+ size_t FirstLineIndentedBy) {
+ const StringRef ValHelpPrefix = " ";
+ assert(BaseIndent >= FirstLineIndentedBy);
+ std::pair<StringRef, StringRef> Split = HelpStr.split('\n');
+ outs().indent(BaseIndent - FirstLineIndentedBy)
+ << ArgHelpPrefix << ValHelpPrefix << Split.first << "\n";
+ while (!Split.second.empty()) {
+ Split = Split.second.split('\n');
+ outs().indent(BaseIndent + ValHelpPrefix.size()) << Split.first << "\n";
+ }
+}
+
// Print out the option for the alias.
void alias::printOptionInfo(size_t GlobalWidth) const {
outs() << PrintArg(ArgStr);
@@ -1984,17 +1984,17 @@ void generic_parser_base::printOptionInfo(const Option &O,
StringRef Description = getDescription(i);
if (!shouldPrintOption(OptionName, Description, O))
continue;
- size_t FirstLineIndent = OptionName.size() + OptionPrefixesSize;
+ size_t FirstLineIndent = OptionName.size() + OptionPrefixesSize;
outs() << OptionPrefix << OptionName;
if (OptionName.empty()) {
outs() << EmptyOption;
- assert(FirstLineIndent >= EmptyOption.size());
- FirstLineIndent += EmptyOption.size();
+ assert(FirstLineIndent >= EmptyOption.size());
+ FirstLineIndent += EmptyOption.size();
}
if (!Description.empty())
- Option::printEnumValHelpStr(Description, GlobalWidth, FirstLineIndent);
- else
- outs() << '\n';
+ Option::printEnumValHelpStr(Description, GlobalWidth, FirstLineIndent);
+ else
+ outs() << '\n';
}
} else {
if (!O.HelpStr.empty())
@@ -2599,7 +2599,7 @@ void cl::HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
SubCommand &Sub) {
for (auto &I : Sub.OptionsMap) {
for (auto &Cat : I.second->Categories) {
- if (!is_contained(Categories, Cat) && Cat != &GenericCategory)
+ if (!is_contained(Categories, Cat) && Cat != &GenericCategory)
I.second->setHiddenFlag(cl::ReallyHidden);
}
}