[PATCH] Option parsing: support case-insensitive option matching.

Rui Ueyama ruiu at google.com
Mon Aug 26 14:10:09 PDT 2013



================
Comment at: lib/Option/OptTable.cpp:16
@@ -15,2 +15,3 @@
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Debug.h"
 #include <algorithm>
----------------
Hans Wennborg wrote:
> I don't think this is used?
Removed.

================
Comment at: lib/Option/OptTable.cpp:19
@@ -17,2 +18,3 @@
 #include <map>
+#include <cctype>
 
----------------
Hans Wennborg wrote:
> sort order
Done.

================
Comment at: lib/Option/OptTable.cpp:174
@@ -172,1 +173,3 @@
 
+// Returns true if X starts with Y, ignoreing case.
+static bool startsWithIgnoreCase(StringRef X, StringRef Y) {
----------------
Hans Wennborg wrote:
> s/ignoreing/ignoring/
Done.

================
Comment at: utils/TableGen/OptParserEmitter.cpp:24
@@ -20,1 +23,3 @@
+// lib/Option/OptTable.cpp.
 static int StrCmpOptionName(const char *A, const char *B) {
+  const char *X = A, *Y = B;
----------------
Hans Wennborg wrote:
> should we extract this function and put it in OptionTable.h so it can be defined only once?
This method is actually slightly different from one in OptionTable.cpp. The return statement at line 29 returns the result of strcmp(), so that uppercase comes before lowercase. In OptionTable.cpp it returns 0, otherwise it may skip options in lowercase if uppercase string is given.


http://llvm-reviews.chandlerc.com/D1485



More information about the llvm-commits mailing list