]> granicus.if.org Git - llvm/commitdiff
Expose ProvidePositionalOption as a public API
authorMehdi Amini <joker.eph@gmail.com>
Sat, 5 Oct 2019 01:37:04 +0000 (01:37 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Sat, 5 Oct 2019 01:37:04 +0000 (01:37 +0000)
The motivation is to reuse the key value parsing logic here to
parse instance specific pass options within the context of MLIR.
The primary functionality exposed is the "," splitting for
arrays and the logic for properly handling duplicate definitions
of a single flag.

Patch by: Parker Schuh <parkers@google.com>

Differential Revision: https://reviews.llvm.org/D68294

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373815 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/CommandLine.h
lib/Support/CommandLine.cpp

index 3cc2c3c0121b2b46b5ee4324dd12aeef28a780f1..63784463e1718590079aec1a823de78f99a56626 100644 (file)
@@ -2000,6 +2000,9 @@ void ResetAllOptionOccurrences();
 /// where no options are supported.
 void ResetCommandLineParser();
 
+/// Parses `Arg` into the option handler `Handler`.
+bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i);
+
 } // end namespace cl
 
 } // end namespace llvm
index 25510fa58ff54335eb54c1b7e87b0d2702fd575b..620f7ffd4c9facee61ae4a95d5de066440907d42 100644 (file)
@@ -692,7 +692,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
   return false;
 }
 
-static bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i) {
+bool llvm::cl::ProvidePositionalOption(Option *Handler, StringRef Arg, int i) {
   int Dummy = i;
   return ProvideOption(Handler, Handler->ArgStr, Arg, 0, nullptr, Dummy);
 }