[llvm] r219975 - Introduce LLVMParseCommandLineOptions C API function.

Peter Collingbourne peter at pcc.me.uk
Thu Oct 16 15:47:52 PDT 2014


Author: pcc
Date: Thu Oct 16 17:47:52 2014
New Revision: 219975

URL: http://llvm.org/viewvc/llvm-project?rev=219975&view=rev
Log:
Introduce LLVMParseCommandLineOptions C API function.

Modified:
    llvm/trunk/include/llvm-c/Support.h
    llvm/trunk/lib/Support/CommandLine.cpp

Modified: llvm/trunk/include/llvm-c/Support.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Support.h?rev=219975&r1=219974&r2=219975&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Support.h (original)
+++ llvm/trunk/include/llvm-c/Support.h Thu Oct 16 17:47:52 2014
@@ -47,6 +47,17 @@ typedef struct LLVMOpaqueMemoryBuffer *L
   */
 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

Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=219975&r1=219974&r2=219975&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Thu Oct 16 17:47:52 2014
@@ -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<
   GetOptionInfo(PositionalOpts, SinkOpts, Map);
   return;
 }
+
+void LLVMParseCommandLineOptions(int argc, const char *const *argv,
+                                 const char *Overview) {
+  llvm::cl::ParseCommandLineOptions(argc, argv, Overview);
+}





More information about the llvm-commits mailing list