diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-01 11:07:05 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-01 11:07:05 +0000 | 
| commit | 06f9d4012fb8acea3e9861d5722b5965dbb724d9 (patch) | |
| tree | ffe0478472eaa0686f11cb02c6df7d257b8719b0 /utils/TableGen/OptParserEmitter.cpp | |
| parent | 76e2e0ebfdd3d91b07a75822865ea3e9121a99ce (diff) | |
Notes
Diffstat (limited to 'utils/TableGen/OptParserEmitter.cpp')
| -rw-r--r-- | utils/TableGen/OptParserEmitter.cpp | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/utils/TableGen/OptParserEmitter.cpp b/utils/TableGen/OptParserEmitter.cpp index a09ba083f3e0..ce1aef5e4dad 100644 --- a/utils/TableGen/OptParserEmitter.cpp +++ b/utils/TableGen/OptParserEmitter.cpp @@ -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; | 
