summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorAiden Grossman <aidengrossman@google.com>2025-09-26 22:48:22 +0000
committerAiden Grossman <aidengrossman@google.com>2025-09-26 22:48:22 +0000
commit76533872e149395812a6d1651aa49dbf53fb4921 (patch)
tree199a669fa57a4effc3116705d2ec89c07ff36c65 /llvm/lib/Support/CommandLine.cpp
parent54f5c1b2e17a9be61609d70dbbc8354ad41bb931 (diff)
parent37e7ad184d002db15f72771938755580433cf96d (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/boomanaiden154/main.lit-remove-t-from-tests
Created using spr 1.3.6 [skip ci]
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 12a8d0c3a6ba..9491ec049f79 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -101,6 +101,7 @@ void parser<unsigned long long>::anchor() {}
void parser<double>::anchor() {}
void parser<float>::anchor() {}
void parser<std::string>::anchor() {}
+void parser<std::optional<std::string>>::anchor() {}
void parser<char>::anchor() {}
// These anchor functions instantiate opt<T> and reference its virtual
@@ -2261,6 +2262,22 @@ void parser<std::string>::printOptionDiff(const Option &O, StringRef V,
outs() << ")\n";
}
+void parser<std::optional<std::string>>::printOptionDiff(
+ const Option &O, std::optional<StringRef> V,
+ const OptionValue<std::optional<std::string>> &D,
+ size_t GlobalWidth) const {
+ printOptionName(O, GlobalWidth);
+ outs() << "= " << V;
+ size_t VSize = V.has_value() ? V.value().size() : 0;
+ size_t NumSpaces = MaxOptWidth > VSize ? MaxOptWidth - VSize : 0;
+ outs().indent(NumSpaces) << " (default: ";
+ if (D.hasValue() && D.getValue().has_value())
+ outs() << D.getValue();
+ else
+ outs() << "*no value*";
+ outs() << ")\n";
+}
+
// Print a placeholder for options that don't yet support printOptionDiff().
void basic_parser_impl::printOptionNoValue(const Option &O,
size_t GlobalWidth) const {