[CommandLine] Add missing Callbacks

It appears that the cl::bits options are not used anywhere in-tree. In
the recent addition to add Callback's to the options, the Callback was
missing from this one. This fixes it by adding the same code from the
other classes.

It also adds a simple test, of sorts, just to make sure these continue
compiling.
This commit is contained in:
David Green 2019-12-09 10:33:33 +00:00
parent ff57153d05
commit 5ce4d154f5
2 changed files with 16 additions and 0 deletions

View File

@ -1794,6 +1794,14 @@ public:
apply(this, Ms...);
done();
}
void setCallback(
std::function<void(const typename ParserClass::parser_data_type &)> CB) {
Callback = CB;
}
std::function<void(const typename ParserClass::parser_data_type &)> Callback =
[](const typename ParserClass::parser_data_type &) {};
};
//===----------------------------------------------------------------------===//

View File

@ -1784,4 +1784,12 @@ TEST(CommandLineTest, Callback) {
cl::ResetAllOptionOccurrences();
}
enum Enum { Val1, Val2 };
static cl::bits<Enum> ExampleBits(
cl::desc("An example cl::bits to ensure it compiles"),
cl::values(
clEnumValN(Val1, "bits-val1", "The Val1 value"),
clEnumValN(Val1, "bits-val2", "The Val2 value")));
} // anonymous namespace