projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct word hyphenations
[oota-llvm.git]
/
utils
/
TableGen
/
OptParserEmitter.cpp
diff --git
a/utils/TableGen/OptParserEmitter.cpp
b/utils/TableGen/OptParserEmitter.cpp
index 86328bf18f550b51550b4b7e817d7a04f3b03943..9c4daaf7747dbed13c427dbfec7a1c46d767e778 100644
(file)
--- a/
utils/TableGen/OptParserEmitter.cpp
+++ b/
utils/TableGen/OptParserEmitter.cpp
@@
-13,18
+13,23
@@
#include "llvm/ADT/Twine.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include "llvm/ADT/Twine.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
+#include <cstring>
+#include <cctype>
#include <map>
using namespace llvm;
#include <map>
using namespace llvm;
+// Ordering on Info. The logic should match with the consumer-side function in
+// llvm/Option/OptTable.h.
static int StrCmpOptionName(const char *A, const char *B) {
static int StrCmpOptionName(const char *A, const char *B) {
- char a = *A, b = *B;
+ const char *X = A, *Y = B;
+ char a = tolower(*A), b = tolower(*B);
while (a == b) {
if (a == '\0')
while (a == b) {
if (a == '\0')
- return
0
;
+ return
strcmp(A, B)
;
- a =
*++A
;
- b =
*++B
;
+ a =
tolower(*++X)
;
+ b =
tolower(*++Y)
;
}
if (a == '\0') // A is a prefix of B.
}
if (a == '\0') // A is a prefix of B.
@@
-36,9
+41,9
@@
static int StrCmpOptionName(const char *A, const char *B) {
return (a < b) ? -1 : 1;
}
return (a < b) ? -1 : 1;
}
-static int CompareOptionRecords(
const void *Av, const void
*Bv) {
- const Record *A = *
(const Record*const*)
Av;
- const Record *B = *
(const Record*const*)
Bv;
+static int CompareOptionRecords(
Record *const *Av, Record *const
*Bv) {
+ const Record *A = *Av;
+ const Record *B = *Bv;
// Sentinel options precede all others and are only ordered by precedence.
bool ASent = A->getValueAsDef("Kind")->getValueAsBit("Sentinel");
// Sentinel options precede all others and are only ordered by precedence.
bool ASent = A->getValueAsDef("Kind")->getValueAsBit("Sentinel");
@@
-50,7
+55,7
@@
static int CompareOptionRecords(const void *Av, const void *Bv) {
if (!ASent)
if (int Cmp = StrCmpOptionName(A->getValueAsString("Name").c_str(),
B->getValueAsString("Name").c_str()))
if (!ASent)
if (int Cmp = StrCmpOptionName(A->getValueAsString("Name").c_str(),
B->getValueAsString("Name").c_str()))
- return Cmp;
+
return Cmp;
if (!ASent) {
std::vector<std::string> APrefixes = A->getValueAsListOfStrings("Prefixes");
if (!ASent) {
std::vector<std::string> APrefixes = A->getValueAsListOfStrings("Prefixes");
@@
-74,7
+79,7
@@
static int CompareOptionRecords(const void *Av, const void *Bv) {
if (APrec == BPrec &&
A->getValueAsListOfStrings("Prefixes") ==
B->getValueAsListOfStrings("Prefixes")) {
if (APrec == BPrec &&
A->getValueAsListOfStrings("Prefixes") ==
B->getValueAsListOfStrings("Prefixes")) {
- PrintError(A->getLoc(), Twine("Option is equiv
i
lent to"));
+ PrintError(A->getLoc(), Twine("Option is equiv
a
lent to"));
PrintError(B->getLoc(), Twine("Other defined here"));
PrintFatalError("Equivalent Options found.");
}
PrintError(B->getLoc(), Twine("Other defined here"));
PrintFatalError("Equivalent Options found.");
}