mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
TableGen/OptParser: When ordering options, make "sentinel" options appear before
everything else. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89368 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eeebecfcb4
commit
a627ef57ec
@ -35,9 +35,16 @@ static int CompareOptionRecords(const void *Av, const void *Bv) {
|
||||
const Record *A = *(Record**) Av;
|
||||
const Record *B = *(Record**) Bv;
|
||||
|
||||
// Compare options by name first.
|
||||
if (int Cmp = StrCmpOptionName(A->getValueAsString("Name").c_str(),
|
||||
B->getValueAsString("Name").c_str()))
|
||||
// Sentinel options preceed all others and are only ordered by precedence.
|
||||
bool ASent = A->getValueAsDef("Kind")->getValueAsBit("Sentinel");
|
||||
bool BSent = B->getValueAsDef("Kind")->getValueAsBit("Sentinel");
|
||||
if (ASent != BSent)
|
||||
return ASent ? -1 : 1;
|
||||
|
||||
// Compare options by name, unless they are sentinels.
|
||||
if (!ASent)
|
||||
if (int Cmp = StrCmpOptionName(A->getValueAsString("Name").c_str(),
|
||||
B->getValueAsString("Name").c_str()))
|
||||
return Cmp;
|
||||
|
||||
// Then by the kind precedence;
|
||||
|
Loading…
x
Reference in New Issue
Block a user