summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Support/CommandLine.h8
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp8
2 files changed, 16 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 8c1d35c3cbc..8a67546c747 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -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 &) {};
};
//===----------------------------------------------------------------------===//
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 702aa526fda..a435200bb31 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -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
OpenPOWER on IntegriCloud