From: Peter Collingbourne Date: Thu, 16 Oct 2014 22:47:52 +0000 (+0000) Subject: Introduce LLVMParseCommandLineOptions C API function. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=86b3d8eb4387d6c896b5d2c811b817c735f55cbf Introduce LLVMParseCommandLineOptions C API function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219975 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm-c/Support.h b/include/llvm-c/Support.h index 4e6ff220b10..a9216d0364a 100644 --- a/include/llvm-c/Support.h +++ b/include/llvm-c/Support.h @@ -47,6 +47,17 @@ typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef; */ LLVMBool LLVMLoadLibraryPermanently(const char* Filename); +/** + * This function parses the given arguments using the LLVM command line parser. + * Note that the only stable thing about this function is its signature; you + * cannot rely on any particular set of command line arguments being interpreted + * the same way across LLVM versions. + * + * @see llvm::cl::ParseCommandLineOptions() + */ +void LLVMParseCommandLineOptions(int argc, const char *const *argv, + const char *Overview); + #ifdef __cplusplus } #endif diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 9d5f1580724..172381b3d34 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -17,6 +17,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/CommandLine.h" +#include "llvm-c/Support.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallString.h" @@ -1839,3 +1840,8 @@ void cl::getRegisteredOptions(StringMap &Map) GetOptionInfo(PositionalOpts, SinkOpts, Map); return; } + +void LLVMParseCommandLineOptions(int argc, const char *const *argv, + const char *Overview) { + llvm::cl::ParseCommandLineOptions(argc, argv, Overview); +}