[llvm] r355300 - [SubtargetFeatures] Add operator< for comparing SubtargetInfoKV objects. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 20:26:31 PST 2019
Author: ctopper
Date: Sun Mar 3 20:26:31 2019
New Revision: 355300
URL: http://llvm.org/viewvc/llvm-project?rev=355300&view=rev
Log:
[SubtargetFeatures] Add operator< for comparing SubtargetInfoKV objects. NFCI
Use instead of passing a lambda to std::is_sorted. This is more consistent with SubtargetFeatureKV.
Modified:
llvm/trunk/include/llvm/MC/SubtargetFeature.h
llvm/trunk/lib/MC/MCSubtargetInfo.cpp
Modified: llvm/trunk/include/llvm/MC/SubtargetFeature.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=355300&r1=355299&r2=355300&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/SubtargetFeature.h (original)
+++ llvm/trunk/include/llvm/MC/SubtargetFeature.h Sun Mar 3 20:26:31 2019
@@ -100,6 +100,11 @@ struct SubtargetInfoKV {
bool operator<(StringRef S) const {
return StringRef(Key) < S;
}
+
+ /// Compare routine for std::is_sorted.
+ bool operator<(const SubtargetInfoKV &Other) const {
+ return StringRef(Key) < StringRef(Other.Key);
+ }
};
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/MC/MCSubtargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSubtargetInfo.cpp?rev=355300&r1=355299&r2=355300&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSubtargetInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCSubtargetInfo.cpp Sun Mar 3 20:26:31 2019
@@ -87,10 +87,7 @@ const MCSchedModel &MCSubtargetInfo::get
ArrayRef<SubtargetInfoKV> SchedModels(ProcSchedModels, ProcDesc.size());
- assert(std::is_sorted(SchedModels.begin(), SchedModels.end(),
- [](const SubtargetInfoKV &LHS, const SubtargetInfoKV &RHS) {
- return strcmp(LHS.Key, RHS.Key) < 0;
- }) &&
+ assert(std::is_sorted(SchedModels.begin(), SchedModels.end()) &&
"Processor machine model table is not sorted");
// Find entry
More information about the llvm-commits
mailing list