assert(VBase != other.VBase);
return VBTableIndex < other.VBTableIndex;
}
- if (VFPtrOffset != other.VFPtrOffset)
- return VFPtrOffset < other.VFPtrOffset;
- if (Index != other.Index)
- return Index < other.Index;
- return false;
+ return std::tie(VFPtrOffset, Index) <
+ std::tie(other.VFPtrOffset, other.Index);
}
};
/// If not provided, minor and subminor version numbers are considered to be
/// zero.
friend bool operator<(const VersionTuple &X, const VersionTuple &Y) {
- if (X.Major != Y.Major)
- return X.Major < Y.Major;
-
- if (X.Minor != Y.Minor)
- return X.Minor < Y.Minor;
-
- return X.Subminor < Y.Subminor;
+ return std::tie(X.Major, X.Minor, X.Subminor) <
+ std::tie(Y.Major, Y.Minor, Y.Subminor);
}
/// \brief Determine whether one version number follows another.
return !(LHS == RHS);
}
friend bool operator<(FileOffset LHS, FileOffset RHS) {
- if (LHS.FID != RHS.FID)
- return LHS.FID < RHS.FID;
- return LHS.Offs < RHS.Offs;
+ return std::tie(LHS.FID, LHS.Offs) < std::tie(RHS.FID, RHS.Offs);
}
friend bool operator>(FileOffset LHS, FileOffset RHS) {
- if (LHS.FID != RHS.FID)
- return LHS.FID > RHS.FID;
- return LHS.Offs > RHS.Offs;
+ return RHS < LHS;
}
friend bool operator>=(FileOffset LHS, FileOffset RHS) {
- return LHS > RHS || LHS == RHS;
+ return !(LHS < RHS);
}
friend bool operator<=(FileOffset LHS, FileOffset RHS) {
- return LHS < RHS || LHS == RHS;
+ return !(RHS < LHS);
}
};
/// Unsigned integers are considered to be better conversion types than
/// signed integers of the same width.
bool operator<(const APSIntType &Other) const {
- if (BitWidth < Other.BitWidth)
- return true;
- if (BitWidth > Other.BitWidth)
- return false;
- if (!IsUnsigned && Other.IsUnsigned)
- return true;
- return false;
+ return std::tie(BitWidth, IsUnsigned) <
+ std::tie(Other.BitWidth, Other.IsUnsigned);
}
};
std::sort(ThunksVector.begin(), ThunksVector.end(),
[](const ThunkInfo &LHS, const ThunkInfo &RHS) {
assert(LHS.Method == 0 && RHS.Method == 0);
-
- if (LHS.This != RHS.This)
- return LHS.This < RHS.This;
- return LHS.Return < RHS.Return;
+ return std::tie(LHS.This, LHS.Return) < std::tie(RHS.This, RHS.Return);
});
Out << "Thunks for '" << MethodName << "' (" << ThunksVector.size();
[](const ThunkInfo &LHS, const ThunkInfo &RHS) {
// Keep different thunks with the same adjustments in the order they
// were put into the vector.
- if (LHS.This != RHS.This)
- return LHS.This < RHS.This;
- return LHS.Return < RHS.Return;
+ return std::tie(LHS.This, LHS.Return) < std::tie(RHS.This, RHS.Return);
});
Out << "Thunks for '" << MethodName << "' (" << ThunksVector.size();
BoundNodesTreeBuilder BoundNodes;
bool operator<(const MatchKey &Other) const {
- if (MatcherID != Other.MatcherID)
- return MatcherID < Other.MatcherID;
- if (Node != Other.Node)
- return Node < Other.Node;
- return BoundNodes < Other.BoundNodes;
+ return std::tie(MatcherID, Node, BoundNodes) <
+ std::tie(Other.MatcherID, Other.Node, Other.BoundNodes);
}
};
}
bool operator<(const OrderGlobalInits &RHS) const {
- if (priority < RHS.priority)
- return true;
-
- return priority == RHS.priority && lex_order < RHS.lex_order;
+ return std::tie(priority, lex_order) <
+ std::tie(RHS.priority, RHS.lex_order);
}
};
}
bool operator<(const CountKey &RHS) const {
- return (CallSite == RHS.CallSite) ? (BlockID < RHS.BlockID)
- : (CallSite < RHS.CallSite);
+ return std::tie(CallSite, BlockID) < std::tie(RHS.CallSite, RHS.BlockID);
}
void Profile(llvm::FoldingSetNodeID &ID) const {