Commit 4a6e13ad authored by David Green's avatar David Green
Browse files

[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.
parent b1aba037
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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 &) {};
};

//===----------------------------------------------------------------------===//
+8 −0
Original line number Diff line number Diff line
@@ -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