diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /utils/TableGen/ClangDiagnosticsEmitter.cpp | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'utils/TableGen/ClangDiagnosticsEmitter.cpp')
| -rw-r--r-- | utils/TableGen/ClangDiagnosticsEmitter.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp index efce52190314..bbc2bdb065fe 100644 --- a/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -152,13 +152,12 @@ static bool beforeThanCompareGroups(const GroupInfo *LHS, const GroupInfo *RHS){ } static SMRange findSuperClassRange(const Record *R, StringRef SuperName) { - ArrayRef<Record *> Supers = R->getSuperClasses(); - - for (size_t i = 0, e = Supers.size(); i < e; ++i) - if (Supers[i]->getName() == SuperName) - return R->getSuperClassRanges()[i]; - - return SMRange(); + ArrayRef<std::pair<Record *, SMRange>> Supers = R->getSuperClasses(); + auto I = std::find_if(Supers.begin(), Supers.end(), + [&](const std::pair<Record *, SMRange> &SuperPair) { + return SuperPair.first->getName() == SuperName; + }); + return (I != Supers.end()) ? I->second : SMRange(); } /// \brief Invert the 1-[0/1] mapping of diags to group into a one to many |
