Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions llvm/include/llvm/Support/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -1459,20 +1459,16 @@ class opt
}
}

template <class T, class = std::enable_if_t<std::is_assignable_v<T &, T>>>
void setDefaultImpl() {
const OptionValue<DataType> &V = this->getDefault();
if (V.hasValue())
this->setValue(V.getValue());
else
this->setValue(T());
void setDefault() override {
if constexpr (std::is_assignable_v<DataType &, DataType>) {
const OptionValue<DataType> &V = this->getDefault();
if (V.hasValue())
this->setValue(V.getValue());
else
this->setValue(DataType());
}
}

template <class T, class = std::enable_if_t<!std::is_assignable_v<T &, T>>>
void setDefaultImpl(...) {}

void setDefault() override { setDefaultImpl<DataType>(); }

void done() {
addArgument();
Parser.initialize();
Expand Down
Loading